1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 02:45:07 +00:00

PixelPaint: Use UndoStack instead of History

This allows to share more code with other undo systems.
This commit is contained in:
BenJilks 2020-11-13 13:19:24 +00:00 committed by Andreas Kling
parent 7707ebcd63
commit a27d118085
7 changed files with 41 additions and 134 deletions

View file

@ -312,4 +312,20 @@ void Image::did_change()
client->image_did_change();
}
ImageUndoCommand::ImageUndoCommand(Image& image)
: m_snapshot(image.take_snapshot())
, m_image(image)
{
}
void ImageUndoCommand::undo()
{
m_image.restore_snapshot(*m_snapshot);
}
void ImageUndoCommand::redo()
{
undo();
}
}