picture.datatype: gi_RastPort should not be directly accessed
[AROS.git] / rom / intuition / freescreenbuffer.c
blobf07927c9307e600b037e28cfff150543f6238cb2
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include <graphics/rastport.h>
8 #include <proto/graphics.h>
9 #include "intuition_intern.h"
11 /*****************************************************************************
13 NAME */
14 #include <intuition/screens.h>
15 #include <proto/intuition.h>
17 AROS_LH2(void, FreeScreenBuffer,
19 /* SYNOPSIS */
20 AROS_LHA(struct Screen * , screen, A0),
21 AROS_LHA(struct ScreenBuffer *, screenbuffer, A1),
23 /* LOCATION */
24 struct IntuitionBase *, IntuitionBase, 129, Intuition)
26 /* FUNCTION
27 Frees a ScreenBuffer allocated by AllocScreenBuffer() and releases
28 associated resources. You have to call this before closing your
29 screen.
31 INPUTS
32 screen - The screen this screenbuffer belongs to
33 screenbuffer - The screenbuffer obtained by AllocScreenBuffer()
34 It is safe to pass NULL.
36 RESULT
37 None.
39 NOTES
40 When used SB_SCREEN_BITMAP on allocating the ScreenBuffer
41 (ie. the ScreenBuffer only refers to the screen's BitMap) you must
42 FreeScreenBuffer() the ScreenBuffer before closing the screen.
43 Intuition will recognize when FreeScreenBuffer() is called for the
44 currently installed ScreenBuffer that it must not free the BitMap.
45 This is left to the CloseScreen() function.
47 EXAMPLE
49 BUGS
51 SEE ALSO
52 AllocScreenBuffer(), ChangeScreenBuffer()
54 INTERNALS
56 HISTORY
58 *****************************************************************************/
60 AROS_LIBFUNC_INIT
62 struct GfxBase *GfxBase = GetPrivIBase(IntuitionBase)->GfxBase;
63 DEBUG_FREESCREENBUFFER(dprintf("FreeScreenBuffer: Screen 0x%lx ScreenBuffer 0x%lx\n",
64 screen, screenbuffer));
66 screen = screen; /* shut up the compiler */
68 if (screenbuffer)
70 FreeDBufInfo(screenbuffer->sb_DBufInfo);
72 if (((struct IntScreenBuffer *)screenbuffer)->free_bitmap)
73 FreeBitMap(screenbuffer->sb_BitMap);
75 FreeMem(screenbuffer, sizeof(struct IntScreenBuffer));
78 AROS_LIBFUNC_EXIT
79 } /* FreeScreenBuffer */