From 0c955645339e6f3fac053f8bec1f2a4b680ffb14 Mon Sep 17 00:00:00 2001 From: Torstennator Date: Tue, 23 May 2023 10:27:00 +0200 Subject: [PATCH] PixelPaint: FilterGallery fix preview This patch fixes an issue where the preview for an filter was always based on the content bitmap even if the edit mode was set to Mask. Now the preview is using the content or mask bitmap based on the current edit mode and therefore generates the correct preview of what is going to be changed. --- Userland/Applications/PixelPaint/FilterGallery.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Userland/Applications/PixelPaint/FilterGallery.cpp b/Userland/Applications/PixelPaint/FilterGallery.cpp index 6a1eb84734..3920dab3b2 100644 --- a/Userland/Applications/PixelPaint/FilterGallery.cpp +++ b/Userland/Applications/PixelPaint/FilterGallery.cpp @@ -74,7 +74,14 @@ FilterGallery::FilterGallery(GUI::Window* parent_window, ImageEditor* editor) }; m_preview_widget->set_layer(editor->active_layer()); - m_preview_widget->set_bitmap(editor->active_layer()->content_bitmap().clone().release_value()); + switch (editor->active_layer()->edit_mode()) { + case Layer::EditMode::Content: + m_preview_widget->set_bitmap(editor->active_layer()->content_bitmap().clone().release_value()); + break; + case Layer::EditMode::Mask: + m_preview_widget->set_bitmap(editor->active_layer()->mask_bitmap()->clone().release_value()); + break; + } apply_button->on_click = [this](auto) { if (!m_selected_filter) {