Fix IO memory access .. SB128 driver makes noises in VMWare - CMI is untested (Curren...
[AROS.git] / rom / graphics / andrectrect.c
blob186f72797c7d489f3450ec034f119ec5d4411849
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: (AROS only) Graphics function AndRectRect()
6 Lang: english
7 */
8 #include <aros/debug.h>
9 #include "graphics_intern.h"
10 #include <graphics/regions.h>
11 #include <clib/macros.h>
12 #include "intregions.h"
14 /*****************************************************************************
16 NAME */
17 #include <clib/graphics_protos.h>
19 AROS_LH3(BOOL, AndRectRect,
21 /* SYNOPSIS */
22 AROS_LHA(struct Rectangle *, rect1, A0),
23 AROS_LHA(struct Rectangle *, rect2, A1),
24 AROS_LHA(struct Rectangle *, intersect, A2),
26 /* LOCATION */
27 struct GfxBase *, GfxBase, 193, Graphics)
29 /* FUNCTION
30 Calculate the intersection rectangle between the
31 given Rectangle rect1 and the given Rectangle rect2
32 leaving the result in intersect (if intersect != NULL).
34 INPUTS
35 rect1 - pointer to 1st Rectangle
36 rect2 - pointer to 2nd Rectangle
37 intersect - pointer to rectangle which will hold result. May be NULL.
39 RESULT
40 TRUE if rect1 and rect2 do intersect. In this case intersect (unless
41 NULL) will contain the intersection rectangle.
43 FALSE if rect1 and rect2 do not overlap. "intersect" will
44 then be left unchanged.
46 NOTES
47 This function does not exist in AmigaOS.
49 EXAMPLE
51 BUGS
53 SEE ALSO
54 AndRectRegion(), AndRegionRegion()
56 INTERNALS
58 HISTORY
59 15-12-2000 stegerg implemented
61 *****************************************************************************/
63 AROS_LIBFUNC_INIT
65 ASSERT_VALID_PTR(rect1);
66 ASSERT_VALID_PTR(rect2);
67 ASSERT_VALID_PTR_OR_NULL(intersect);
69 if (IS_RECT_EVIL(rect1)) return FALSE;
70 if (IS_RECT_EVIL(rect2)) return FALSE;
72 if (intersect)
73 return _AndRectRect(rect1, rect2, intersect);
74 else
75 return overlap(*rect1, *rect2);
77 AROS_LIBFUNC_EXIT
79 } /* AndRectRect */