2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: Graphics function AndRegionRegion()
9 #include <graphics/regions.h>
11 #include "graphics_intern.h"
12 #include "intregions.h"
14 /*****************************************************************************
17 #include <proto/graphics.h>
19 AROS_LH2(struct Region
*, ClearRegionRegionND
,
22 AROS_LHA(struct Region
*, R1
, A0
),
23 AROS_LHA(struct Region
*, R2
, A1
),
26 struct GfxBase
*, GfxBase
, 193, Graphics
)
29 Clear the given Region region1 from the given Region region2.
32 region1 - pointer to a region structure
33 region2 - pointer to a region structure
36 The resulting region or NULL in case there's no enough free memory
45 XorRegionRegion(), OrRegionRegion()
51 *****************************************************************************/
55 struct Region
*R3
= NewRegion();
59 /* Out of memory, failed */
63 if (!R2
->RegionRectangle
)
65 /* R2 is already empty, nothing to clear */
69 if (!R1
->RegionRectangle
||
70 !overlap(R1
->bounds
, R2
->bounds
))
72 /* R2 is not empty, but there's nothing to clear. Make a plain copy. */
73 if (_CopyRegionRectangles(R2
, R3
, GfxBase
))
78 /* Some other case, do the complete algorighm */
79 if (_DoOperationBandBand(_ClearBandBand
,
80 MinX(R1
), MinX(R2
), MinY(R1
), MinY(R2
),
81 R1
->RegionRectangle
, R2
->RegionRectangle
, &R3
->RegionRectangle
, &R3
->bounds
, GfxBase
))
83 _TranslateRegionRectangles(R3
->RegionRectangle
, -MinX(R3
), -MinY(R3
));