Fix IO memory access .. SB128 driver makes noises in VMWare - CMI is untested (Curren...
[AROS.git] / rom / graphics / ispointinregion.c
blobccc5877ccb0d7dedce85833045d62a20a935ea67
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function AndRegionRegion()
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_LH3(BOOL, IsPointInRegion,
19 /* SYNOPSIS */
20 AROS_LHA(struct Region *, Reg, A0),
21 AROS_LHA(WORD, x, D0),
22 AROS_LHA(WORD, y, D1),
24 /* LOCATION */
25 struct GfxBase *, GfxBase, 190, Graphics)
27 /* FUNCTION
28 Checks if the point (x, y) is contained in the region Reg
30 INPUTS
31 region1 - pointer to a region structure
32 x - The point's 'x' coordinate
33 y - The point's 'y' coordinate
35 RESULT
36 TRUE if the point is contained, FALSE otherwise
38 NOTES
39 This function isn't available in AmigaOS.
41 EXAMPLE
43 BUGS
45 SEE ALSO
46 XorRegionRegion(), OrRegionRegion()
48 INTERNALS
50 HISTORY
52 *****************************************************************************/
54 AROS_LIBFUNC_INIT
56 struct RegionRectangle *rr;
58 if (!_IsPointInRect(Bounds(Reg), x, y))
59 return FALSE;
61 x -= MinX(Reg);
62 y -= MinY(Reg);
64 for
66 rr = Reg->RegionRectangle;
67 rr;
68 rr = rr->Next
71 if (y > MaxY(rr)) continue;
72 if (y < MinY(rr)) return FALSE;
73 if (x < MinX(rr)) continue;
74 if (x > MaxX(rr)) continue;
76 return TRUE;
79 return FALSE;
81 AROS_LIBFUNC_EXIT