2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
6 #ifndef GRAPHICS_HIDD_INTERN_H
7 #define GRAPHICS_HIDD_INTERN_H
11 #ifndef EXEC_LIBRARIES_H
12 # include <exec/libraries.h>
14 #ifndef EXEC_SEMAPHORES_H
15 # include <exec/semaphores.h>
20 #ifndef HIDD_GRAPHICS_H
21 # include <hidd/graphics.h>
26 #define USE_FAST_PUTPIXEL 1
27 #define OPTIMIZE_DRAWPIXEL_FOR_COPY 1
28 #define USE_FAST_DRAWPIXEL 1
29 #define USE_FAST_GETPIXEL 1
30 #define COPYBOX_CHECK_FOR_ALIKE_PIXFMT 1
32 #define HBM(x) ((struct HIDDBitMapData *)x)
34 #define PUTPIXEL(o, msg) \
35 HBM(o)->putpixel(OOP_OCLASS(o), o, msg)
37 #define GETPIXEL(o, msg) \
38 HBM(o)->getpixel(OOP_OCLASS(o), o, msg)
40 #define DRAWPIXEL(o, msg) \
41 HBM(o)->drawpixel(OOP_OCLASS(o), o, msg)
43 #define GOT_PF_ATTR(code) GOT_ATTR(code, aoHidd_PixFmt, pixfmt)
44 #define FOUND_PF_ATTR(code) FOUND_ATTR(code, aoHidd_PixFmt, pixfmt);
46 #define GOT_SYNC_ATTR(code) GOT_ATTR(code, aoHidd_Sync, sync)
47 #define FOUND_SYNC_ATTR(code) FOUND_ATTR(code, aoHidd_Sync, sync);
49 #define GOT_BM_ATTR(code) GOT_ATTR(code, aoHidd_BitMap, bitmap)
50 #define FOUND_BM_ATTR(code) FOUND_ATTR(code, aoHidd_BitMap, bitmap);
52 #define SWAPBYTES_WORD(x) ((((x) >> 8) & 0x00FF) | (((x) & 0x00FF) << 8))
82 ULONG pixtime
; /* pixel time in pico seconds */
94 UBYTE description
[32];
98 /* This is the pixfmts DB. */
100 #warning Find a way to optimize searching in the pixfmt database
102 /* Organize the pf db in some other way that makes it quicker to find a certain PF */
110 /* This is used as an alias for both pfnode and ModeNode */
123 /* Array of all available gfxmode PixFmts that are part of
126 struct SignalSemaphore sema
;
127 OOP_Object
**pixfmts
;
128 /* Number of pixfmts in the above array */
131 /* All the sync times that are part of any gfxmode */
133 /* Number of syncs in the above array */
136 /* A bitmap of size (num_pixfmts * num_syncs), that tells if the
137 mode is displayable or not. If a particular (x, y) coordinate
138 of the bitmap is 1, it means that the pixfmt and sync objects
139 you get by indexing pixfmts[x] and syncs[y] are a valid mode.
140 If not, the mode is considered invalid
143 struct mode_bm orig_mode_bm
; /* Original as supplied by subclass */
144 struct mode_bm checked_mode_bm
; /* After applying monitor refresh rate checks etc. */
148 struct HIDDGraphicsData
150 /* Gfx mode "database" */
155 Pixel format "database". This is a list
156 of all pixelformats currently used bu some bitmap.
157 The point of having this as a central db in the gfx hidd is
158 that if several bitmaps are of the same pixel format
159 they may point to the same PixFmt object instead
160 of allocating their own instance. Thus we are saving mem
162 struct SignalSemaphore pfsema
;
163 struct MinList pflist
;
166 /* Software cursor stuff */
171 OOP_Object
*curs_backup
;
173 OOP_Object
*framebuffer
;
177 /* gc used for stuff like rendering cursor */
180 /* The mode currently used */
181 HIDDT_ModeID curmode
;
184 /* Private gfxhidd methods */
186 moHidd_Gfx_RegisterPixFmt
= num_Hidd_Gfx_Methods
,
187 moHidd_Gfx_ReleasePixFmt
190 struct pHidd_Gfx_RegisterPixFmt
{
192 struct TagItem
*pixFmtTags
;
196 struct pHidd_Gfx_ReleasePixFmt
{
202 OOP_Object
*HIDD_Gfx_RegisterPixFmt(OOP_Object
*o
, struct TagItem
*pixFmtTags
);
203 VOID
HIDD_Gfx_ReleasePixFmt(OOP_Object
*o
, OOP_Object
*pixFmt
);
205 /* Private bitmap methods */
207 moHidd_BitMap_SetBitMapTags
= num_Hidd_BitMap_Methods
210 struct pHidd_BitMap_SetBitMapTags
{
212 struct TagItem
*bitMapTags
;
215 BOOL
HIDD_BitMap_SetBitMapTags(OOP_Object
*o
, struct TagItem
*bitMapTags
);
218 struct HIDDBitMapData
220 struct _hidd_bitmap_protected prot
;
222 ULONG width
; /* width of the bitmap in pixel */
223 ULONG height
; /* height of the bitmap in pixel */
224 ULONG reqdepth
; /* Depth as requested by user */
225 BOOL displayable
; /* bitmap displayable? */
227 ULONG flags
; /* see hidd/graphic.h 'flags for */
229 ULONG format
; /* planar or chunky */
230 ULONG bytesPerRow
; /* bytes per row */
231 ULONG bytesPerPixel
; /* bytes per pixel */
234 /* WARNING: structure could be extented in the future */
236 OOP_Object
*friend; /* Friend bitmap */
245 /* Optimize these two method calls */
246 #if USE_FAST_PUTPIXEL
247 IPTR (*putpixel
)(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_PutPixel
*msg
);
249 #if USE_FAST_GETPIXEL
250 IPTR (*getpixel
)(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_GetPixel
*msg
);
253 #if USE_FAST_DRAWPIXEL
254 IPTR (*drawpixel
)(OOP_Class
*cl
, OOP_Object
*o
, struct pHidd_BitMap_DrawPixel
*msg
);
261 /* Private bitmap attrs */
264 aoHidd_BitMap_Dummy
= num_Hidd_BitMap_Attrs
,
266 num_Total_BitMap_Attrs
276 APTR bitMap
; /* bitmap to which this gc is connected */
278 APTR userData
; /* pointer to own data */
279 ULONG fg
; /* foreground color */
280 ULONG bg
; /* background color */
281 ULONG drMode
; /* drawmode */
282 /* WARNING: type of font could be change */
283 APTR font
; /* current fonts */
284 ULONG colMask
; /* ColorMask prevents some color bits from changing */
285 UWORD linePat
; /* LinePattern */
286 APTR planeMask
; /* Pointer to a shape bitMap */
289 /* WARNING: structure could be extented in the future */
294 struct class_static_data
296 struct Library
* utilitybase
;
298 OOP_AttrBase hiddPixFmtAttrBase
;
299 OOP_AttrBase hiddBitMapAttrBase
;
300 OOP_AttrBase hiddGfxAttrBase
;
301 OOP_AttrBase hiddSyncAttrBase
;
302 OOP_AttrBase hiddGCAttrBase
;
303 OOP_AttrBase hiddColorMapAttrBase
;
304 OOP_AttrBase hiddPlanarBMAttrBase
;
306 OOP_Class
*gfxhiddclass
; /* graphics hidd class */
307 OOP_Class
*bitmapclass
; /* bitmap class */
308 OOP_Class
*gcclass
; /* graphics context class */
309 OOP_Class
*colormapclass
; /* colormap class */
311 OOP_Class
*pixfmtclass
; /* descring bitmap pixel formats */
312 OOP_Class
*syncclass
; /* describing gfxmode sync times */
315 OOP_Class
*planarbmclass
;
316 OOP_Class
*chunkybmclass
;
318 OOP_Object
*std_pixfmts
[num_Hidd_StdPixFmt
];
320 /* Thes calls are optimized by calling the method functions directly */
321 #if USE_FAST_PUTPIXEL
322 OOP_MethodID putpixel_mid
;
324 #if USE_FAST_GETPIXEL
325 OOP_MethodID getpixel_mid
;
327 #if USE_FAST_DRAWPIXEL
328 OOP_MethodID drawpixel_mid
;
330 HIDDT_RGBConversionFunction rgbconvertfuncs
[NUM_RGB_STDPIXFMT
][NUM_RGB_STDPIXFMT
];
331 struct SignalSemaphore rgbconvertfuncs_sem
;
334 #define __IHidd_PixFmt (csd->hiddPixFmtAttrBase)
335 #define __IHidd_BitMap (csd->hiddBitMapAttrBase)
336 #define __IHidd_Gfx (csd->hiddGfxAttrBase)
337 #define __IHidd_Sync (csd->hiddSyncAttrBase)
338 #define __IHidd_GC (csd->hiddGCAttrBase)
339 #define __IHidd_ColorMap (csd->hiddColorMapAttrBase)
340 #define __IHidd_PlanarBM (csd->hiddPlanarBMAttrBase)
344 struct IntHIDDGraphicsBase
346 struct Library hdg_LibNode
;
348 struct class_static_data hdg_csd
;
352 /* pre declarations */
354 inline HIDDT_Pixel
int_map_truecolor(HIDDT_Color
*color
, HIDDT_PixelFormat
*pf
);
355 BOOL
parse_pixfmt_tags(struct TagItem
*tags
, HIDDT_PixelFormat
*pf
, ULONG attrcheck
, struct class_static_data
*csd
);
356 BOOL
parse_sync_tags(struct TagItem
*tags
, struct sync_data
*data
, ULONG attrcheck
, struct class_static_data
*csd
);
359 #define CSD(x) (&((struct IntHIDDGraphicsBase *)x->UserData)->hdg_csd)
362 #endif /* GRAPHICS_HIDD_INTERN_H */