1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-22 19:54:06 +01:00

Codechange: let the ReusableBuffer use std::vector as storage

This commit is contained in:
Rubidium
2025-02-16 14:24:18 +01:00
committed by rubidium42
parent 59df0ff496
commit 576a96c685
4 changed files with 18 additions and 34 deletions

View File

@@ -296,23 +296,23 @@ static bool PadSingleSprite(SpriteLoader::Sprite *sprite, ZoomLevel zoom, uint p
for (uint y = 0; y < height; y++) {
if (y < pad_top || pad_bottom + y >= height) {
/* Top/bottom padding. */
MemSetT(data, 0, width);
std::fill_n(data, width, SpriteLoader::CommonPixel{});
data += width;
} else {
if (pad_left > 0) {
/* Pad left. */
MemSetT(data, 0, pad_left);
std::fill_n(data, pad_left, SpriteLoader::CommonPixel{});
data += pad_left;
}
/* Copy pixels. */
MemCpyT(data, src, sprite->width);
std::copy_n(src, sprite->width, data);
src += sprite->width;
data += sprite->width;
if (pad_right > 0) {
/* Pad right. */
MemSetT(data, 0, pad_right);
std::fill_n(data, pad_right, SpriteLoader::CommonPixel{});
data += pad_right;
}
}