1 #include <aros/debug.h>
2 #include <aros/symbolsets.h>
3 #include <hidd/graphics.h>
6 #include "cybergraphics_intern.h"
8 static void ReleaseAttrBases(struct IntCGFXBase
*CyberGfxBase
)
11 OOP_ReleaseAttrBase(IID_Hidd_BitMap
);
13 OOP_ReleaseAttrBase(IID_Hidd_GC
);
15 OOP_ReleaseAttrBase(IID_Hidd_Sync
);
17 OOP_ReleaseAttrBase(IID_Hidd_PixFmt
);
19 OOP_ReleaseAttrBase(IID_Hidd_Gfx
);
22 static int cgfx_init(struct IntCGFXBase
*CyberGfxBase
)
24 EnterFunc(bug("[CGX] cgfx_init()\n"));
26 /* Initialize the semaphore used for the chunky buffer */
27 InitSemaphore(&CyberGfxBase
->pixbuf_sema
);
29 /* Init the needed attrbases */
31 __IHidd_BitMap
= OOP_ObtainAttrBase(IID_Hidd_BitMap
);
32 __IHidd_GC
= OOP_ObtainAttrBase(IID_Hidd_GC
);
33 __IHidd_Sync
= OOP_ObtainAttrBase(IID_Hidd_Sync
);
34 __IHidd_PixFmt
= OOP_ObtainAttrBase(IID_Hidd_PixFmt
);
35 __IHidd_Gfx
= OOP_ObtainAttrBase(IID_Hidd_Gfx
);
37 CyberGfxBase
->basegc
= OOP_FindClass(CLID_Hidd_GC
);
38 CyberGfxBase
->basebm
= OOP_FindClass(CLID_Hidd_BitMap
);
46 CyberGfxBase
->pixel_buf
=AllocMem(PIXELBUF_SIZE
,MEMF_ANY
);
47 if (CyberGfxBase
->pixel_buf
)
51 for (i
= 0; i
< 256; i
++)
53 CyberGfxBase
->greytab
[i
] = i
* 0x010101;
56 ReturnInt("[CGX] cgfx_init", int, TRUE
);
61 ReleaseAttrBases(CyberGfxBase
);
62 ReturnInt("[CGX] cgfx_init", int, FALSE
);
65 static int cgfx_expunge (struct IntCGFXBase
*CyberGfxBase
)
67 FreeMem(CyberGfxBase
->pixel_buf
, PIXELBUF_SIZE
);
68 ReleaseAttrBases(CyberGfxBase
);
73 ADD2INITLIB(cgfx_init
, 0);
74 ADD2EXPUNGELIB(cgfx_expunge
, 0);