add place-holder directory for the a3000 wd533c93 scsi controller implementation.
[AROS.git] / workbench / hidds / vmwaresvga / vmwaresvga_onbitmapclass.c
blob7e38e71af290a94b6564d8ef25c6030dccab42ad
1 /*
2 Copyright © 1995-2019, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Bitmap class for VMWareSVGA hidd.
6 Lang: English.
7 */
9 #define __OOP_NOATTRBASES__
11 #include <proto/oop.h>
12 #include <proto/utility.h>
13 #include <assert.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>
19 #include <hidd/gfx.h>
20 #include <oop/oop.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 },
41 /* Private bases */
42 { IID_Hidd_VMWareSVGA, &HiddVMWareSVGAAttrBase },
43 { IID_Hidd_VMWareSVGABitMap, &HiddVMWareSVGABitMapAttrBase },
44 { NULL, NULL }
47 #define DEBUGNAME "[VMWareSVGA:OnBitMap]"
48 #define MNAME_ROOT(x) VMWareSVGAOnBM__Root__ ## x
49 #define MNAME_BM(x) VMWareSVGAOnBM__Hidd_BitMap__ ## x
51 #define OnBitmap 1
52 #include "vmwaresvga_bitmap_common.c"
55 include our debug overides after bitmap_common incase it sets its own values...
57 #ifdef DEBUG
58 #undef DEBUG
59 #endif
60 #define DEBUG 0
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);
70 if (o)
72 struct BitmapData *data = OOP_INST_DATA(cl, o);
73 LONG multi=1;
74 OOP_Object *pf;
75 IPTR width, height, depth;
76 HIDDT_ModeID modeid;
78 /* clear all data */
79 memset(data, 0, sizeof(struct BitmapData));
81 /* Get attr values */
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);
89 /*
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;
95 data->width = width;
96 data->height = height;
97 data->bpp = depth;
98 data->disp = -1;
99 if (depth > 16)
100 multi = 4;
101 else if (depth > 8)
102 multi = 2;
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);
114 o = NULL;
116 else
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);
123 #else
124 initDisplayVMWareSVGA(&XSD(cl)->data);
125 #endif
127 } /* if created object */
129 D(bug(DEBUGNAME " %s: returning 0x%p\n", __func__, o));
130 return 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)