Minor fixes to comments.
[AROS.git] / rom / graphics / xorregionregion.c
blob56dd93d0155839f01b8cb6d561cfee94c317d8ac
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function XorRegionRegion()
6 Lang: english
7 */
8 #include "graphics_intern.h"
9 #include <graphics/regions.h>
10 #include "intregions.h"
12 /*****************************************************************************
14 NAME */
15 #include <proto/graphics.h>
17 AROS_LH2(BOOL, XorRegionRegion,
19 /* SYNOPSIS */
20 AROS_LHA(struct Region *, R1, A0),
21 AROS_LHA(struct Region *, R2, A1),
23 /* LOCATION */
24 struct GfxBase *, GfxBase, 103, Graphics)
26 /* FUNCTION
27 Exclusive-OR of one region with another region,
28 leaving result in second region.
30 INPUTS
31 region1 - pointer to a region structure
32 region2 - pointer to a region structure
34 RESULT
35 TRUE if the operation was successful,
36 FALSE otherwise (out of memory)
38 NOTES
41 EXAMPLE
43 BUGS
45 SEE ALSO
46 AndRegionRegion(), OrRegionRegion()
48 INTERNALS
50 HISTORY
51 27-11-96 digulla automatically created from
52 graphics_lib.fd and clib/graphics_protos.h
53 19-01-97 mreckt intital version
55 22-09-2001 falemagn changed implementation
57 *****************************************************************************/
59 AROS_LIBFUNC_INIT
61 struct Region R3;
62 struct RegionRectangle *Diff1 = NULL, *Diff2 = NULL;
64 LONG res;
68 !R1->RegionRectangle ||
69 !R2->RegionRectangle ||
70 !overlap(R1->bounds, R2->bounds)
73 return OrRegionRegion(R1, R2);
76 InitRegion(&R3);
78 res = _DoOperationBandBand
80 _ClearBandBand,
81 MinX(R1),
82 MinX(R2),
83 MinY(R1),
84 MinY(R2),
85 R1->RegionRectangle,
86 R2->RegionRectangle,
87 &Diff1,
88 &R3.bounds,
89 GfxBase
90 ) &&
91 _DoOperationBandBand
93 _ClearBandBand,
94 MinX(R2),
95 MinX(R1),
96 MinY(R2),
97 MinY(R1),
98 R2->RegionRectangle,
99 R1->RegionRectangle,
100 &Diff2,
101 &R3.bounds,
102 GfxBase
103 ) &&
104 _DoOperationBandBand
106 _OrBandBand,
111 Diff1,
112 Diff2,
113 &R3.RegionRectangle,
114 &R3.bounds,
115 GfxBase
118 _DisposeRegionRectangleList(Diff1, GfxBase);
119 _DisposeRegionRectangleList(Diff2, GfxBase);
121 if (res)
123 ClearRegion(R2);
125 *R2 = R3;
127 _TranslateRegionRectangles(R3.RegionRectangle, -MinX(&R3), -MinY(&R3));
130 return res;
132 AROS_LIBFUNC_EXIT