1
0
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:
Rubidium
2025-05-10 21:26:08 +02:00
committed by rubidium42
parent b38527ca05
commit 3cd040ffe9
6 changed files with 30 additions and 48 deletions

View File

@@ -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);
}
}