Fix IO memory access .. SB128 driver makes noises in VMWare - CMI is untested (Curren...
[AROS.git] / rom / graphics / scrollregion.c
blob7af3a3c4b627d216f6139332cea929baf0bf2e67
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function ScrollRegion()
6 Lang: english
7 */
8 #include "graphics_intern.h"
9 #include <graphics/regions.h>
10 #include "intregions.h"
11 #include "gfxfuncsupport.h"
13 /*****************************************************************************
15 NAME */
16 #include <proto/graphics.h>
18 AROS_LH4(BOOL, ScrollRegion,
20 /* SYNOPSIS */
21 AROS_LHA(struct Region *, region, A0),
22 AROS_LHA(struct Rectangle *, rect, A1),
23 AROS_LHA(WORD, dx, D0),
24 AROS_LHA(WORD, dy, D1),
26 /* LOCATION */
27 struct GfxBase *, GfxBase, 191, Graphics)
29 /* FUNCTION
30 Scroll the rectangles in the region by the amount of pixels specified, within the
31 specified rectangle.
33 INPUTS
34 region - pointer to a region structure
35 rect - pointer to the rectangle within which the scrolling has to happen.
36 If NULL, the region's bounds are used instead.
37 dx, dy - the amount of pixels by which to scroll the region. Negative values mean
38 respectively left and up, positive values mean right and down.
39 RESULT
40 TRUE if the operation succeeded, FALSE otherwise.
42 NOTES
43 This function doesn't exist in AmigaOS
45 EXAMPLE
47 BUGS
49 SEE ALSO
50 NewRegion()
52 INTERNALS
54 HISTORY
56 *****************************************************************************/
58 AROS_LIBFUNC_INIT
60 BOOL res = FALSE;
62 if (!rect)
64 TranslateRect(Bounds(region), dx, dy);
66 res = TRUE;
68 else
70 struct Region *cutRegion;
72 cutRegion = AndRectRegionND(region, rect);
73 if (cutRegion)
75 struct Region *newRegion;
77 TranslateRect(Bounds(cutRegion), dx, dy);
79 AndRectRegion(cutRegion, rect);
81 newRegion = ClearRectRegionND(region, rect);
82 if (newRegion)
84 if (OrRegionRegion(cutRegion, newRegion))
86 _SwapRegions(region, newRegion);
88 res = TRUE;
91 DisposeRegion(newRegion);
94 DisposeRegion(cutRegion);
98 return res;
100 AROS_LIBFUNC_EXIT