2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
9 #include <aros/libcall.h>
10 #include <exec/types.h>
11 #include <proto/exec.h>
12 #include <proto/graphics.h>
13 #include <graphics/layers.h>
14 #include <graphics/regions.h>
16 #include <aros/debug.h>
17 #include "layers_intern.h"
18 #include "basicfuncs.h"
20 /*****************************************************************************
23 #include <proto/layers.h>
25 AROS_LH2(LONG
, DeleteLayer
,
28 AROS_LHA(LONG
, dummy
, A0
),
29 AROS_LHA(struct Layer
*, l
, A1
),
32 struct LayersBase
*, LayersBase
, 15, Layers
)
35 Deletes the layer. Other layers that were hidden (partially)
36 will become visible. If parts of a simple layer become
37 visible those parts are added to the damagelist of the
38 layer and the LAYERREFRESH flags is set.
41 dummy - nothing special
42 LD - layer to be deleted
45 TRUE - layer was successfully deleted
46 FALSE - layer could not be delete (out of memory)
59 27-11-96 digulla automatically created from
60 layers_lib.fd and clib/layers_protos.h
62 *****************************************************************************/
65 AROS_LIBBASE_EXT_DECL(struct LayersBase
*,LayersBase
)
67 struct Layer
* _l
, * lparent
;
69 * all children must have been destroyed before.
71 LockLayers(l
->LayerInfo
);
73 if (l
!= GetFirstFamilyMember(l
))
75 bug("[Layers] DeleteLayer: There are still children around! Cannot destroy layer %p\n",l
);
76 UnlockLayers(l
->LayerInfo
);
85 SetRegion(l
->VisibleRegion
, &r
);
90 * Visit all layers behind this layer until my parent comes
91 * I also visit my parent. If my parent is invisible I must
92 * go further to the parent of that parent etc.
96 if (IS_VISIBLE(_l
) && DO_OVERLAP(&r
.bounds
, &_l
->shape
->bounds
))
98 ClearRegion(_l
->VisibleRegion
);
99 _ShowPartsOfLayer(_l
, &r
, LayersBase
);
102 SetRegion(&r
,_l
->VisibleRegion
);
104 if (IS_VISIBLE(_l
) || IS_ROOTLAYER(_l
))
105 AndRegionRegion(_l
->VisibleRegion
, l
->shape
);
109 if (IS_VISIBLE(_l
) || (NULL
== lparent
->parent
))
112 lparent
= lparent
->parent
;
115 * The part that this layer is hiding I cannot make
116 * visible on the layers behind it. Therefore I
117 * have to take it out.
120 ClearRegionRegion(_l
->visibleshape
, &r
);
127 if (!IS_EMPTYREGION(l
->shape
))
129 D(bug("[Layers] DeleteLayer: lparent: %p, l->parent: %p\n",lparent
,l
->parent
));
130 if (lparent
&& IS_ROOTLAYER(lparent
))
131 _BackFillRegion(lparent
, l
->shape
, FALSE
, LayersBase
);
134 D(bug("[Layers] DeleteLayer: NOTHING TO CLEAR!\n"));
139 * Take the layer out of the list
142 l
->front
->back
= l
->back
;
144 l
->LayerInfo
->top_layer
= l
->back
;
147 l
->back
->front
= l
->front
;
149 UnlockLayers(l
->LayerInfo
);
151 _FreeLayer(l
, LayersBase
);