summaryrefslogtreecommitdiff
path: root/src/gfx.cpp
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2007-06-18 20:08:21 +0000
committertruelight <truelight@openttd.org>2007-06-18 20:08:21 +0000
commit26e9b5ca5f0eafae421a640ea4e4753d6ac7ec0e (patch)
tree50524cab6a4a5052a93115c2d41248a6b3bf2528 /src/gfx.cpp
parent49220cc6f1e3570dc1b9001c40af2a8a4e35b649 (diff)
downloadopenttd-26e9b5ca5f0eafae421a640ea4e4753d6ac7ec0e.tar.xz
(svn r10206) -Codechange: more moving things to blitter-layer: ScrollBuffer
Diffstat (limited to 'src/gfx.cpp')
-rw-r--r--src/gfx.cpp48
1 files changed, 1 insertions, 47 deletions
diff --git a/src/gfx.cpp b/src/gfx.cpp
index 93b3e3608..6125797bf 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -61,59 +61,13 @@ static byte _dirty_blocks[DIRTY_BYTES_PER_LINE * MAX_SCREEN_HEIGHT / 8];
void GfxScroll(int left, int top, int width, int height, int xo, int yo)
{
Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
- const void *src;
- void *dst;
if (xo == 0 && yo == 0) return;
if (_cursor.visible) UndrawMouseCursor();
UndrawTextMessage();
- if (yo > 0) {
- /*Calculate pointers */
- dst = blitter->MoveTo(_screen.dst_ptr, left, top + height - 1);
- src = blitter->MoveTo(dst, 0, -yo);
-
- /* Decrease height and increase top */
- top += yo;
- height -= yo;
- assert(height > 0);
-
- /* Adjust left & width */
- if (xo >= 0) {
- dst = blitter->MoveTo(dst, xo, 0);
- left += xo;
- width -= xo;
- } else {
- src = blitter->MoveTo(src, -xo, 0);
- width += xo;
- }
-
- /* Negative height as we want to copy from bottom to top */
- blitter->CopyFromBuffer(dst, src, width, -height, _screen.pitch);
- } else {
- /* Calculate pointers */
- dst = blitter->MoveTo(_screen.dst_ptr, left, top);
- src = blitter->MoveTo(dst, 0, -yo);
-
- /* Decrese height. (yo is <=0). */
- height += yo;
- assert(height > 0);
-
- /* Adjust left & width */
- if (xo >= 0) {
- dst = blitter->MoveTo(dst, xo, 0);
- left += xo;
- width -= xo;
- } else {
- src = blitter->MoveTo(src, -xo, 0);
- width += xo;
- }
-
- /* the y-displacement may be 0 therefore we have to use memmove,
- * because source and destination may overlap */
- blitter->MoveBuffer(dst, src, width, height);
- }
+ blitter->ScrollBuffer(_screen.dst_ptr, left, top, width, height, xo, yo);
/* This part of the screen is now dirty. */
_video_driver->make_dirty(left, top, width, height);
}