tools/adflib: build only host variant which is used by Sam440 target
[AROS.git] / rom / graphics / ispointinregion.c
blob162e0a2195b291784d32e01daa030021c9aa50df
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #include "graphics_intern.h"
10 #include <graphics/regions.h>
11 #include "intregions.h"
13 /*****************************************************************************
15 NAME */
16 #include <proto/graphics.h>
18 AROS_LH3(BOOL, IsPointInRegion,
20 /* SYNOPSIS */
21 AROS_LHA(struct Region *, Reg, A0),
22 AROS_LHA(WORD, x, D0),
23 AROS_LHA(WORD, y, D1),
25 /* LOCATION */
26 struct GfxBase *, GfxBase, 184, Graphics)
28 /* FUNCTION
29 Checks if the point (x, y) is contained in the region Reg
31 INPUTS
32 region1 - pointer to a region structure
33 x - The point's 'x' coordinate
34 y - The point's 'y' coordinate
36 RESULT
37 TRUE if the point is contained, FALSE otherwise
39 NOTES
40 This function isn't available in AmigaOS.
42 EXAMPLE
44 BUGS
46 SEE ALSO
47 XorRegionRegion(), OrRegionRegion()
49 INTERNALS
51 HISTORY
53 *****************************************************************************/
55 AROS_LIBFUNC_INIT
57 struct RegionRectangle *rr;
59 if (!_IsPointInRect(Bounds(Reg), x, y))
60 return FALSE;
62 x -= MinX(Reg);
63 y -= MinY(Reg);
65 for
67 rr = Reg->RegionRectangle;
68 rr;
69 rr = rr->Next
72 if (y > MaxY(rr)) continue;
73 if (y < MinY(rr)) return FALSE;
74 if (x < MinX(rr)) continue;
75 if (x > MaxX(rr)) continue;
77 return TRUE;
80 return FALSE;
82 AROS_LIBFUNC_EXIT