gcc-4.6.2: Update with patch for gengtype.c
[AROS.git] / rom / graphics / orrectregionnd.c
blob562300aa68ae99b7199f737d170eb355938c92cf
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function AndRectRegion()
6 Lang: english
7 */
9 #include "graphics_intern.h"
10 #include <graphics/regions.h>
11 #include <proto/exec.h>
12 #include <clib/macros.h>
13 #include "intregions.h"
15 /*****************************************************************************
17 NAME */
18 #include <proto/graphics.h>
20 AROS_LH2(struct Region *, OrRectRegionND,
22 /* SYNOPSIS */
23 AROS_LHA(struct Region *, Reg, A0),
24 AROS_LHA(struct Rectangle *, Rect, A1),
26 /* LOCATION */
27 struct GfxBase *, GfxBase, 188, Graphics)
29 /* FUNCTION
30 Add the given Rectangle to the given Region (if not
31 already there)
33 INPUTS
34 region - pointer to Region structure
35 rectangle - pointer to Rectangle structure
37 RESULT
38 The resulting region or NULL in case there's no enough free memory
40 NOTES
42 BUGS
44 SEE ALSO
45 AndRegionRegion(), OrRectRegion(), XorRectRegion(), ClearRectRegion()
46 NewRegion()
48 INTERNALS
50 HISTORY
51 27-11-96 digulla automatically created from
52 graphics_lib.fd and clib/graphics_protos.h
53 16-01-97 mreckt initial version
55 *****************************************************************************/
57 AROS_LIBFUNC_INIT
59 struct Region *Res = NewRegion();
61 if (Res)
63 if (IS_RECT_EVIL(Rect))
65 /* Source Rect is empty. Make a plain copy of Reg. */
66 if (_CopyRegionRectangles(Reg, Res, GfxBase))
67 return Res;
69 else
71 struct RegionRectangle rr;
73 rr.bounds = *Rect;
74 rr.Next = NULL;
75 rr.Prev = NULL;
77 if (_DoOperationBandBand(_OrBandBand,
78 MinX(Reg), 0, MinY(Reg), 0,
79 Reg->RegionRectangle, &rr, &Res->RegionRectangle, &Res->bounds, GfxBase))
81 _TranslateRegionRectangles(Res->RegionRectangle, -MinX(Res), -MinY(Res));
83 return Res;
87 DisposeRegion(Res);
90 return NULL;
92 AROS_LIBFUNC_EXIT
93 } /* AndRectRegion */