2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Graphics function ScrollRasterBF()
8 #include "graphics_intern.h"
9 #include <graphics/rastport.h>
10 #include <graphics/gfx.h>
11 #include "gfxfuncsupport.h"
13 /*****************************************************************************
16 #include <graphics/rastport.h>
17 #include <proto/graphics.h>
19 AROS_LH7(void, ScrollRasterBF
,
22 AROS_LHA(struct RastPort
*, rp
, A1
),
23 AROS_LHA(LONG
, dx
, D0
),
24 AROS_LHA(LONG
, dy
, D1
),
25 AROS_LHA(LONG
, xMin
, D2
),
26 AROS_LHA(LONG
, yMin
, D3
),
27 AROS_LHA(LONG
, xMax
, D4
),
28 AROS_LHA(LONG
, yMax
, D5
),
31 struct GfxBase
*, GfxBase
, 167, Graphics
)
34 Scroll the contents of a rastport (dx,dy) towards (0,0).
35 The empty spaces is filled by a call to EraseRect().
36 Only the pixel in the rectangle (xMin,yMin)-(xMax,yMax)
37 will be affected. The lower right corner (xMax, yMax) is
38 automatically adjusted to the lower right corner in case
40 After this operation the Flags bit of the layer associated
41 with this rastport, if there is any layer, should be tested
42 for simple layers in case there has any damage been created.
46 rp - pointer to rastport
47 dx,dy - distance to move in x and y direction. Positive values go
49 xMin,yMin - upper left hand corner of the affected rectangle
50 xMax,yMax - lower right hand corner of the affected rectangle
66 *****************************************************************************/
70 LONG width
, height
, absdx
, absdy
;
77 if ((xMin
> xMax
) || (yMin
> yMax
)) return;
80 This function will simply call ScrollRaster() and fill the empty
81 space with calls to EraseRect()
85 adjust xMax and yMax in case the lower right corner would be outside
88 /* Is it a window's rastport ? */
89 if (NULL
!= rp
->Layer
)
91 struct Layer
* L
= rp
->Layer
;
93 if (xMax
> (L
->bounds
.MaxX
- L
->bounds
.MinX
) )
94 xMax
= (L
->bounds
.MaxX
- L
->bounds
.MinX
) ;
96 if (yMax
> (L
->bounds
.MaxY
- L
->bounds
.MinY
) )
97 yMax
= (L
->bounds
.MaxY
- L
->bounds
.MinY
) ;
102 /* this one belongs to a screen */
103 struct BitMap
* bm
= rp
->BitMap
;
105 ULONG width
= GetBitMapAttr(bm
, BMA_WIDTH
);
106 ULONG height
= GetBitMapAttr(bm
, BMA_HEIGHT
);
108 if ((ULONG
)xMax
>= width
)
111 if ((ULONG
)yMax
>= height
)
115 absdx
= (dx
>= 0) ? dx
: -dx
;
116 absdy
= (dy
>= 0) ? dy
: -dy
;
118 width
= xMax
- xMin
+ 1;
119 height
= yMax
- yMin
+ 1;
121 if ((width
< 1) || (height
< 1)) return;
123 if ((absdx
>= width
) || (absdy
>= height
))
125 EraseRect(rp
, xMin
, yMin
, xMax
, yMax
);
130 if (!MoveRaster(rp
, dx
, dy
, xMin
, yMin
, xMax
, yMax
, TRUE
, GfxBase
))
134 The raster is scrolled and I fill the empty area with the
138 /* was it scrolled left or right? */
143 /* scrolled towards left, clearing on the right */
152 /* scrolled towards right, clearing on the left */
156 xMin
- dx
- 1, /* a scroll by -1 should only erase a row of width 1 */
165 /* scrolled up, clearing on the bottom */
174 /* scrolled down, clearing on the top */
185 } /* ScrollRasterBF */