2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: Graphics function ScrollVPort()
9 #include <aros/debug.h>
10 #include <proto/oop.h>
12 #include "graphics_intern.h"
13 #include "compositing_driver.h"
14 #include "gfxfuncsupport.h"
16 /*****************************************************************************
19 #include <proto/graphics.h>
21 AROS_LH1(void, ScrollVPort
,
24 AROS_LHA(struct ViewPort
*, vp
, A0
),
27 struct GfxBase
*, GfxBase
, 98, Graphics
)
30 Move the ViewPort to the position specified in DxOffset and DyOffset
31 members of the ViewPort structure.
39 AROS video drivers can perform a validation of offsets, and may refuse
40 to scroll the screen too far (if they somehow can't provide the requested
41 offset). In this case offset values in the ViewPort will be updated in
42 order to reflect the real result of the operation.
54 ******************************************************************************/
59 * Bitmap object pointer is contained in struct ViewPortData,
60 * connected to a ViewPortExtra.
61 * This is true even for planar Amiga bitmaps.
63 struct ViewPortExtra
*vpe
= (struct ViewPortExtra
*)GfxLookUp(vp
);
67 OOP_Object
*bm
= VPE_DATA(vpe
)->Bitmap
;
68 struct monitor_driverdata
*mdd
= VPE_DRIVER(vpe
);
69 IPTR x
= vp
->DxOffset
;
70 IPTR y
= vp
->DyOffset
;
71 BOOL compositing
= FALSE
;
73 D(bug("[ScrollVPort] ViewPort 0x%p, Extra 0x%p, composer 0x%p, offset (%ld, %ld)\n", vp
, vpe
, mdd
->composer
, x
, y
));
76 * First we actually move the bitmap.
77 * If we are using software composition, this will update bitmap's offsets, for
78 * the case if this move will cause the screen to be completely covered with this
79 * bitmap (while previously it was not). In this case the composer will dispose
80 * own working bitmap and display our bitmap instead. In effect of position update
81 * it will appear already in correct position. This will improve visual appearance
84 OOP_SetAttrsTags(bm
, aHidd_BitMap_LeftEdge
, x
, aHidd_BitMap_TopEdge
, y
, TAG_DONE
);
89 * Perform the operation via software composer.
90 * x and y will be updated to the validated values.
92 compositing
= composer_ScrollBitMap(mdd
->composer
, bm
, &x
, &y
, GfxBase
);
97 * Composition is active.
98 * Uninstall the framebuffer from the frontmost bitmap,
102 else if (!mdd
->bm_bak
)
105 * Composition is inactive. Install the framebuffer into the frontmost
106 * bitmap, if not already done.
107 * This will actually trigger only once, when composition switched from
108 * active to inactive state.
110 InstallFB(mdd
, GfxBase
);
114 /* The bitmap may fail to move. Fix up offsets now. */
118 * If software composition is inactive, we have our bitmap on display.
119 * Get validated offsets from it.
121 OOP_GetAttr(bm
, aHidd_BitMap_LeftEdge
, &x
);
122 OOP_GetAttr(bm
, aHidd_BitMap_TopEdge
, &y
);
125 D(bug("[ScrollVPort] Resulting offset (%ld, %ld), composition %d\n", x
, y
, compositing
));