2 Copyright © 1995-2019, The AROS Development Team. All rights reserved.
5 Desc: Bitmap class for VMWareSVGA hidd.
9 #define __OOP_NOATTRBASES__
11 #include <proto/oop.h>
12 #include <proto/utility.h>
14 #include <exec/memory.h>
15 #include <exec/lists.h>
16 #include <aros/symbolsets.h>
17 #include <graphics/rastport.h>
18 #include <graphics/gfx.h>
22 #include "vmwaresvga_intern.h"
24 #include LC_LIBDEFS_FILE
26 /* Don't initialize static variables with "=0", otherwise they go into DATA segment */
28 static OOP_AttrBase HiddBitMapAttrBase
;
29 static OOP_AttrBase HiddPixFmtAttrBase
;
30 static OOP_AttrBase HiddGfxAttrBase
;
31 static OOP_AttrBase HiddSyncAttrBase
;
32 static OOP_AttrBase HiddVMWareSVGAAttrBase
;
33 static OOP_AttrBase HiddVMWareSVGABitMapAttrBase
;
35 static struct OOP_ABDescr attrbases
[] =
37 { IID_Hidd_BitMap
, &HiddBitMapAttrBase
},
38 { IID_Hidd_PixFmt
, &HiddPixFmtAttrBase
},
39 { IID_Hidd_Gfx
, &HiddGfxAttrBase
},
40 { IID_Hidd_Sync
, &HiddSyncAttrBase
},
42 { IID_Hidd_VMWareSVGA
, &HiddVMWareSVGAAttrBase
},
43 { IID_Hidd_VMWareSVGABitMap
, &HiddVMWareSVGABitMapAttrBase
},
47 #define DEBUGNAME "[VMWareSVGA:OnBitMap]"
48 #define MNAME_ROOT(x) VMWareSVGAOnBM__Root__ ## x
49 #define MNAME_BM(x) VMWareSVGAOnBM__Hidd_BitMap__ ## x
52 #include "vmwaresvga_bitmap_common.c"
55 include our debug overides after bitmap_common incase it sets its own values...
61 #include <aros/debug.h>
63 /*********** BitMap::New() *************************************/
65 OOP_Object
*MNAME_ROOT(New
)(OOP_Class
*cl
, OOP_Object
*o
, struct pRoot_New
*msg
)
67 D(bug(DEBUGNAME
" %s()\n", __func__
);)
69 o
= (OOP_Object
*)OOP_DoSuperMethod(cl
, o
, (OOP_Msg
) msg
);
72 struct BitmapData
*data
= OOP_INST_DATA(cl
, o
);
75 IPTR width
, height
, depth
;
79 memset(data
, 0, sizeof(struct BitmapData
));
83 OOP_GetAttr(o
, aHidd_BitMap_Width
, &width
);
84 OOP_GetAttr(o
, aHidd_BitMap_Height
, &height
);
85 OOP_GetAttr(o
, aHidd_BitMap_PixFmt
, (IPTR
*)&pf
);
86 OOP_GetAttr(pf
, aHidd_PixFmt_Depth
, &depth
);
87 ASSERT (width
!= 0 && height
!= 0 && depth
!= 0);
90 We must only create depths that are supported by the friend drawable
91 Currently we only support the default depth
94 width
= (width
+ 15) & ~15;
96 data
->height
= height
;
103 data
->bytesperpix
= multi
;
105 data
->data
= &XSD(cl
)->data
;
106 data
->mouse
= &XSD(cl
)->mouse
;
108 /* We should be able to get modeID from the bitmap */
109 OOP_GetAttr(o
, aHidd_BitMap_ModeID
, &modeid
);
110 if (modeid
== vHidd_ModeID_Invalid
)
112 OOP_MethodID disp_mid
= OOP_GetMethodID(IID_Root
, moRoot_Dispose
);
113 OOP_CoerceMethod(cl
, o
, (OOP_Msg
) &disp_mid
);
118 InitSemaphore(&data
->bmsem
);
119 data
->VideoData
= data
->data
->vrambase
;
120 XSD(cl
)->visible
= o
;
121 #if !defined(VMWAREGFX_UPDATEFBONSHOWVP)
122 setModeVMWareSVGA(&XSD(cl
)->data
, XSD(cl
)->prefWidth
, XSD(cl
)->prefHeight
);
124 initDisplayVMWareSVGA(&XSD(cl
)->data
);
127 } /* if created object */
129 D(bug(DEBUGNAME
" %s: returning 0x%p\n", __func__
, o
));
133 /********** Bitmap::Dispose() ***********************************/
135 VOID
MNAME_ROOT(Dispose
)(OOP_Class
*cl
, OOP_Object
*o
, OOP_Msg msg
)
137 D(bug(DEBUGNAME
" %s()\n", __func__
);)
138 OOP_DoSuperMethod(cl
, o
, msg
);
141 /*** init_onbmclass *********************************************************/
143 static int VMWareSVGAOnBM_Init(LIBBASETYPEPTR LIBBASE
)
145 D(bug(DEBUGNAME
" %s()\n", __func__
);)
147 ReturnInt("VMWareSVGAOnBM_Init", ULONG
, OOP_ObtainAttrBases(attrbases
));
150 /*** free_bitmapclass *********************************************************/
152 static int VMWareSVGAOnBM_Expunge(LIBBASETYPEPTR LIBBASE
)
154 D(bug(DEBUGNAME
" %s()\n", __func__
);)
156 OOP_ReleaseAttrBases(attrbases
);
158 ReturnInt("VMWareSVGAOnBM_Expunge", int, TRUE
);
161 ADD2INITLIB(VMWareSVGAOnBM_Init
, 0)
162 ADD2EXPUNGELIB(VMWareSVGAOnBM_Expunge
, 0)