diff --git a/src/nostalgia/modules/core/src/tilesheet.cpp b/src/nostalgia/modules/core/src/tilesheet.cpp index 78b03372..29ca442d 100644 --- a/src/nostalgia/modules/core/src/tilesheet.cpp +++ b/src/nostalgia/modules/core/src/tilesheet.cpp @@ -163,8 +163,8 @@ unsigned pixelCnt(TileSheet::SubSheet const&ss, int8_t pBpp) noexcept { ox::Error resizeSubsheet(TileSheet::SubSheet &ss, int8_t pBpp, ox::Size const&sz) noexcept { ox::Vector out; oxReturnError(setPixelCount(out, pBpp, static_cast(sz.width * sz.height) * PixelsPerTile)); - auto const w = sz.width * TileWidth; - auto const h = sz.height * TileHeight; + auto const w = ox::min(ss.columns, sz.width) * TileWidth; + auto const h = ox::min(ss.rows, sz.height) * TileHeight; for (auto x = 0; x < w; ++x) { for (auto y = 0; y < h; ++y) { auto const palIdx = getPixel(ss, pBpp, {x, y});