layers.library: Install ourselves into graphics.library
[AROS.git] / rom / hyperlayers / layers_init.c
blob80f61f179a05b35f6cd362e14dc5fc44bb85ce9f
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Layers Resident and initialization.
6 Lang: english
7 */
9 #include LC_LIBDEFS_FILE
10 #include <graphics/gfxbase.h>
11 #include <proto/exec.h>
12 #include <aros/symbolsets.h>
14 #include "layers_intern.h"
16 static int LayersInit(LIBBASETYPEPTR LIBBASE)
18 GfxBase = (APTR)OpenLibrary("graphics.library", 41);
19 if (GfxBase == NULL)
20 return FALSE;
22 UtilityBase = (APTR)OpenLibrary("utility.library", 0);
23 if (UtilityBase == NULL) {
24 CloseLibrary((APTR)GfxBase);
25 return FALSE;
28 LIBBASE->lb_ClipRectPool = CreatePool(MEMF_CLEAR|MEMF_PUBLIC|MEMF_SEM_PROTECTED, sizeof(struct ClipRect) * 50, sizeof(struct ClipRect) * 50);
29 if (!LIBBASE->lb_ClipRectPool) {
30 CloseLibrary(UtilityBase);
31 CloseLibrary(GfxBase);
32 return FALSE;
35 /* Install ourself as graphics.library's layer manager */
36 GfxBase->gb_LayersBase = LIBBASE;
38 return TRUE;
41 ADD2INITLIB(LayersInit, 0);