Fix SW BC2 decoding pitch

This commit is contained in:
Billy Laws 2022-09-29 21:01:47 +01:00
parent 60863fa162
commit 5c0e4a839d

View File

@ -1511,11 +1511,11 @@ namespace bcn {
const auto *alpha{reinterpret_cast<const BC_alpha *>(src)}; const auto *alpha{reinterpret_cast<const BC_alpha *>(src)};
const auto *color{reinterpret_cast<const BC_color *>(src + 8)}; const auto *color{reinterpret_cast<const BC_color *>(src + 8)};
size_t pitch{R8g8b8a8Bpp * width}; size_t pitch{R8g8b8a8Bpp * width};
for (size_t y{}; y < height; y += BlockHeight, dst += BlockHeight * width) { for (size_t y{}; y < height; y += BlockHeight, dst += BlockHeight * pitch) {
uint8_t *dstRow{dst}; uint8_t *dstRow{dst};
for (size_t x{}; x < width; x += BlockWidth, alpha += 2, color += 2, dstRow += BlockWidth * R8g8b8a8Bpp) { for (size_t x{}; x < width; x += BlockWidth, alpha += 2, color += 2, dstRow += BlockWidth * R8g8b8a8Bpp) {
[[clang::always_inline]] color->decode(dstRow, x, y, width, height, width, R8g8b8a8Bpp, false, true); [[clang::always_inline]] color->decode(dstRow, x, y, width, height, pitch, R8g8b8a8Bpp, false, true);
[[clang::always_inline]] alpha->decode(dstRow, x, y, width, height, width, R8g8b8a8Bpp); [[clang::always_inline]] alpha->decode(dstRow, x, y, width, height, pitch, R8g8b8a8Bpp);
} }
} }
} }