Unification of "SEE ALSO" for boopsi.library
[cake.git] / rom / graphics / setregion.c
blob21895568b295bc0a6e27978b0c5df370f67538ea
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() DisposeRegionRectangle()
50 CopyRegion()
52 INTERNALS
54 HISTORY
56 *****************************************************************************/
58 AROS_LIBFUNC_INIT
60 struct RegionRectangle * rrs, *rrd, *rrd_prev, *addr;
62 dest->bounds = src->bounds;
64 for
66 rrs = src->RegionRectangle, rrd = dest->RegionRectangle, rrd_prev = NULL;
67 rrs && rrd;
68 rrd_prev = rrd, rrs = rrs->Next, rrd = rrd->Next
71 rrd->bounds = rrs->bounds;
74 _DisposeRegionRectangleList(rrd, GfxBase);
76 if (rrd_prev)
77 addr = rrd_prev;
78 else
80 dest->RegionRectangle = NULL;
81 addr = dest->RegionRectangle;
84 if (!_LinkRegionRectangleList(rrs, &addr, GfxBase))
85 return FALSE;
87 if (!rrd_prev)
88 dest->RegionRectangle = addr ? &Chunk(addr)->FirstChunk->Rects[0].RR : NULL;
90 return TRUE;
92 AROS_LIBFUNC_EXIT
94 } /* SetRegion */