codeset
[AROS.git] / rom / graphics / scrollvport.c
blob34ba503b79693c1199793511094be8c4300ee60a
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function ScrollVPort()
6 Lang: english
7 */
9 #include <aros/debug.h>
10 #include <proto/oop.h>
12 #include "graphics_intern.h"
13 #include "gfxfuncsupport.h"
15 /*****************************************************************************
17 NAME */
18 #include <proto/graphics.h>
20 AROS_LH1(void, ScrollVPort,
22 /* SYNOPSIS */
23 AROS_LHA(struct ViewPort *, vp, A0),
25 /* LOCATION */
26 struct GfxBase *, GfxBase, 98, Graphics)
28 /* FUNCTION
30 INPUTS
32 RESULT
34 NOTES
35 AROS video drivers can perform a validation of offsets, and may refuse
36 to scroll the screen too far (if they somehow can't provide the requested
37 offset). In this case offset values in the ViewPort will be updated in
38 order to reflect the real result of the operation.
40 EXAMPLE
42 BUGS
44 SEE ALSO
46 INTERNALS
48 HISTORY
51 ******************************************************************************/
53 AROS_LIBFUNC_INIT
55 /* We use obtain/release pair because this makes ScrollVPort()
56 operating also on planar bitmaps, which can aid in porting AROS
57 to m68k Amiga */
58 OOP_Object *bitmap = OBTAIN_HIDD_BM(vp->RasInfo->BitMap);
59 IPTR tags[] = {
60 aHidd_BitMap_LeftEdge, vp->DxOffset,
61 aHidd_BitMap_TopEdge, vp->DyOffset,
62 TAG_DONE
64 IPTR offset;
66 /* Actually move the bitmap */
67 OOP_SetAttrs(bitmap, tags);
69 /* The bitmap may fail to move. Fix up offsets now */
70 OOP_GetAttr(bitmap, aHidd_BitMap_LeftEdge, &offset);
71 vp->DxOffset = offset;
72 OOP_GetAttr(bitmap, aHidd_BitMap_TopEdge, &offset);
73 vp->DyOffset = offset;
75 RELEASE_HIDD_BM(bitmap, vp->RasInfo->BitMap);
77 AROS_LIBFUNC_EXIT
78 } /* ScrollVPort */