2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
7 #include <intuition/gadgetclass.h>
8 #include <proto/graphics.h>
9 #include <proto/layers.h>
11 #include "intuition_intern.h"
12 #include "inputhandler.h"
13 #include "inputhandler_actions.h"
14 #include "inputhandler_support.h"
20 struct ScrollWindowRasterMsg
22 struct IntuiActionMsg msg
;
23 struct Window
*window
;
26 static VOID
int_scrollwindowraster(struct ScrollWindowRasterMsg
*msg
,
27 struct IntuitionBase
*IntuitionBase
);
29 /*****************************************************************************
32 #include <proto/intuition.h>
34 AROS_LH7(void, ScrollWindowRaster
,
37 AROS_LHA(struct Window
*, win
, A1
),
38 AROS_LHA(WORD
, dx
, D0
),
39 AROS_LHA(WORD
, dy
, D1
),
40 AROS_LHA(WORD
, xmin
, D2
),
41 AROS_LHA(WORD
, ymin
, D3
),
42 AROS_LHA(WORD
, xmax
, D4
),
43 AROS_LHA(WORD
, ymax
, D5
),
46 struct IntuitionBase
*, IntuitionBase
, 133, Intuition
)
49 Scrolls the content of the rectangle defined by (xmin,ymin)-
50 (xmax,ymax) by (dx,dy) towards (0,0). This function calls
52 The advantage of this function over calling ScrollRasterBF() is
53 that the window will be informed about damages. A damage happens
54 if in a simple window parts from concelealed areas are scrolled
55 to visible areas. The visible areas will be blank as simple
56 windows store no data for concealed areas.
57 The blank parts that appear due to the scroll will be filled
58 with EraseRect() and are not considered damaged areas.
61 win - pointer to window in which to scroll
62 dx,dy - scroll by (dx,dy) towards (0,0)
63 xmin,ymin - upper left corner of the rectangle that will be
64 affected by the scroll
65 xmax,ymax - lower rigfht corner of the rectangle that will be
66 affected by the scroll
80 *****************************************************************************/
84 struct GfxBase
*GfxBase
= GetPrivIBase(IntuitionBase
)->GfxBase
;
85 DEBUG_SCROLLWINDOWRASTER(dprintf("ScrollWindowRaster: window 0x%lx dx %d dy %d (%d,%d)-(%d,%d)\n",
86 win
, dx
, dy
, xmin
, ymin
, xmax
, ymax
));
91 LockLayers(&win
->WScreen
->LayerInfo
);
94 ScrollRasterBF(win
->RPort
,
102 /* Has there been damage to the layer? */
103 if (WLAYER(win
)->Flags
& LAYERREFRESH
)
106 Send a refresh message to the window if it doesn't already
110 struct ScrollWindowRasterMsg msg
;
114 RecordDamage(win
->WScreen
,IntuitionBase
);
118 UnlockLayers(&win
->WScreen
->LayerInfo
);
121 DoASyncAction((APTR
)int_scrollwindowraster
, &msg
.msg
, sizeof(msg
), IntuitionBase
);
126 UnlockLayers(&win
->WScreen
->LayerInfo
);
131 } /* ScrollWindowRaster */
133 /*****************************************************************************
136 #include <proto/intuition.h>
138 AROS_LH7(void, ScrollWindowRasterNoFill
,
141 AROS_LHA(struct Window
*, win
, A1
),
142 AROS_LHA(WORD
, dx
, D0
),
143 AROS_LHA(WORD
, dy
, D1
),
144 AROS_LHA(WORD
, xmin
, D2
),
145 AROS_LHA(WORD
, ymin
, D3
),
146 AROS_LHA(WORD
, xmax
, D4
),
147 AROS_LHA(WORD
, ymax
, D5
),
150 struct IntuitionBase
*, IntuitionBase
, 159, Intuition
)
153 Scrolls the content of the rectangle defined by (xmin,ymin)-
154 (xmax,ymax) by (dx,dy) towards (0,0). This function calls
156 The advantage of this function over calling ScrollRasterBF() is
157 that the window will be informed about damages. A damage happens
158 if in a simple window parts from concelealed areas are scrolled
159 to visible areas. The visible areas will be blank as simple
160 windows store no data for concealed areas.
161 The blank parts that appear due to the scroll will be filled
162 with EraseRect() and are not considered damaged areas.
165 win - pointer to window in which to scroll
166 dx,dy - scroll by (dx,dy) towards (0,0)
167 xmin,ymin - upper left corner of the rectangle that will be
168 affected by the scroll
169 xmax,ymax - lower rigfht corner of the rectangle that will be
170 affected by the scroll
176 This function is compatible with MorphOS.
186 *****************************************************************************/
191 struct GfxBase
*GfxBase
= GetPrivIBase(IntuitionBase
)->GfxBase
;
192 DEBUG_SCROLLWINDOWRASTER(dprintf("ScrollWindowRaster: window 0x%lx dx %d dy %d (%d,%d)-(%d,%d)\n",
193 win
, dx
, dy
, xmin
, ymin
, xmax
, ymax
));
198 LockLayers(&win
->WScreen
->LayerInfo
);
204 WORD width
= xmax
- xmin
+ 1;
205 WORD height
= ymax
- ymin
+ 1;
208 if (adx
<width
&& ady
<height
)
210 WORD cw
= width
- adx
;
211 WORD ch
= height
- ady
;
223 ClipBlit(win
->RPort
,x1
,y1
,win
->RPort
,x2
,y2
,cw
,ch
,0xc0);
226 if (!(WLAYER(win
)->Flags
& LAYERREFRESH
))
228 struct Rectangle rect
;
231 rect
.MinX
= WLAYER(win
)->bounds
.MinX
+ xmin
;
232 rect
.MinY
= WLAYER(win
)->bounds
.MinY
+ ymin
;
233 rect
.MaxX
= WLAYER(win
)->bounds
.MinX
+ xmax
;
234 rect
.MaxY
= WLAYER(win
)->bounds
.MinY
+ ymax
;
236 for (cr
=WLAYER(win
)->ClipRect
;cr
;cr
=cr
->Next
)
238 if (rect
.MinX
< cr
->bounds
.MinX
) continue;
239 if (rect
.MaxX
> cr
->bounds
.MaxX
) continue;
240 if (rect
.MinY
< cr
->bounds
.MinY
) continue;
241 if (rect
.MaxY
> cr
->bounds
.MaxY
) continue;
249 ULONG mask
= win
->RPort
->Mask
;
250 win
->RPort
->Mask
= 0;
251 ScrollRaster(win
->RPort
,dx
,dy
,xmin
,ymin
,xmax
,ymax
);
252 win
->RPort
->Mask
= mask
;
256 /* Has there been damage to the layer? */
257 if (WLAYER(win
)->Flags
& LAYERREFRESH
)
260 Send a refresh message to the window if it doesn't already
264 struct ScrollWindowRasterMsg msg
;
268 RecordDamage(win
->WScreen
,IntuitionBase
);
272 UnlockLayers(&win
->WScreen
->LayerInfo
);
274 DoASyncAction((APTR
)int_scrollwindowraster
, &msg
.msg
, sizeof(msg
), IntuitionBase
);
279 UnlockLayers(&win
->WScreen
->LayerInfo
);
284 } /* ScrollWindowRaster */
286 static VOID
int_scrollwindowraster(struct ScrollWindowRasterMsg
*msg
,
287 struct IntuitionBase
*IntuitionBase
)
289 struct LayersBase
*LayersBase
= GetPrivIBase(IntuitionBase
)->LayersBase
;
290 struct Window
*window
= msg
->window
;
292 LOCK_REFRESH(window
->WScreen
);
294 if (WLAYER(window
)->Flags
& LAYERREFRESH
)
295 WindowNeedsRefresh(window
, IntuitionBase
);
297 UNLOCK_REFRESH(window
->WScreen
);