NListtree.mcc: fix sorted insert
[AROS.git] / rom / graphics / orregionregion.c
blob22d5b8beb330362c21f8e08d94d10ccfc55c70a5
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function OrRegionRegion()
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(BOOL, OrRegionRegion,
21 /* SYNOPSIS */
22 AROS_LHA(struct Region *, R1, A0),
23 AROS_LHA(struct Region *, R2, A1),
25 /* LOCATION */
26 struct GfxBase *, GfxBase, 102, Graphics)
28 /* FUNCTION
29 OR of one region with another region, leaving result in
30 second region.
32 INPUTS
33 region1 - pointer to a region structure
34 region2 - pointer to a region structure
36 RESULT
37 TRUE if the operation was successful, else FALSE
38 (out of memory)
40 NOTES
42 EXAMPLE
44 BUGS
46 SEE ALSO
47 AndRegionRegion(), XOrRegionRegion()
49 INTERNALS
51 HISTORY
53 *****************************************************************************/
55 AROS_LIBFUNC_INIT
57 struct Region R3;
59 if (!R1->RegionRectangle)
61 /* First region is empty, second left intact */
62 return TRUE;
65 if (!R2->RegionRectangle)
67 /* Second region was empty. Make a plain copy. */
68 return _CopyRegionRectangles(R1, R2, GfxBase);
71 /* Do the complete slow thing here */
72 InitRegion(&R3);
76 _DoOperationBandBand
78 _OrBandBand,
79 MinX(R1),
80 MinX(R2),
81 MinY(R1),
82 MinY(R2),
83 R1->RegionRectangle,
84 R2->RegionRectangle,
85 &R3.RegionRectangle,
86 &R3.bounds,
87 GfxBase
91 ClearRegion(R2);
93 *R2 = R3;
95 _TranslateRegionRectangles(R3.RegionRectangle, -MinX(&R3), -MinY(&R3));
97 return TRUE;
100 return FALSE;
102 AROS_LIBFUNC_EXIT