diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditormodel.cpp b/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditormodel.cpp index 15811e77..c16e51a8 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditormodel.cpp +++ b/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditormodel.cpp @@ -190,16 +190,16 @@ void TileSheetEditorModel::setActiveSubsheet(TileSheet::SubSheetIdx const&idx) n } void TileSheetEditorModel::fill(ox::Point const&pt, int palIdx) noexcept { - const auto &s = getSubSheet(m_img, m_activeSubsSheetIdx); + auto const&activeSubSheet = getSubSheet(m_img, m_activeSubsSheetIdx); // build idx list - ox::Array updateMap = {}; - const auto oldColor = getPixel(s, m_img.bpp, pt); - if (pt.x >= s.columns * TileWidth || pt.y >= s.rows * TileHeight) { + if (pt.x >= activeSubSheet.columns * TileWidth || pt.y >= activeSubSheet.rows * TileHeight) { return; } + ox::Array updateMap = {}; + auto const oldColor = getPixel(activeSubSheet, m_img.bpp, pt); getFillPixels(updateMap, pt, oldColor); ox::Vector idxList; - auto i = core::idx(s, pt) / PixelsPerTile * PixelsPerTile; + auto i = core::idx(activeSubSheet, pt) / PixelsPerTile * PixelsPerTile; for (auto u : updateMap) { if (u) { idxList.emplace_back(i); @@ -209,7 +209,7 @@ void TileSheetEditorModel::fill(ox::Point const&pt, int palIdx) noexcept { // do updates to sheet if (m_ongoingDrawCommand) { m_updated = m_updated || m_ongoingDrawCommand->append(idxList); - } else if (getPixel(s, m_img.bpp, pt) != palIdx) { + } else if (getPixel(activeSubSheet, m_img.bpp, pt) != palIdx) { pushCommand(ox::make(m_img, m_activeSubsSheetIdx, idxList, palIdx)); } }