2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
6 #include <aros/debug.h>
7 #include <aros/symbolsets.h>
11 #include "cybergraphics_intern.h"
13 static void ReleaseAttrBases(struct IntCGFXBase
*CyberGfxBase
)
16 OOP_ReleaseAttrBase(IID_Hidd_BitMap
);
18 OOP_ReleaseAttrBase(IID_Hidd_GC
);
20 OOP_ReleaseAttrBase(IID_Hidd_Sync
);
22 OOP_ReleaseAttrBase(IID_Hidd_PixFmt
);
24 OOP_ReleaseAttrBase(IID_Hidd_Gfx
);
27 static int cgfx_init(struct IntCGFXBase
*CyberGfxBase
)
29 EnterFunc(bug("[CGX] cgfx_init()\n"));
31 /* Initialize the semaphore used for the chunky buffer */
32 InitSemaphore(&CyberGfxBase
->pixbuf_sema
);
34 /* Init the needed attrbases */
36 __IHidd_BitMap
= OOP_ObtainAttrBase(IID_Hidd_BitMap
);
37 __IHidd_GC
= OOP_ObtainAttrBase(IID_Hidd_GC
);
38 __IHidd_Sync
= OOP_ObtainAttrBase(IID_Hidd_Sync
);
39 __IHidd_PixFmt
= OOP_ObtainAttrBase(IID_Hidd_PixFmt
);
40 __IHidd_Gfx
= OOP_ObtainAttrBase(IID_Hidd_Gfx
);
42 CyberGfxBase
->basegc
= OOP_FindClass(CLID_Hidd_GC
);
43 CyberGfxBase
->basebm
= OOP_FindClass(CLID_Hidd_BitMap
);
51 CyberGfxBase
->pixel_buf
=AllocMem(PIXELBUF_SIZE
,MEMF_ANY
);
52 if (CyberGfxBase
->pixel_buf
)
56 for (i
= 0; i
< 256; i
++)
58 CyberGfxBase
->greytab
[i
] = i
* 0x010101;
61 ReturnInt("[CGX] cgfx_init", int, TRUE
);
66 ReleaseAttrBases(CyberGfxBase
);
67 ReturnInt("[CGX] cgfx_init", int, FALSE
);
70 static int cgfx_expunge (struct IntCGFXBase
*CyberGfxBase
)
72 FreeMem(CyberGfxBase
->pixel_buf
, PIXELBUF_SIZE
);
73 ReleaseAttrBases(CyberGfxBase
);
78 ADD2INITLIB(cgfx_init
, 0);
79 ADD2EXPUNGELIB(cgfx_expunge
, 0);