Fix IO memory access .. SB128 driver makes noises in VMWare - CMI is untested (Curren...
[AROS.git] / rom / graphics / newrectregion.c
blob741114072157e89f2fc4000a90f540ec27c5c4d8
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: (AROS only) Graphics function NewRectRegion()
6 Lang: english
7 */
8 #include "graphics_intern.h"
9 #include <graphics/regions.h>
10 #include <clib/macros.h>
11 #include "intregions.h"
13 /*****************************************************************************
15 NAME */
16 #include <proto/graphics.h>
18 AROS_LH4(struct Region *, NewRectRegion,
20 /* SYNOPSIS */
21 AROS_LHA(WORD, MinX, D0),
22 AROS_LHA(WORD, MinY, D1),
23 AROS_LHA(WORD, MaxX, D2),
24 AROS_LHA(WORD, MaxY, D3),
26 /* LOCATION */
27 struct GfxBase *, GfxBase, 194, Graphics)
29 /* FUNCTION
30 Creates a new rectangular Region
32 INPUTS
33 MinX, MinY, MaxX, MaxY - The extent of the Rect
35 RESULT
36 Pointer to the newly created Region. NULL on failure.
38 NOTES
39 This function does not exist in AmigaOS.
40 It does basically the same as:
42 struct Rectangle rect;
43 struct Region *region;
45 rect.MinX = MinX;
46 rect.MinY = MinY;
47 rect.MaxX = MaxX;
48 rect.MaxY = MaxY;
50 region = NewRegion();
51 OrRectRegion(region, &rect);
53 EXAMPLE
55 BUGS
57 SEE ALSO
58 NewRegion(), OrRectRegion()
60 INTERNALS
62 HISTORY
63 15-12-2000 stegerg implemented
65 *****************************************************************************/
67 AROS_LIBFUNC_INIT
69 struct Region *region;
70 struct RegionRectangle *rr;
72 if ((region = NewRegion()))
74 struct RegionRectangle *last = NULL;
76 if (ARE_COORDS_EVIL(MinX, MinY, MaxX, MaxY))
78 /* Just create an empty region */
80 else if ((rr = _NewRegionRectangle(&last, GfxBase)))
82 region->bounds.MinX = MinX;
83 region->bounds.MinY = MinY;
84 region->bounds.MaxX = MaxX;
85 region->bounds.MaxY = MaxY;
87 rr->bounds.MinX = 0;
88 rr->bounds.MinY = 0;
89 rr->bounds.MaxX = MaxX - MinX;
90 rr->bounds.MaxY = MaxY - MinY;
92 region->RegionRectangle = rr;
94 else
96 DisposeRegion(region);
97 region = NULL;
101 return region;
103 AROS_LIBFUNC_EXIT
105 } /* NewRectRegion */