diff --git a/Source/Resource/Sprites/SpriteEncoding.cpp b/Source/Resource/Sprites/SpriteEncoding.cpp index f3107f1e..fdf5d9ec 100644 --- a/Source/Resource/Sprites/SpriteEncoding.cpp +++ b/Source/Resource/Sprites/SpriteEncoding.cpp @@ -56,12 +56,14 @@ std::uint8_t* CSprRes::ReduceSprite(const std::uint8_t* pixels, int width, int h const int outputWidth = halfWidth != 0 ? width / 2 : width; const int outputHeight = halfHeight != 0 ? height / 2 : height; auto* output = new std::uint8_t[outputWidth * outputHeight]; + std::uint8_t* destination = output; for (int y = 0; y < outputHeight; ++y) { const auto* source = pixels + width * y * (halfHeight + 1); for (int x = 0; x < outputWidth; ++x) { - output[y * outputWidth + x] = source[x * (halfWidth + 1)]; + *destination++ = *source; + source += halfWidth + 1; } }