2 Copyright © 1995-2001, 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 *****************************************************************************/
61 AROS_LIBBASE_EXT_DECL(struct GfxBase
*,GfxBase
)
63 #warning THIS IS NOT THREADSAFE
65 /* To make this threadsafe we have to lock
66 all gfx access in all the rendering calls
68 OOP_Object
*cmap
, *pf
;
69 HIDDT_ColorModel colmod
;
74 //if (bitmap && (BMF_DISPLAYABLE != (bitmap->Flags & BMF_DISPLAYABLE)))
75 if (bitmap
&& (!(bitmap
->Flags
& BMF_AROS_HIDD
) || !(HIDD_BM_FLAGS(bitmap
) & HIDD_BMF_SCREEN_BITMAP
)))
77 D(bug("!!! SetFrontBitMap: TRYING TO SET NON-DISPLAYABLE BITMAP !!!\n"));
81 if ( SDD(GfxBase
)->frontbm
== bitmap
)
83 D(bug("!!!!!!!!!!!!!!! SHOWING BITMAP %p TWICE !!!!!!!!!!!\n", bitmap
));
89 showflags
|= fHidd_Gfx_Show_CopyBack
;
92 fb
= HIDD_Gfx_Show(SDD(GfxBase
)->gfxhidd
, (bitmap
? HIDD_BM_OBJ(bitmap
) : NULL
), showflags
);
96 D(bug("!!! SetFrontBitMap: HIDD_Gfx_Show() FAILED !!!\n"));
102 /* Set this as the active screen */
103 if (NULL
!= SDD(GfxBase
)->frontbm
)
105 struct BitMap
*oldbm
;
106 /* Put back the old values into the old bitmap */
107 oldbm
= SDD(GfxBase
)->frontbm
;
108 HIDD_BM_OBJ(oldbm
) = SDD(GfxBase
)->bm_bak
;
109 HIDD_BM_COLMOD(oldbm
) = SDD(GfxBase
)->colmod_bak
;
110 HIDD_BM_COLMAP(oldbm
) = SDD(GfxBase
)->colmap_bak
;
114 SDD(GfxBase
)->frontbm
= bitmap
;
115 SDD(GfxBase
)->bm_bak
= bitmap
? HIDD_BM_OBJ(bitmap
) : NULL
;
116 SDD(GfxBase
)->colmod_bak
= bitmap
? HIDD_BM_COLMOD(bitmap
) : NULL
;
117 SDD(GfxBase
)->colmap_bak
= bitmap
? HIDD_BM_COLMAP(bitmap
) : NULL
;
121 /* Insert the framebuffer in its place */
122 OOP_GetAttr(fb
, aHidd_BitMap_ColorMap
, (IPTR
*)&cmap
);
123 OOP_GetAttr(fb
, aHidd_BitMap_PixFmt
, (IPTR
*)&pf
);
124 OOP_GetAttr(pf
, aHidd_PixFmt_ColorModel
, &colmod
);
126 HIDD_BM_OBJ(bitmap
) = fb
;
127 HIDD_BM_COLMOD(bitmap
) = colmod
;
128 HIDD_BM_COLMAP(bitmap
) = cmap
;
139 } /* AllocScreenBitMap */