Fix IO memory access .. SB128 driver makes noises in VMWare - CMI is untested (Curren...
[AROS.git] / rom / graphics / setregion.c
blob82217cc4e4021424150f3bf3df3625ec922b1826
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: (AROS only) Graphics function SetRegion()
6 Lang: english
7 */
8 #include "graphics_intern.h"
9 #include <graphics/regions.h>
10 #include "intregions.h"
12 /*****************************************************************************
14 NAME */
15 #include <clib/graphics_protos.h>
17 AROS_LH2(BOOL, SetRegion,
19 /* SYNOPSIS */
20 AROS_LHA(struct Region *, src , A0),
21 AROS_LHA(struct Region *, dest, A1),
23 /* LOCATION */
24 struct GfxBase *, GfxBase, 195, Graphics)
26 /* FUNCTION
27 Sets the destination region to the source region.
28 Allocates necessary RegionRectangles if necessary
29 and deallocates any excessive RegionRectangles in
30 the destination Region. The source Region remains
31 untouched.
32 If the system runs out of memory during allocation
33 of RegionRectangles the destination Region will
36 INPUTS
38 RESULT
39 TRUE if everything went alright, FALSE otherwise
40 (out of memory).
42 NOTES
44 EXAMPLE
46 BUGS
48 SEE ALSO
49 NewRegion(), DisposeRegion(), CopyRegion()
51 INTERNALS
53 HISTORY
55 *****************************************************************************/
57 AROS_LIBFUNC_INIT
59 struct RegionRectangle * rrs, *rrd, *rrd_prev, *addr;
61 dest->bounds = src->bounds;
63 for
65 rrs = src->RegionRectangle, rrd = dest->RegionRectangle, rrd_prev = NULL;
66 rrs && rrd;
67 rrd_prev = rrd, rrs = rrs->Next, rrd = rrd->Next
70 rrd->bounds = rrs->bounds;
73 _DisposeRegionRectangleList(rrd, GfxBase);
75 if (rrd_prev)
76 addr = rrd_prev;
77 else
79 dest->RegionRectangle = NULL;
80 addr = dest->RegionRectangle;
83 if (!_LinkRegionRectangleList(rrs, &addr, GfxBase))
84 return FALSE;
86 if (!rrd_prev)
87 dest->RegionRectangle = addr ? &Chunk(addr)->FirstChunk->Rects[0].RR : NULL;
89 return TRUE;
91 AROS_LIBFUNC_EXIT
93 } /* SetRegion */