gcc-4.6.2: Update with patch for gengtype.c
[AROS.git] / rom / hyperlayers / islayerhiddenbysibling.c
blobd1bf08d849b0f0df40683a775bd2a4edade60b92
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #include <proto/exec.h>
10 #include <exec/types.h>
11 #include <aros/libcall.h>
12 #include <proto/graphics.h>
14 #include "layers_intern.h"
15 #include "basicfuncs.h"
17 /*****************************************************************************
19 NAME */
20 #include <proto/layers.h>
21 AROS_LH2(BOOL, IsLayerHiddenBySibling,
23 /* SYNOPSIS */
24 AROS_LHA(struct Layer *, l , A0),
25 AROS_LHA(BOOL , check_invisible, D0),
27 /* LOCATION */
28 struct LayersBase *, LayersBase, 44, Layers)
30 /* FUNCTION
31 Checks whether this layer is hidden by any siblings
32 that are in front of it. All these siblings must have
33 the same priority as that layer.
34 It can be specified whether invisible siblings are to be
35 considered in the comparison.
37 INPUTS
38 L - pointer to layer
39 check_invisible - whether invisible siblings are to be considered
41 RESULT
42 TRUE - layer is hidden by one or more siblings
43 FALSE - layer is fully visible
45 NOTES
47 EXAMPLE
49 BUGS
51 SEE ALSO
53 INTERNALS
55 HISTORY
57 *****************************************************************************/
59 AROS_LIBFUNC_INIT
61 struct Layer * _l;
62 struct Region * r;
63 BOOL result = FALSE;
65 if (NULL == l ||
66 NULL == (r = NewRegion()))
67 return FALSE;
69 LockLayers(l->LayerInfo);
71 _l = l->front;
73 while (NULL != _l) {
75 * If they differ in priority then return FALSE.
77 if (_l->priority != l->priority) {
78 break;
82 * Only need to check with those layers that
83 * have the same nesting count (are immediate
84 * siblings to the layer l).
86 if (l->nesting == _l->nesting &&
87 ( IS_VISIBLE(_l) || TRUE == check_invisible) &&
88 TRUE == overlap(_l->visibleshape->bounds, l->visibleshape->bounds))
90 /* The layers overlap if an AND operation on
91 * both layers' visible region does not
92 * leave an empty region.
94 SetRegion(l->visibleshape,r);
95 AndRegionRegion(_l->visibleshape,r);
96 if (NULL != r->RegionRectangle) {
97 result = TRUE;
98 break;
101 _l = _l->front;
104 UnlockLayers(l->LayerInfo);
106 DisposeRegion(r);
108 return result;
110 AROS_LIBFUNC_EXIT
111 } /* IsLayerHiddenBySibling */