2 Copyright © 1995-2007, 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 *****************************************************************************/
66 struct Layer
* _l
, * lparent
;
68 * all children must have been destroyed before.
70 LockLayers(l
->LayerInfo
);
72 if (l
!= GetFirstFamilyMember(l
))
74 bug("[Layers] DeleteLayer: There are still children around! Cannot destroy layer %p\n",l
);
75 UnlockLayers(l
->LayerInfo
);
84 SetRegion(l
->VisibleRegion
, &r
);
89 * Visit all layers behind this layer until my parent comes
90 * I also visit my parent. If my parent is invisible I must
91 * go further to the parent of that parent etc.
95 if (IS_VISIBLE(_l
) && DO_OVERLAP(&r
.bounds
, &_l
->shape
->bounds
))
97 ClearRegion(_l
->VisibleRegion
);
98 _ShowPartsOfLayer(_l
, &r
, LayersBase
);
101 SetRegion(&r
,_l
->VisibleRegion
);
103 if (IS_VISIBLE(_l
) || IS_ROOTLAYER(_l
))
104 AndRegionRegion(_l
->VisibleRegion
, l
->shape
);
108 if (IS_VISIBLE(_l
) || (NULL
== lparent
->parent
))
111 lparent
= lparent
->parent
;
114 * The part that this layer is hiding I cannot make
115 * visible on the layers behind it. Therefore I
116 * have to take it out.
119 ClearRegionRegion(_l
->visibleshape
, &r
);
126 if (!IS_EMPTYREGION(l
->shape
))
128 D(bug("[Layers] DeleteLayer: lparent: %p, l->parent: %p\n",lparent
,l
->parent
));
129 if (lparent
&& IS_ROOTLAYER(lparent
))
130 _BackFillRegion(lparent
, l
->shape
, FALSE
, LayersBase
);
133 D(bug("[Layers] DeleteLayer: NOTHING TO CLEAR!\n"));
138 * Take the layer out of the list
141 l
->front
->back
= l
->back
;
143 l
->LayerInfo
->top_layer
= l
->back
;
146 l
->back
->front
= l
->front
;
148 UnlockLayers(l
->LayerInfo
);
150 _FreeLayer(l
, LayersBase
);