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.
This commit is contained in:
Torstennator 2023-05-23 10:27:00 +02:00 committed by Jelle Raaijmakers
parent d9d9103cbb
commit 0c95564533
Notes: sideshowbarker 2024-07-17 10:05:47 +09:00

View File

@ -74,7 +74,14 @@ FilterGallery::FilterGallery(GUI::Window* parent_window, ImageEditor* editor)
}; };
m_preview_widget->set_layer(editor->active_layer()); 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) { apply_button->on_click = [this](auto) {
if (!m_selected_filter) { if (!m_selected_filter) {