r4493@vps: verhaegs | 2007-04-19 14:44:00 -0400
[AROS.git] / rom / graphics / orregionregion.c
blob2b9c61851db7f5009343e97f32f6a74f786c552d
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function OrRegionRegion()
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, OrRegionRegion,
19 /* SYNOPSIS */
20 AROS_LHA(struct Region *, R1, A0),
21 AROS_LHA(struct Region *, R2, A1),
23 /* LOCATION */
24 struct GfxBase *, GfxBase, 102, Graphics)
26 /* FUNCTION
27 OR of one region with another region, leaving result in
28 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, else FALSE
36 (out of memory)
38 NOTES
40 EXAMPLE
42 BUGS
44 SEE ALSO
45 AndRegionRegion(), XOrRegionRegion()
47 INTERNALS
49 HISTORY
51 *****************************************************************************/
53 AROS_LIBFUNC_INIT
55 struct Region R3;
57 if (!R1->RegionRectangle)
58 return TRUE;
60 if (!R2->RegionRectangle)
62 if (_LinkRegionRectangleList(R1->RegionRectangle, &R2->RegionRectangle, GfxBase))
64 R2->RegionRectangle = &Chunk(R2->RegionRectangle)->FirstChunk->Rects[0].RR;
65 R2->bounds = R1->bounds;
66 return TRUE;
69 return FALSE;
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