adapt to gfx.hidd api changes.
[AROS.git] / workbench / libs / cgfx / cybergraphics_intern.h
blobb358b0a3f6cf184ee754d5791da60f9f94a0f966
1 /*
2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #ifndef CYBERGRAPHICS_INTERN_H
7 #define CYBERGRAPHICS_INTERN_H
9 #ifndef EXEC_LIBRARIES_H
10 # include <exec/libraries.h>
11 #endif
13 #ifndef EXEC_LISTS_H
14 # include <exec/lists.h>
15 #endif
17 #ifndef DOS_BPTR_H
18 # include <dos/bptr.h>
19 #endif
21 #ifndef AROS_LIBCALL_H
22 # include <aros/libcall.h>
23 #endif
25 #ifndef GRAPHICS_RASTPORT_H
26 # include <graphics/rastport.h>
27 #endif
29 #ifndef UTILITY_TAGITEM_H
30 # include <utility/tagitem.h>
31 #endif
33 #ifndef GRAPHICS_VIEW_H
34 # include <graphics/view.h>
35 #endif
37 #ifndef PROTO_GRAPHICS_H
38 # include <proto/graphics.h>
39 #endif
41 #include <oop/oop.h>
43 struct IntCGFXBase
45 struct Library libnode;
47 struct SignalSemaphore pixbuf_sema;
48 ULONG *pixel_buf;
50 OOP_AttrBase hiddBitMapAttrBase;
51 OOP_AttrBase hiddGCAttrBase;
52 OOP_AttrBase hiddSyncAttrBase;
53 OOP_AttrBase hiddPixFmtAttrBase;
54 OOP_AttrBase hiddGfxAttrBase;
56 /* baseclasses for CreateObject */
57 OOP_Class *basegc;
58 OOP_Class *basebm;
60 /* Grayscale palette for RECTFMT_GREY8 */
61 ULONG greytab[256];
64 #define GetCGFXBase(base) ((struct IntCGFXBase *)base)
66 #define __IHidd_BitMap GetCGFXBase(CyberGfxBase)->hiddBitMapAttrBase
67 #define __IHidd_GC GetCGFXBase(CyberGfxBase)->hiddGCAttrBase
68 #define __IHidd_Sync GetCGFXBase(CyberGfxBase)->hiddSyncAttrBase
69 #define __IHidd_PixFmt GetCGFXBase(CyberGfxBase)->hiddPixFmtAttrBase
70 #define __IHidd_Gfx GetCGFXBase(CyberGfxBase)->hiddGfxAttrBase
72 /* Pixelbuffer, the same as in graphics.library */
73 #ifdef __mc68000
74 #define NUMPIX 4096 /* Not that much room to spare */
75 #else
76 #define NUMPIX 100000
77 #endif
79 #define PIXELBUF_SIZE (NUMPIX * 4)
81 #define LOCK_PIXBUF ObtainSemaphore(&CyberGfxBase->pixbuf_sema);
82 #define ULOCK_PIXBUF ReleaseSemaphore(&CyberGfxBase->pixbuf_sema);
84 /* Bitmap processing */
86 #define XCOORD_TO_BYTEIDX( x ) (( x ) >> 3)
88 #define COORD_TO_BYTEIDX(x, y, bytes_per_row) \
89 ( ( ((LONG)(y)) * (bytes_per_row)) + XCOORD_TO_BYTEIDX(x))
91 #define CHUNKY8_COORD_TO_BYTEIDX(x, y, bytes_per_row) \
92 ( ( ((LONG)(y)) * (bytes_per_row)) + (x) )
94 #define XCOORD_TO_MASK(x) (128L >> ((x) & 0x07))
96 #endif /* CYBERGRAPHICS_INTERN_H */