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

PixelPaint: Split bitmap() of Layer into {content, display}_bitmap

This is in preparation to support masking of Layers. We now distinguish
between the "display_bitmap" which will be the whole Layer with every
effect applied and the "content_bitmap" which contains the actual
unmodified pixels in the Layer.
This commit is contained in:
Tobias Christiansen 2022-03-07 21:24:05 +01:00 committed by Andreas Kling
parent b6510f8e76
commit 31a9196bfe
14 changed files with 73 additions and 42 deletions

View file

@ -114,7 +114,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
auto image = PixelPaint::Image::try_create_with_size(dialog->image_size()).release_value_but_fixme_should_propagate_errors();
auto bg_layer = PixelPaint::Layer::try_create_with_size(*image, image->size(), "Background").release_value_but_fixme_should_propagate_errors();
image->add_layer(*bg_layer);
bg_layer->bitmap().fill(Color::White);
bg_layer->content_bitmap().fill(Color::White);
auto& editor = create_new_editor(*image);
auto image_title = dialog->image_name().trim_whitespace();
@ -630,7 +630,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
if (auto* layer = editor->active_layer()) {
Gfx::GenericConvolutionFilter<5> filter;
if (auto parameters = PixelPaint::FilterParameters<Gfx::GenericConvolutionFilter<5>>::get(&window)) {
filter.apply(layer->bitmap(), layer->rect(), layer->bitmap(), layer->rect(), *parameters);
filter.apply(layer->content_bitmap(), layer->rect(), layer->content_bitmap(), layer->rect(), *parameters);
layer->did_modify_bitmap(layer->rect());
editor->did_complete_action();
}
@ -735,7 +735,7 @@ void MainWidget::create_default_image()
auto bg_layer = Layer::try_create_with_size(*image, image->size(), "Background").release_value_but_fixme_should_propagate_errors();
image->add_layer(*bg_layer);
bg_layer->bitmap().fill(Color::White);
bg_layer->content_bitmap().fill(Color::White);
m_layer_list_widget->set_image(image);