2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Private graphics function for allocating screen bitmaps
8 #include "graphics_intern.h"
9 #include <exec/memory.h>
10 #include <graphics/rastport.h>
11 #include <proto/exec.h>
12 #include <proto/oop.h>
14 #include "gfxfuncsupport.h"
17 /*****************************************************************************
20 #include <graphics/rastport.h>
21 #include <proto/graphics.h>
23 AROS_LH1(struct BitMap
* , AllocScreenBitMap
,
26 AROS_LHA(ULONG
, modeid
, D0
),
29 struct GfxBase
*, GfxBase
, 182, Graphics
)
32 Allocates a bitmap for use with a screen opened by OpenScreen()
35 modeid - the DisplayID of the screen to create
38 bitmap - pointer to the newly created bitmap.
41 This function is private and AROS specific.
53 *****************************************************************************/
57 struct BitMap
*nbm
= NULL
;
58 HIDDT_ModeID hiddmode
;
60 /* First get the the gfxmode for this modeid */
61 hiddmode
= get_hiddmode_for_amigamodeid(modeid
, GfxBase
);
63 if (vHidd_ModeID_Invalid
!= hiddmode
)
65 /* Create the bitmap from the hidd mode */
66 OOP_Object
*sync
, *pf
;
68 if (HIDD_Gfx_GetMode(SDD(GfxBase
)->gfxhidd
, hiddmode
, &sync
, &pf
))
70 IPTR width
, height
, depth
;
72 OOP_GetAttr(sync
, aHidd_Sync_HDisp
, &width
);
73 OOP_GetAttr(sync
, aHidd_Sync_VDisp
, &height
);
74 OOP_GetAttr(pf
, aHidd_PixFmt_Depth
, &depth
);
76 /* Hack: a negative depth indicates to AllocBitMap, that
77 the friend bitmap param actually is the hiddmode */
79 nbm
= AllocBitMap(width
, height
, -((LONG
)depth
), HIDD_BMF_SCREEN_BITMAP
| BMF_DISPLAYABLE
, (struct BitMap
*)hiddmode
);
87 } /* AllocScreenBitMap */