1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:07:35 +00:00

PixelPaint: Make filters apply to a selection if one is present

This changes ImageProcessor to use the scratch bitmap of the layer which
will cause the changes to only be applied inside the active selection
(if there is one). This also updates the FilterPreviewWidget to show the
filter preview with active selection taken into account.
This commit is contained in:
Timothy Slater 2022-11-01 17:28:05 -05:00 committed by Ali Mohammad Pur
parent 6911c5545c
commit 75c359ef31
4 changed files with 25 additions and 3 deletions

View file

@ -16,7 +16,7 @@ FilterApplicationCommand::FilterApplicationCommand(NonnullRefPtr<Filter> filter,
void FilterApplicationCommand::execute()
{
m_filter->apply(m_target_layer->content_bitmap(), m_target_layer->content_bitmap());
m_filter->apply(m_target_layer->get_scratch_edited_bitmap(), m_target_layer->get_scratch_edited_bitmap());
m_filter->m_editor->gui_event_loop().deferred_invoke([strong_this = NonnullRefPtr(*this)]() {
// HACK: we can't tell strong_this to not be const
(*const_cast<NonnullRefPtr<Layer>*>(&strong_this->m_target_layer))->did_modify_bitmap(strong_this->m_target_layer->rect());