[nostalgia/core/studio] Fix unnecessary copies

This commit is contained in:
Gary Talent 2022-04-04 01:10:16 -05:00
parent a40c768872
commit f0cbcbbddf

View File

@ -3,7 +3,6 @@
*/ */
#include <ox/claw/read.hpp> #include <ox/claw/read.hpp>
#include <ox/claw/write.hpp>
#include <nostalgia/core/clipboard.hpp> #include <nostalgia/core/clipboard.hpp>
#include <nostalgia/core/media.hpp> #include <nostalgia/core/media.hpp>
@ -35,6 +34,7 @@ class TileSheetClipboard: public ClipboardObject<TileSheetClipboard> {
m_pixels.emplace_back(colorIdx, pt); m_pixels.emplace_back(colorIdx, pt);
} }
[[nodiscard]]
constexpr const ox::Vector<Pixel> &pixels() const noexcept { constexpr const ox::Vector<Pixel> &pixels() const noexcept {
return m_pixels; return m_pixels;
} }
@ -89,7 +89,7 @@ class DrawCommand: public studio::UndoCommand {
m_palIdx = palIdx; m_palIdx = palIdx;
} }
constexpr DrawCommand(TileSheet *img, const TileSheet::SubSheetIdx &subSheetIdx, ox::Vector<std::size_t> idxList, int palIdx) noexcept { constexpr DrawCommand(TileSheet *img, const TileSheet::SubSheetIdx &subSheetIdx, const ox::Vector<std::size_t> &idxList, int palIdx) noexcept {
m_img = img; m_img = img;
auto &subsheet = m_img->getSubSheet(subSheetIdx); auto &subsheet = m_img->getSubSheet(subSheetIdx);
m_subSheetIdx = subSheetIdx; m_subSheetIdx = subSheetIdx;
@ -115,7 +115,7 @@ class DrawCommand: public studio::UndoCommand {
return false; return false;
} }
constexpr auto append(ox::Vector<std::size_t> idxList) noexcept { constexpr auto append(const ox::Vector<std::size_t> &idxList) noexcept {
auto out = false; auto out = false;
for (auto idx : idxList) { for (auto idx : idxList) {
out = append(idx) || out; out = append(idx) || out;