1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:37:46 +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

@ -82,10 +82,10 @@ void BucketTool::on_mousedown(Layer* layer, MouseEvent& event)
if (!layer->rect().contains(layer_event.position()))
return;
GUI::Painter painter(layer->bitmap());
auto target_color = layer->bitmap().get_pixel(layer_event.x(), layer_event.y());
GUI::Painter painter(layer->content_bitmap());
auto target_color = layer->content_bitmap().get_pixel(layer_event.x(), layer_event.y());
flood_fill(layer->bitmap(), layer_event.position(), target_color, m_editor->color_for(layer_event), m_threshold);
flood_fill(layer->content_bitmap(), layer_event.position(), target_color, m_editor->color_for(layer_event), m_threshold);
layer->did_modify_bitmap();
m_editor->did_complete_action();