From 5a5905d2572cb8f97126734e88e80848a1f4e7e7 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sun, 29 Mar 2020 23:48:07 -0500 Subject: [PATCH] [nostalgia/core/studio] Fix TileSheetEditor to clear pixel data on reload --- src/nostalgia/core/studio/tilesheeteditor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nostalgia/core/studio/tilesheeteditor.cpp b/src/nostalgia/core/studio/tilesheeteditor.cpp index 117fa3d1..d5fa15bd 100644 --- a/src/nostalgia/core/studio/tilesheeteditor.cpp +++ b/src/nostalgia/core/studio/tilesheeteditor.cpp @@ -354,7 +354,7 @@ std::unique_ptr SheetData::toNostalgiaGraphic() const { auto pixelCount = ng->rows * ng->columns * PixelsPerTile; if (ng->bpp == 4) { ng->tiles.resize(pixelCount / 2); - for (int i = 0; i < m_pixels.size(); ++i) { + for (int i = 0; i < pixelCount; ++i) { if (i & 1) { ng->tiles[i / 2] |= static_cast(m_pixels[i]) << 4; } else { @@ -391,6 +391,7 @@ void SheetData::updateRows(int rows) { } void SheetData::updatePixels(const NostalgiaGraphic *ng) { + m_pixels.clear(); if (ng->bpp == 8) { for (std::size_t i = 0; i < ng->tiles.size(); i++) { m_pixels.push_back(ng->tiles[i]);