refactored some code. compiles now without suppresing any warning with gcc-6.3.0.
[AROS.git] / rom / graphics / xorrectregionnd.c
blob6394a3422ce8364c8482770ab961ea1f7816fee2
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #include <graphics/regions.h>
11 #include "graphics_intern.h"
12 #include "intregions.h"
14 /*****************************************************************************
16 NAME */
17 #include <proto/graphics.h>
19 AROS_LH2(struct Region *, XorRectRegionND,
21 /* SYNOPSIS */
22 AROS_LHA(struct Region *, Reg, A0),
23 AROS_LHA(struct Rectangle *, Rect, A1),
25 /* LOCATION */
26 struct GfxBase *, GfxBase, 190, Graphics)
28 /* FUNCTION
29 Exclusive-OR the given rectangle to the given
30 region
32 INPUTS
33 region - pointer to a region structure
34 rectangle - pointer to a rectangle structure
36 RESULT
37 The resulting region or NULL in case there's no enough free memory
39 NOTES
40 All relevant data is copied, you may throw away the
41 given rectangle after calling this function
43 EXAMPLE
45 BUGS
47 SEE ALSO
48 AndRectRegion(), OrRectRegion(), ClearRectRegion()
50 INTERNALS
52 HISTORY
53 27-11-96 digulla automatically created from
54 graphics_lib.fd and clib/graphics_protos.h
55 19-01-97 mreckt intital version
57 *****************************************************************************/
59 AROS_LIBFUNC_INIT
61 struct Region R;
62 struct RegionRectangle rr;
64 if (IS_RECT_EVIL(Rect))
66 /* Empty rectangle. Just make a plain copy of Reg. */
67 struct Region *ret = NewRegion();
69 if (_CopyRegionRectangles(Reg, ret, GfxBase))
70 return ret;
72 DisposeRegion(ret);
73 return NULL;
76 InitRegion(&R);
78 R.bounds = *Rect;
79 R.RegionRectangle = &rr;
81 rr.Next = NULL;
82 MinX(&rr) = MinY(&rr) = 0;
83 MaxX(&rr) = Rect->MaxX - Rect->MinX;
84 MaxY(&rr) = Rect->MaxY - Rect->MinY;
86 return XorRegionRegionND(&R, Reg);
88 AROS_LIBFUNC_EXIT
89 } /* XorRectRegion */