2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
5 Desc: Bitmap class for VMWareSVGA hidd.
10 #include <aros/debug.h>
12 #define __OOP_NOATTRBASES__
14 #include <proto/oop.h>
15 #include <proto/utility.h>
17 #include <exec/memory.h>
18 #include <exec/lists.h>
19 #include <aros/symbolsets.h>
20 #include <graphics/rastport.h>
21 #include <graphics/gfx.h>
22 #include <hidd/graphics.h>
25 #include "vmwaresvgabitmap.h"
26 #include "vmwaresvgaclass.h"
28 #include LC_LIBDEFS_FILE
30 /* Don't initialize static variables with "=0", otherwise they go into DATA segment */
32 static OOP_AttrBase HiddBitMapAttrBase
;
33 static OOP_AttrBase HiddPixFmtAttrBase
;
34 static OOP_AttrBase HiddGfxAttrBase
;
35 static OOP_AttrBase HiddSyncAttrBase
;
36 static OOP_AttrBase HiddVMWareSVGAAttrBase
;
37 static OOP_AttrBase HiddVMWareSVGABitMapAttrBase
;
39 static struct OOP_ABDescr attrbases
[] =
41 { IID_Hidd_BitMap
, &HiddBitMapAttrBase
},
42 { IID_Hidd_PixFmt
, &HiddPixFmtAttrBase
},
43 { IID_Hidd_Gfx
, &HiddGfxAttrBase
},
44 { IID_Hidd_Sync
, &HiddSyncAttrBase
},
46 { IID_Hidd_VMWareSVGA
, &HiddVMWareSVGAAttrBase
},
47 { IID_Hidd_VMWareSVGABitMap
, &HiddVMWareSVGABitMapAttrBase
},
51 #define MNAME_ROOT(x) VMWareSVGAOnBM__Root__ ## x
52 #define MNAME_BM(x) VMWareSVGAOnBM__Hidd_BitMap__ ## x
55 #include "vmwaresvgabitmap_common.c"
57 /*********** BitMap::New() *************************************/
59 OOP_Object
*MNAME_ROOT(New
)(OOP_Class
*cl
, OOP_Object
*o
, struct pRoot_New
*msg
)
61 EnterFunc(bug("VMWareSVGA.BitMap::New()\n"));
62 o
= (OOP_Object
*)OOP_DoSuperMethod(cl
, o
, (OOP_Msg
) msg
);
65 struct BitmapData
*data
;
68 IPTR width
, height
, depth
;
71 data
= OOP_INST_DATA(cl
, o
);
73 memset(data
, 0, sizeof(struct BitmapData
));
75 OOP_GetAttr(o
, aHidd_BitMap_Width
, &width
);
76 OOP_GetAttr(o
, aHidd_BitMap_Height
, &height
);
77 OOP_GetAttr(o
, aHidd_BitMap_PixFmt
, (IPTR
*)&pf
);
78 OOP_GetAttr(pf
, aHidd_PixFmt_Depth
, &depth
);
79 ASSERT (width
!= 0 && height
!= 0 && depth
!= 0);
81 We must only create depths that are supported by the friend drawable
82 Currently we only support the default depth
85 width
=(width
+15) & ~15;
87 data
->height
= height
;
94 data
->bytesperpix
= multi
;
95 data
->data
= &XSD(cl
)->data
;
96 data
->mouse
= &XSD(cl
)->mouse
;
97 data
->VideoData
= data
->data
->vrambase
;
98 /* We should be able to get modeID from the bitmap */
99 OOP_GetAttr(o
, aHidd_BitMap_ModeID
, &modeid
);
100 if (modeid
!= vHidd_ModeID_Invalid
)
103 Because of not defined BitMap_Show method show
106 setModeVMWareSVGA(&XSD(cl
)->data
, width
, height
);
107 XSD(cl
)->visible
= data
; /* Set created object as visible */
108 ReturnPtr("VMWareSVGA.BitMap::New()", OOP_Object
*, o
);
111 OOP_MethodID disp_mid
= OOP_GetMethodID(IID_Root
, moRoot_Dispose
);
112 OOP_CoerceMethod(cl
, o
, (OOP_Msg
) &disp_mid
);
115 } /* if created object */
116 ReturnPtr("VMWareSVGA.BitMap::New()", OOP_Object
*, o
);
119 /********** Bitmap::Dispose() ***********************************/
121 VOID
MNAME_ROOT(Dispose
)(OOP_Class
*cl
, OOP_Object
*o
, OOP_Msg msg
)
123 EnterFunc(bug("VMWareSVGA.BitMap::Dispose()\n"));
124 OOP_DoSuperMethod(cl
, o
, msg
);
125 ReturnVoid("VMWareSVGA.BitMap::Dispose");
128 /*** init_onbmclass *********************************************************/
130 static int VMWareSVGAOnBM_Init(LIBBASETYPEPTR LIBBASE
)
132 EnterFunc(bug("VMWareSVGAOnBM_Init\n"));
134 ReturnInt("VMWareSVGAOnBM_Init", ULONG
, OOP_ObtainAttrBases(attrbases
));
137 /*** free_bitmapclass *********************************************************/
139 static int VMWareSVGAOnBM_Expunge(LIBBASETYPEPTR LIBBASE
)
141 EnterFunc(bug("VMWareSVGAOnBM_Expunge\n"));
143 OOP_ReleaseAttrBases(attrbases
);
145 ReturnInt("VMWareSVGAOnBM_Expunge", int, TRUE
);
148 ADD2INITLIB(VMWareSVGAOnBM_Init
, 0)
149 ADD2EXPUNGELIB(VMWareSVGAOnBM_Expunge
, 0)