[nostalgia/core/studio] Fix index lookup for updating pixel color
This commit is contained in:
parent
01ad572499
commit
70022d5a96
@ -84,18 +84,16 @@ class UpdatePixelsCommand: public QUndoCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void redo() override {
|
void redo() override {
|
||||||
for (int i = 0; i < m_pixelUpdates.size(); i++) {
|
for (const auto &pu : m_pixelUpdates) {
|
||||||
const auto &pu = m_pixelUpdates[i];
|
|
||||||
pu.item->setProperty("color", m_palette[m_newColorId]);
|
pu.item->setProperty("color", m_palette[m_newColorId]);
|
||||||
m_pixels[i] = m_newColorId;
|
m_pixels[pu.item->property("pixelNumber").toInt()] = m_newColorId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void undo() override {
|
void undo() override {
|
||||||
for (int i = 0; i < m_pixelUpdates.size(); i++) {
|
for (const auto &pu : m_pixelUpdates) {
|
||||||
const auto &pu = m_pixelUpdates[i];
|
|
||||||
pu.item->setProperty("color", pu.oldColorId);
|
pu.item->setProperty("color", pu.oldColorId);
|
||||||
m_pixels[i] = pu.oldColorId;
|
m_pixels[pu.item->property("pixelNumber").toInt()] = pu.oldColorId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user