Disabled debug for Poseidon by default.
[cake.git] / rom / graphics / andrectregionnd.c
blob80b9bf9c43b620e5ea5b22d0c68133ad04dc9aec
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function AndRectRegion()
6 Lang: english
7 */
8 #include "graphics_intern.h"
9 #include <graphics/regions.h>
10 #include <proto/exec.h>
11 #include <clib/macros.h>
12 #include "intregions.h"
14 /*****************************************************************************
16 NAME */
17 #include <proto/graphics.h>
19 AROS_LH2(struct Region *, AndRectRegionND,
21 /* SYNOPSIS */
22 AROS_LHA(struct Region *, Reg, A0),
23 AROS_LHA(struct Rectangle *, Rect, A1),
25 /* LOCATION */
26 struct GfxBase *, GfxBase, 107, Graphics)
28 /* FUNCTION
29 Remove everything inside 'region' that is outside 'rectangle'
31 INPUTS
32 region - pointer to Region structure
33 rectangle - pointer to Rectangle structure
35 RESULT
36 The resulting region or NULL in case there's no enough free memory
38 NOTES
40 BUGS
42 SEE ALSO
43 AndRegionRegion(), OrRectRegion(), XorRectRegion(), ClearRectRegion()
44 NewRegion()
46 INTERNALS
48 HISTORY
49 27-11-96 digulla automatically created from
50 graphics_lib.fd and clib/graphics_protos.h
51 16-01-97 mreckt initial version
53 *****************************************************************************/
55 AROS_LIBFUNC_INIT
57 struct Region *Res;
61 /* Is the region empty? */
62 !Reg->RegionRectangle ||
64 /* Does the rectangle completely cover the region? */
65 Rect->MinX <= MinX(Reg) &&
66 Rect->MinY <= MinY(Reg) &&
67 Rect->MaxX >= MaxX(Reg) &&
68 Rect->MaxY >= MaxY(Reg)
72 return CopyRegion(Reg);
75 Res = NewRegion();
77 if (Res)
79 struct RegionRectangle rr;
81 rr.bounds = *Rect;
82 rr.Next = NULL;
83 rr.Prev = NULL;
87 _DoOperationBandBand
89 _AndBandBand,
90 MinX(Reg),
92 MinY(Reg),
94 Reg->RegionRectangle,
95 &rr,
96 &Res->RegionRectangle,
97 &Res->bounds,
98 GfxBase
102 _TranslateRegionRectangles(Res->RegionRectangle, -MinX(Res), -MinY(Res));
104 else
106 DisposeRegion(Res);
107 Res = NULL;
111 return Res;
113 AROS_LIBFUNC_EXIT
114 } /* AndRectRegion */