mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-22 11:44:17 +01:00
Codechange: unify moving of pixels in the blitters
This commit is contained in:
@@ -111,11 +111,7 @@ void Blitter_8bppBase::ScrollBuffer(void *video, int &left, int &top, int &width
|
||||
width += scroll_x;
|
||||
}
|
||||
|
||||
for (int h = height; h > 0; h--) {
|
||||
std::copy_n(src, width, dst);
|
||||
src -= _screen.pitch;
|
||||
dst -= _screen.pitch;
|
||||
}
|
||||
Blitter::MovePixels(src, dst, width, height, -_screen.pitch);
|
||||
} else {
|
||||
/* Calculate pointers */
|
||||
dst = (uint8_t *)video + left + top * _screen.pitch;
|
||||
@@ -135,13 +131,7 @@ void Blitter_8bppBase::ScrollBuffer(void *video, int &left, int &top, int &width
|
||||
width += scroll_x;
|
||||
}
|
||||
|
||||
/* the y-displacement may be 0 therefore we have to use memmove,
|
||||
* because source and destination may overlap */
|
||||
for (int h = height; h > 0; h--) {
|
||||
memmove(dst, src, width * sizeof(uint8_t));
|
||||
src += _screen.pitch;
|
||||
dst += _screen.pitch;
|
||||
}
|
||||
Blitter::MovePixels(src, dst, width, height, _screen.pitch);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user