2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Private graphics function for allocating screen bitmaps
8 #include <aros/debug.h>
9 #include "graphics_intern.h"
10 #include "gfxfuncsupport.h"
11 #include <exec/memory.h>
12 #include <graphics/rastport.h>
13 #include <proto/exec.h>
14 #include <proto/oop.h>
17 /*****************************************************************************
20 #include <graphics/rastport.h>
21 #include <proto/graphics.h>
23 AROS_LH2(BOOL
, SetFrontBitMap
,
26 AROS_LHA(struct BitMap
*, bitmap
, A0
),
27 AROS_LHA(BOOL
, copyback
, D0
),
30 struct GfxBase
*, GfxBase
, 184, Graphics
)
33 Sets the supplied screen as the frontmost, e.g. shows it in the display.
36 bitmap - The bitmap to put in front. Must be a displayable bitmap.
37 copyback - Whether to copy back from the framebuffer into
38 the previously front bitmap. !!!! Only set this to TRUE
39 this if you are 100% SURE that
40 the previously shown bitmap has not been disposed
43 success - TRUE if successful, FALSE otherwise.
46 This function is private and AROS specific.
58 *****************************************************************************/
62 #warning THIS IS NOT THREADSAFE
64 /* To make this threadsafe we have to lock
65 all gfx access in all the rendering calls
67 OOP_Object
*cmap
, *pf
;
68 HIDDT_ColorModel colmod
;
73 //if (bitmap && (BMF_DISPLAYABLE != (bitmap->Flags & BMF_DISPLAYABLE)))
74 if (bitmap
&& (!(bitmap
->Flags
& BMF_AROS_HIDD
) || !(HIDD_BM_FLAGS(bitmap
) & HIDD_BMF_SCREEN_BITMAP
)))
76 D(bug("!!! SetFrontBitMap: TRYING TO SET NON-DISPLAYABLE BITMAP !!!\n"));
80 if ( SDD(GfxBase
)->frontbm
== bitmap
)
82 D(bug("!!!!!!!!!!!!!!! SHOWING BITMAP %p TWICE !!!!!!!!!!!\n", bitmap
));
88 showflags
|= fHidd_Gfx_Show_CopyBack
;
91 fb
= HIDD_Gfx_Show(SDD(GfxBase
)->gfxhidd
, (bitmap
? HIDD_BM_OBJ(bitmap
) : NULL
), showflags
);
95 D(bug("!!! SetFrontBitMap: HIDD_Gfx_Show() FAILED !!!\n"));
101 /* Set this as the active screen */
102 if (NULL
!= SDD(GfxBase
)->frontbm
)
104 struct BitMap
*oldbm
;
105 /* Put back the old values into the old bitmap */
106 oldbm
= SDD(GfxBase
)->frontbm
;
107 HIDD_BM_OBJ(oldbm
) = SDD(GfxBase
)->bm_bak
;
108 HIDD_BM_COLMOD(oldbm
) = SDD(GfxBase
)->colmod_bak
;
109 HIDD_BM_COLMAP(oldbm
) = SDD(GfxBase
)->colmap_bak
;
113 SDD(GfxBase
)->frontbm
= bitmap
;
114 SDD(GfxBase
)->bm_bak
= bitmap
? HIDD_BM_OBJ(bitmap
) : NULL
;
115 SDD(GfxBase
)->colmod_bak
= bitmap
? HIDD_BM_COLMOD(bitmap
) : NULL
;
116 SDD(GfxBase
)->colmap_bak
= bitmap
? HIDD_BM_COLMAP(bitmap
) : NULL
;
120 /* Insert the framebuffer in its place */
121 OOP_GetAttr(fb
, aHidd_BitMap_ColorMap
, (IPTR
*)&cmap
);
122 OOP_GetAttr(fb
, aHidd_BitMap_PixFmt
, (IPTR
*)&pf
);
123 OOP_GetAttr(pf
, aHidd_PixFmt_ColorModel
, &colmod
);
125 HIDD_BM_OBJ(bitmap
) = fb
;
126 HIDD_BM_COLMOD(bitmap
) = colmod
;
127 HIDD_BM_COLMAP(bitmap
) = cmap
;
138 } /* AllocScreenBitMap */