summaryrefslogtreecommitdiff
path: root/Userland/Applications/PixelPaint
diff options
context:
space:
mode:
authorTobias Christiansen <tobyase@serenityos.org>2022-03-07 22:37:26 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-08 22:07:12 +0100
commitf972f8e7a81b00261a773143f6205a3f1abc0c9e (patch)
treef224a84f364eb02aab97a9a62f32220018b0954c /Userland/Applications/PixelPaint
parent96829565d81af9cd7490c1bcb21a974610536af5 (diff)
downloadserenity-f972f8e7a81b00261a773143f6205a3f1abc0c9e.zip
PixelPaint: Use the currently_edited_bitmap in the Tools
This way, you can actually edit the mask of a Layer!
Diffstat (limited to 'Userland/Applications/PixelPaint')
-rw-r--r--Userland/Applications/PixelPaint/Tools/BrushTool.cpp6
-rw-r--r--Userland/Applications/PixelPaint/Tools/BucketTool.cpp6
-rw-r--r--Userland/Applications/PixelPaint/Tools/EllipseTool.cpp2
-rw-r--r--Userland/Applications/PixelPaint/Tools/LineTool.cpp2
-rw-r--r--Userland/Applications/PixelPaint/Tools/PickerTool.cpp2
-rw-r--r--Userland/Applications/PixelPaint/Tools/RectangleTool.cpp2
-rw-r--r--Userland/Applications/PixelPaint/Tools/SprayTool.cpp2
7 files changed, 11 insertions, 11 deletions
diff --git a/Userland/Applications/PixelPaint/Tools/BrushTool.cpp b/Userland/Applications/PixelPaint/Tools/BrushTool.cpp
index 508cd4fd17..aa809795d1 100644
--- a/Userland/Applications/PixelPaint/Tools/BrushTool.cpp
+++ b/Userland/Applications/PixelPaint/Tools/BrushTool.cpp
@@ -29,7 +29,7 @@ void BrushTool::on_mousedown(Layer* layer, MouseEvent& event)
// Shift+Click draws a line from the last position to current one.
if (layer_event.shift() && m_has_clicked) {
- draw_line(layer->content_bitmap(), color_for(layer_event), m_last_position, layer_event.position());
+ draw_line(layer->currently_edited_bitmap(), color_for(layer_event), m_last_position, layer_event.position());
auto modified_rect = Gfx::IntRect::from_two_points(m_last_position, layer_event.position()).inflated(m_size * 2, m_size * 2);
layer->did_modify_bitmap(modified_rect);
m_last_position = layer_event.position();
@@ -39,7 +39,7 @@ void BrushTool::on_mousedown(Layer* layer, MouseEvent& event)
const int first_draw_opacity = 10;
for (int i = 0; i < first_draw_opacity; ++i)
- draw_point(layer->content_bitmap(), color_for(layer_event), layer_event.position());
+ draw_point(layer->currently_edited_bitmap(), color_for(layer_event), layer_event.position());
layer->did_modify_bitmap(Gfx::IntRect::centered_on(layer_event.position(), Gfx::IntSize { m_size * 2, m_size * 2 }));
m_last_position = layer_event.position();
@@ -55,7 +55,7 @@ void BrushTool::on_mousemove(Layer* layer, MouseEvent& event)
if (!(layer_event.buttons() & GUI::MouseButton::Primary || layer_event.buttons() & GUI::MouseButton::Secondary))
return;
- draw_line(layer->content_bitmap(), color_for(layer_event), m_last_position, layer_event.position());
+ draw_line(layer->currently_edited_bitmap(), color_for(layer_event), m_last_position, layer_event.position());
auto modified_rect = Gfx::IntRect::from_two_points(m_last_position, layer_event.position()).inflated(m_size * 2, m_size * 2);
diff --git a/Userland/Applications/PixelPaint/Tools/BucketTool.cpp b/Userland/Applications/PixelPaint/Tools/BucketTool.cpp
index 69155c723d..c733e3bb4b 100644
--- a/Userland/Applications/PixelPaint/Tools/BucketTool.cpp
+++ b/Userland/Applications/PixelPaint/Tools/BucketTool.cpp
@@ -82,10 +82,10 @@ void BucketTool::on_mousedown(Layer* layer, MouseEvent& event)
if (!layer->rect().contains(layer_event.position()))
return;
- GUI::Painter painter(layer->content_bitmap());
- auto target_color = layer->content_bitmap().get_pixel(layer_event.x(), layer_event.y());
+ GUI::Painter painter(layer->currently_edited_bitmap());
+ auto target_color = layer->currently_edited_bitmap().get_pixel(layer_event.x(), layer_event.y());
- flood_fill(layer->content_bitmap(), layer_event.position(), target_color, m_editor->color_for(layer_event), m_threshold);
+ flood_fill(layer->currently_edited_bitmap(), layer_event.position(), target_color, m_editor->color_for(layer_event), m_threshold);
layer->did_modify_bitmap();
m_editor->did_complete_action();
diff --git a/Userland/Applications/PixelPaint/Tools/EllipseTool.cpp b/Userland/Applications/PixelPaint/Tools/EllipseTool.cpp
index dd15973593..d4e6f8d31a 100644
--- a/Userland/Applications/PixelPaint/Tools/EllipseTool.cpp
+++ b/Userland/Applications/PixelPaint/Tools/EllipseTool.cpp
@@ -67,7 +67,7 @@ void EllipseTool::on_mouseup(Layer* layer, MouseEvent& event)
return;
if (event.layer_event().button() == m_drawing_button) {
- GUI::Painter painter(layer->content_bitmap());
+ GUI::Painter painter(layer->currently_edited_bitmap());
draw_using(painter, m_ellipse_start_position, m_ellipse_end_position, m_thickness);
m_drawing_button = GUI::MouseButton::None;
layer->did_modify_bitmap();
diff --git a/Userland/Applications/PixelPaint/Tools/LineTool.cpp b/Userland/Applications/PixelPaint/Tools/LineTool.cpp
index 65dd442a46..276414cab9 100644
--- a/Userland/Applications/PixelPaint/Tools/LineTool.cpp
+++ b/Userland/Applications/PixelPaint/Tools/LineTool.cpp
@@ -60,7 +60,7 @@ void LineTool::on_mouseup(Layer* layer, MouseEvent& event)
auto& layer_event = event.layer_event();
if (layer_event.button() == m_drawing_button) {
- GUI::Painter painter(layer->content_bitmap());
+ GUI::Painter painter(layer->currently_edited_bitmap());
painter.draw_line(m_line_start_position, m_line_end_position, m_editor->color_for(m_drawing_button), m_thickness);
m_drawing_button = GUI::MouseButton::None;
layer->did_modify_bitmap();
diff --git a/Userland/Applications/PixelPaint/Tools/PickerTool.cpp b/Userland/Applications/PixelPaint/Tools/PickerTool.cpp
index 08b4309e75..4de38c0afc 100644
--- a/Userland/Applications/PixelPaint/Tools/PickerTool.cpp
+++ b/Userland/Applications/PixelPaint/Tools/PickerTool.cpp
@@ -24,7 +24,7 @@ void PickerTool::on_mousedown(Layer* layer, MouseEvent& event)
} else {
if (!layer || !layer->rect().contains(position))
return;
- color = layer->content_bitmap().get_pixel(position);
+ color = layer->currently_edited_bitmap().get_pixel(position);
}
// We picked a transparent pixel, do nothing.
diff --git a/Userland/Applications/PixelPaint/Tools/RectangleTool.cpp b/Userland/Applications/PixelPaint/Tools/RectangleTool.cpp
index 3e01c10ee8..03f5ea9b10 100644
--- a/Userland/Applications/PixelPaint/Tools/RectangleTool.cpp
+++ b/Userland/Applications/PixelPaint/Tools/RectangleTool.cpp
@@ -70,7 +70,7 @@ void RectangleTool::on_mouseup(Layer* layer, MouseEvent& event)
return;
if (event.layer_event().button() == m_drawing_button) {
- GUI::Painter painter(layer->content_bitmap());
+ GUI::Painter painter(layer->currently_edited_bitmap());
draw_using(painter, m_rectangle_start_position, m_rectangle_end_position, m_thickness);
m_drawing_button = GUI::MouseButton::None;
layer->did_modify_bitmap();
diff --git a/Userland/Applications/PixelPaint/Tools/SprayTool.cpp b/Userland/Applications/PixelPaint/Tools/SprayTool.cpp
index f21bb79d28..529798cddf 100644
--- a/Userland/Applications/PixelPaint/Tools/SprayTool.cpp
+++ b/Userland/Applications/PixelPaint/Tools/SprayTool.cpp
@@ -40,7 +40,7 @@ void SprayTool::paint_it()
if (!layer)
return;
- auto& bitmap = layer->content_bitmap();
+ auto& bitmap = layer->currently_edited_bitmap();
GUI::Painter painter(bitmap);
VERIFY(bitmap.bpp() == 32);
const double minimal_radius = 2;