2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Graphics function ScrollRaster()
8 #include "graphics_intern.h"
9 #include <graphics/rastport.h>
10 #include "gfxfuncsupport.h"
12 /*****************************************************************************
15 #include <graphics/rastport.h>
16 #include <proto/graphics.h>
18 AROS_LH7(void, ScrollRaster
,
21 AROS_LHA(struct RastPort
*, rp
, A1
),
22 AROS_LHA(LONG
, dx
, D0
),
23 AROS_LHA(LONG
, dy
, D1
),
24 AROS_LHA(LONG
, xMin
, D2
),
25 AROS_LHA(LONG
, yMin
, D3
),
26 AROS_LHA(LONG
, xMax
, D4
),
27 AROS_LHA(LONG
, yMax
, D5
),
30 struct GfxBase
*, GfxBase
, 66, Graphics
)
33 Scroll the contents of a rastport (dx,dy) towards (0,0).
34 The empty spaces is filled by a call to RectFill().
35 Only the pixel in the rectangle (xMin,yMin)-(xMax,yMax)
36 will be affected. The lower right corner (xMax, yMax) is
37 automatically adjusted to the lower right corner in case
39 After this operation the Flags bit of the layer associated
40 with this rastport, if there is any layer, should be tested
41 for simple layers in case there has any damage been created.
45 rp - pointer to rastport
46 dx,dy - distance to move in x and y direction. Positive values go
48 xMin,yMin - upper left hand corner of the affected rectangle
49 xMax,yMax - lower right hand corner of the affected rectangle
64 29-10-95 digulla automatically created from
65 graphics_lib.fd and clib/graphics_protos.h
67 *****************************************************************************/
71 ULONG old_drmd
= GetDrMd(rp
);
72 LONG width
, height
, absdx
, absdy
;
79 if ((xMin
> xMax
) || (yMin
> yMax
)) return;
82 This function will simply call ScrollRaster() and fill the empty
83 space with calls to RectFill
87 adjust xMax and yMax in case the lower right corner would be outside
90 /* Is it a window's rastport ? */
91 if (NULL
!= rp
->Layer
)
93 struct Layer
* L
= rp
->Layer
;
95 if (xMax
> (L
->bounds
.MaxX
- L
->bounds
.MinX
) )
96 xMax
= (L
->bounds
.MaxX
- L
->bounds
.MinX
) ;
98 if (yMax
> (L
->bounds
.MaxY
- L
->bounds
.MinY
) )
99 yMax
= (L
->bounds
.MaxY
- L
->bounds
.MinY
) ;
104 /* this one belongs to a screen */
105 struct BitMap
* bm
= rp
->BitMap
;
106 ULONG width
= GetBitMapAttr(bm
, BMA_WIDTH
);
107 ULONG height
= GetBitMapAttr(bm
, BMA_HEIGHT
);
108 if ((ULONG
)xMax
>= width
)
110 if ((ULONG
)yMax
>= height
)
114 absdx
= (dx
>= 0) ? dx
: -dx
;
115 absdy
= (dy
>= 0) ? dy
: -dy
;
117 width
= xMax
- xMin
+ 1;
118 height
= yMax
- yMin
+ 1;
120 if ((width
< 1) || (height
< 1)) return;
122 if ((absdx
>= width
) || (absdy
>= height
))
124 SetDrMd(rp
, old_drmd
^ INVERSVID
);
125 RectFill(rp
, xMin
, yMin
, xMax
, yMax
);
126 SetDrMd(rp
, old_drmd
);
131 if (!MoveRaster(rp
, dx
, dy
, xMin
, yMin
, xMax
, yMax
, TRUE
, GfxBase
))
135 The raster is scrolled and I fill the empty area with the
139 SetDrMd(rp
, old_drmd
^ INVERSVID
);
141 /* was it scrolled left or right? */
146 /* scrolled towards left, clearing on the right */
155 /* scrolled towards right, clearing on the left */
159 xMin
- dx
- 1, /* a scroll by -1 should only erase a row of width 1 */
168 /* scrolled up, clearing on the bottom */
177 /* scrolled down, clearing on the top */
186 SetDrMd(rp
, old_drmd
);