Minor fixes to comments.
[AROS.git] / rom / graphics / xorregionregionnd.c
blobd6fa174b0c7c98f1e01ae1dce8111df0bd00b8fd
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #include "graphics_intern.h"
10 #include <graphics/regions.h>
11 #include "intregions.h"
13 /*****************************************************************************
15 NAME */
16 #include <proto/graphics.h>
18 AROS_LH2(struct Region *, XorRegionRegionND,
20 /* SYNOPSIS */
21 AROS_LHA(struct Region *, R1, A0),
22 AROS_LHA(struct Region *, R2, A1),
24 /* LOCATION */
25 struct GfxBase *, GfxBase, 191, Graphics)
27 /* FUNCTION
28 Exclusive-OR of one region with another region.
30 INPUTS
31 region1 - pointer to a region structure
32 region2 - pointer to a region structure
34 RESULT
35 The resulting region or NULL in case there's no enough free memory
37 NOTES
38 This function is not present in AmigaOS
40 EXAMPLE
42 BUGS
44 SEE ALSO
45 AndRegionRegion(), OrRegionRegion()
47 INTERNALS
49 HISTORY
50 27-11-96 digulla automatically created from
51 graphics_lib.fd and clib/graphics_protos.h
52 19-01-97 mreckt intital version
54 22-09-2001 falemagn changed implementation
56 *****************************************************************************/
58 AROS_LIBFUNC_INIT
60 struct Region *R3;
64 !R1->RegionRectangle ||
65 !R2->RegionRectangle ||
66 !overlap(R1->bounds, R2->bounds)
69 return OrRegionRegionND(R1, R2);
72 R3 = NewRegion();
74 if (R3)
76 struct RegionRectangle *Diff1 = NULL;
77 struct RegionRectangle *Diff2 = NULL;
79 BOOL res =
80 _DoOperationBandBand
82 _ClearBandBand,
83 MinX(R1),
84 MinX(R2),
85 MinY(R1),
86 MinY(R2),
87 R1->RegionRectangle,
88 R2->RegionRectangle,
89 &Diff1,
90 &R3->bounds,
91 GfxBase
92 ) &&
93 _DoOperationBandBand
95 _ClearBandBand,
96 MinX(R2),
97 MinX(R1),
98 MinY(R2),
99 MinY(R1),
100 R2->RegionRectangle,
101 R1->RegionRectangle,
102 &Diff2,
103 &R3->bounds,
104 GfxBase
105 ) &&
106 _DoOperationBandBand
108 _OrBandBand,
113 Diff1,
114 Diff2,
115 &R3->RegionRectangle,
116 &R3->bounds,
117 GfxBase
120 _DisposeRegionRectangleList(Diff1, GfxBase);
121 _DisposeRegionRectangleList(Diff2, GfxBase);
123 if (res)
125 _TranslateRegionRectangles(R3->RegionRectangle, -MinX(R3), -MinY(R3));
127 else
129 DisposeRegion(R3);
130 R3 = NULL;
134 return R3;
136 AROS_LIBFUNC_EXIT