2 Copyright © 1995-2007, 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 DEBUG_SCROLLWINDOWRASTER(dprintf("ScrollWindowRaster: window 0x%lx dx %d dy %d (%d,%d)-(%d,%d)\n",
85 win
, dx
, dy
, xmin
, ymin
, xmax
, ymax
));
90 LockLayers(&win
->WScreen
->LayerInfo
);
93 ScrollRasterBF(win
->RPort
,
101 /* Has there been damage to the layer? */
102 if (WLAYER(win
)->Flags
& LAYERREFRESH
)
105 Send a refresh message to the window if it doesn't already
109 struct ScrollWindowRasterMsg msg
;
113 RecordDamage(win
->WScreen
,IntuitionBase
);
117 UnlockLayers(&win
->WScreen
->LayerInfo
);
120 DoASyncAction((APTR
)int_scrollwindowraster
, &msg
.msg
, sizeof(msg
), IntuitionBase
);
125 UnlockLayers(&win
->WScreen
->LayerInfo
);
130 } /* ScrollWindowRaster */
132 AROS_LH7(void, ScrollWindowRasterNoFill
,
135 AROS_LHA(struct Window
*, win
, A1
),
136 AROS_LHA(WORD
, dx
, D0
),
137 AROS_LHA(WORD
, dy
, D1
),
138 AROS_LHA(WORD
, xmin
, D2
),
139 AROS_LHA(WORD
, ymin
, D3
),
140 AROS_LHA(WORD
, xmax
, D4
),
141 AROS_LHA(WORD
, ymax
, D5
),
144 struct IntuitionBase
*, IntuitionBase
, 159, Intuition
)
149 DEBUG_SCROLLWINDOWRASTER(dprintf("ScrollWindowRaster: window 0x%lx dx %d dy %d (%d,%d)-(%d,%d)\n",
150 win
, dx
, dy
, xmin
, ymin
, xmax
, ymax
));
155 LockLayers(&win
->WScreen
->LayerInfo
);
161 WORD width
= xmax
- xmin
+ 1;
162 WORD height
= ymax
- ymin
+ 1;
165 if (adx
<width
&& ady
<height
)
167 WORD cw
= width
- adx
;
168 WORD ch
= height
- ady
;
180 ClipBlit(win
->RPort
,x1
,y1
,win
->RPort
,x2
,y2
,cw
,ch
,0xc0);
183 if (!(WLAYER(win
)->Flags
& LAYERREFRESH
))
185 struct Rectangle rect
;
188 rect
.MinX
= WLAYER(win
)->bounds
.MinX
+ xmin
;
189 rect
.MinY
= WLAYER(win
)->bounds
.MinY
+ ymin
;
190 rect
.MaxX
= WLAYER(win
)->bounds
.MinX
+ xmax
;
191 rect
.MaxY
= WLAYER(win
)->bounds
.MinY
+ ymax
;
193 for (cr
=WLAYER(win
)->ClipRect
;cr
;cr
=cr
->Next
)
195 if (rect
.MinX
< cr
->bounds
.MinX
) continue;
196 if (rect
.MaxX
> cr
->bounds
.MaxX
) continue;
197 if (rect
.MinY
< cr
->bounds
.MinY
) continue;
198 if (rect
.MaxY
> cr
->bounds
.MaxY
) continue;
206 ULONG mask
= win
->RPort
->Mask
;
207 win
->RPort
->Mask
= 0;
208 ScrollRaster(win
->RPort
,dx
,dy
,xmin
,ymin
,xmax
,ymax
);
209 win
->RPort
->Mask
= mask
;
213 /* Has there been damage to the layer? */
214 if (WLAYER(win
)->Flags
& LAYERREFRESH
)
217 Send a refresh message to the window if it doesn't already
221 struct ScrollWindowRasterMsg msg
;
225 RecordDamage(win
->WScreen
,IntuitionBase
);
229 UnlockLayers(&win
->WScreen
->LayerInfo
);
231 DoASyncAction((APTR
)int_scrollwindowraster
, &msg
.msg
, sizeof(msg
), IntuitionBase
);
236 UnlockLayers(&win
->WScreen
->LayerInfo
);
241 } /* ScrollWindowRaster */
243 static VOID
int_scrollwindowraster(struct ScrollWindowRasterMsg
*msg
,
244 struct IntuitionBase
*IntuitionBase
)
246 struct Window
*window
= msg
->window
;
248 LOCK_REFRESH(window
->WScreen
);
250 if (WLAYER(window
)->Flags
& LAYERREFRESH
)
251 WindowNeedsRefresh(window
, IntuitionBase
);
253 UNLOCK_REFRESH(window
->WScreen
);