Fix IO memory access .. SB128 driver makes noises in VMWare - CMI is untested (Curren...
[AROS.git] / rom / graphics / clearrectregion.c
blobede99ef97b2cd0c69e73a7829f45a4d708bf9d05
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function ClearRectRegion()
6 Lang: english
7 */
8 #include "graphics_intern.h"
9 #include <graphics/regions.h>
10 #include <proto/graphics.h>
11 #include "intregions.h"
13 /*****************************************************************************
15 NAME */
16 #include <clib/graphics_protos.h>
18 AROS_LH2(BOOL, ClearRectRegion,
20 /* SYNOPSIS */
21 AROS_LHA(struct Region *, Reg , A0),
22 AROS_LHA(struct Rectangle *, Rect, A1),
24 /* LOCATION */
25 struct GfxBase *, GfxBase, 87, Graphics)
27 /* FUNCTION
28 Clear the given Rectangle from the given Region
30 INPUTS
31 region - pointer to a Region structure
32 rectangle - pointer to a Rectangle structure
34 RESULT
35 FALSE if not enough memory was available, else TRUE
37 NOTES
39 EXAMPLE
41 BUGS
43 SEE ALSO
44 AndRectRegion(), OrRectRegion(), XorRectRegion()
46 INTERNALS
48 HISTORY
49 27-11-96 digulla automatically created from
50 graphics_lib.fd and clib/graphics_protos.h
51 20-01-96 mreckt initial version
53 *****************************************************************************/
55 AROS_LIBFUNC_INIT
57 struct Region Res;
58 struct RegionRectangle rr;
60 /* If the rectangle and the region don't overlap just return */
61 if (IS_RECT_EVIL(Rect) || !overlap(*Rect, Reg->bounds))
62 return TRUE;
64 /* if the rectangle completely covers the region just clear the region and return */
67 Rect->MinX <= MinX(Reg) &&
68 Rect->MinY <= MinY(Reg) &&
69 Rect->MaxX >= MaxX(Reg) &&
70 Rect->MaxY >= MaxY(Reg)
73 ClearRegion(Reg);
74 return TRUE;
77 InitRegion(&Res);
79 rr.bounds = *Rect;
80 rr.Next = NULL;
81 rr.Prev = NULL;
85 _DoOperationBandBand
87 _ClearBandBand,
89 MinX(Reg),
91 MinY(Reg),
92 &rr,
93 Reg->RegionRectangle,
94 &Res.RegionRectangle,
95 &Res.bounds,
96 GfxBase
100 ClearRegion(Reg);
102 *Reg = Res;
104 _TranslateRegionRectangles(Res.RegionRectangle, -MinX(&Res), -MinY(&Res));
106 return TRUE;
109 return FALSE;
111 AROS_LIBFUNC_EXIT
112 } /* ClearRectRegion */