add place-holder directory for the a3000 wd533c93 scsi controller implementation.
[AROS.git] / workbench / hidds / vmwaresvga / vmwaresvga_offbitmapclass.c
blobcbdda816e329df477b770cad4e29bf13f98f6ac8
1 /*
2 Copyright © 1995-2019, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Offscreen bitmap class for VMWare 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/alerts.h>
15 #include <exec/lists.h>
16 #include <exec/memory.h>
17 #include <aros/symbolsets.h>
18 #include <graphics/gfx.h>
19 #include <graphics/rastport.h>
20 #include <hidd/gfx.h>
21 #include <oop/oop.h>
23 #include "vmwaresvga_intern.h"
25 #include LC_LIBDEFS_FILE
27 /* Don't initialize them with "= 0", otherwise they end up in the DATA segment! */
29 static OOP_AttrBase HiddBitMapAttrBase;
30 static OOP_AttrBase HiddPixFmtAttrBase;
31 static OOP_AttrBase HiddGfxAttrBase;
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 /* Private bases */
41 {IID_Hidd_VMWareSVGA, &HiddVMWareSVGAAttrBase },
42 {IID_Hidd_VMWareSVGABitMap, &HiddVMWareSVGABitMapAttrBase },
43 {NULL, NULL }
46 #define DEBUGNAME "[VMWareSVGA:OffBitMap]"
47 #define MNAME_ROOT(x) VMWareSVGAOffBM__Root__ ## x
48 #define MNAME_BM(x) VMWareSVGAOffBM__Hidd_BitMap__ ## x
50 #include "vmwaresvga_bitmap_common.c"
53 include our debug overides after bitmap_common incase it sets its own values...
55 #ifdef DEBUG
56 #undef DEBUG
57 #endif
58 #define DEBUG 0
59 #include <aros/debug.h>
61 /*********** BitMap::New() *************************************/
63 OOP_Object *MNAME_ROOT(New)(OOP_Class *cl, OOP_Object *o, struct pRoot_New *msg)
65 D(bug(DEBUGNAME " %s()\n", __func__);)
67 o = (OOP_Object *)OOP_DoSuperMethod(cl, o, (OOP_Msg) msg);
68 if (o)
70 struct BitmapData *data;
71 LONG multi=1;
72 IPTR width, height, depth;
73 OOP_Object *bmfriend, *pf;
75 data = OOP_INST_DATA(cl, o);
77 /* clear all data */
78 memset(data, 0, sizeof(struct BitmapData));
80 /* Get attr values */
81 OOP_GetAttr(o, aHidd_BitMap_Width, &width);
82 OOP_GetAttr(o, aHidd_BitMap_Height, &height);
83 OOP_GetAttr(o, aHidd_BitMap_PixFmt, (IPTR *)&pf);
84 OOP_GetAttr(pf, aHidd_PixFmt_Depth, &depth);
86 /* Get the friend bitmap. This should be a displayable bitmap */
87 OOP_GetAttr(o, aHidd_BitMap_Friend, (IPTR *)&bmfriend);
89 /* If you got a friend bitmap, copy its colormap */
90 if (bmfriend)
92 struct BitmapData *src = OOP_INST_DATA(cl, bmfriend);
93 CopyMem(&src->cmap, &data->cmap, 4*16);
95 ASSERT (width != 0 && height != 0 && depth != 0);
96 width=(width+15) & ~15;
97 data->width = width;
98 data->height = height;
99 data->bpp = depth;
100 data->disp = 0;
101 if (depth>16)
102 multi = 4;
103 else if (depth>8)
104 multi = 2;
105 data->bytesperpix = multi;
107 data->VideoData = AllocVec(width*height*multi, MEMF_PUBLIC | MEMF_CLEAR);
108 if (data->VideoData)
110 InitSemaphore(&data->bmsem);
111 data->data = &XSD(cl)->data;
112 if (XSD(cl)->activecallback)
113 XSD(cl)->activecallback(XSD(cl)->callbackdata, o, TRUE);
114 } /* if got data->VideoData */
115 else
117 OOP_MethodID disp_mid = OOP_GetMethodID(IID_Root, moRoot_Dispose);
118 OOP_CoerceMethod(cl, o, (OOP_Msg) &disp_mid);
119 o = NULL;
121 } /* if created object */
123 D(bug(DEBUGNAME " %s: returning 0x%p\n", __func__, o));
125 return o;
128 /********** Bitmap::Dispose() ***********************************/
130 VOID MNAME_ROOT(Dispose)(OOP_Class *cl, OOP_Object *o, OOP_Msg msg)
132 struct BitmapData *data = OOP_INST_DATA(cl, o);
134 D(bug(DEBUGNAME " %s()\n", __func__);)
136 FreeVec(data->VideoData);
137 OOP_DoSuperMethod(cl, o, msg);
138 ReturnVoid("VMWareSVGA.BitMap::Dispose");
141 /*** init_bmclass *********************************************************/
143 static int VMWareSVGAOffBM_Init(LIBBASETYPEPTR LIBBASE)
145 D(bug(DEBUGNAME " %s()\n", __func__);)
147 ReturnInt("VMWareSVGAOffBM_Init", ULONG, OOP_ObtainAttrBases(attrbases));
150 /*** free_offbitmapclass *********************************************************/
152 static int VMWareSVGAOffBM_Expunge(LIBBASETYPEPTR LIBBASE)
154 D(bug(DEBUGNAME " %s()\n", __func__);)
156 OOP_ReleaseAttrBases(attrbases);
158 ReturnInt("VMWareSVGAOffBM_Expunge", int, TRUE);
161 ADD2INITLIB(VMWareSVGAOffBM_Init, 0)
162 ADD2EXPUNGELIB(VMWareSVGAOffBM_Expunge, 0)