From 0a120e239a59c6ba9512f713b384b5f44825d5fa Mon Sep 17 00:00:00 2001 From: Torstennator Date: Tue, 23 May 2023 08:49:22 +0200 Subject: [PATCH] PixelPaint: Remove todo from LevelDialog This patch removes a todo where the revert for any changes could be optimized. Previously every single pixel was copied back from the reference bitmap to the content bitmap. Now the editors content bitmap is just replaced with the reference bitmap that is a copy of the unchanged content bitmap. --- Userland/Applications/PixelPaint/LevelsDialog.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Userland/Applications/PixelPaint/LevelsDialog.cpp b/Userland/Applications/PixelPaint/LevelsDialog.cpp index bdcbd09da9..bf3feab082 100644 --- a/Userland/Applications/PixelPaint/LevelsDialog.cpp +++ b/Userland/Applications/PixelPaint/LevelsDialog.cpp @@ -71,16 +71,10 @@ LevelsDialog::LevelsDialog(GUI::Window* parent_window, ImageEditor* editor) void LevelsDialog::revert_possible_changes() { - // FIXME: Find a faster way to revert all the changes that we have done. if (m_did_change && m_reference_bitmap) { - for (int x = 0; x < m_reference_bitmap->width(); x++) { - for (int y = 0; y < m_reference_bitmap->height(); y++) { - m_editor->active_layer()->content_bitmap().set_pixel(x, y, m_reference_bitmap->get_pixel(x, y)); - } - } + MUST(m_editor->active_layer()->set_bitmaps(m_reference_bitmap.release_nonnull(), m_editor->active_layer()->mask_bitmap())); m_editor->layers_did_change(); } - cleanup_resources(); }