diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.cpp index 9b861873..7bc7fd0f 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.cpp @@ -9,20 +9,19 @@ namespace nostalgia::gfx { InsertTilesCommand::InsertTilesCommand( TileSheet &img, TileSheet::SubSheetIdx idx, - std::size_t tileIdx, - std::size_t tileCnt) noexcept: - m_img(img), - m_idx(std::move(idx)) { - const unsigned bytesPerTile = m_img.bpp == 4 ? PixelsPerTile / 2 : PixelsPerTile; - m_insertPos = tileIdx * bytesPerTile; - m_insertCnt = tileCnt * bytesPerTile; + std::size_t const tileIdx, + std::size_t const tileCnt) noexcept: + m_img{img}, + m_idx{std::move(idx)} { + m_insertPos = tileIdx * PixelsPerTile; + m_insertCnt = tileCnt * PixelsPerTile; m_deletedPixels.resize(m_insertCnt); // copy pixels to be erased { auto &s = getSubSheet(m_img, m_idx); auto &p = s.pixels; - auto dst = m_deletedPixels.begin(); - auto src = p.begin() + p.size() - m_insertCnt; + auto const dst = m_deletedPixels.begin(); + auto const src = p.begin() + p.size() - m_insertCnt; ox::copy_n(src, m_insertCnt, dst); } } @@ -32,7 +31,7 @@ OX_ALLOW_UNSAFE_BUFFERS_BEGIN ox::Error InsertTilesCommand::redo() noexcept { auto &s = getSubSheet(m_img, m_idx); auto &p = s.pixels; - auto dstPos = m_insertPos + m_insertCnt; + auto const dstPos = m_insertPos + m_insertCnt; auto const src = &p[m_insertPos]; if (dstPos < p.size()) { auto const dst = &p[dstPos];