diff options
Diffstat (limited to 'Applications/PaintBrush/PickerTool.cpp')
-rw-r--r-- | Applications/PaintBrush/PickerTool.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Applications/PaintBrush/PickerTool.cpp b/Applications/PaintBrush/PickerTool.cpp index 7189c7d103..2994869dd8 100644 --- a/Applications/PaintBrush/PickerTool.cpp +++ b/Applications/PaintBrush/PickerTool.cpp @@ -25,8 +25,12 @@ */ #include "PickerTool.h" +#include "Layer.h" +#include "PaintableWidget.h" #include <LibGfx/Bitmap.h> +namespace PaintBrush { + PickerTool::PickerTool() { } @@ -35,14 +39,15 @@ PickerTool::~PickerTool() { } -void PickerTool::on_mousedown(GUI::MouseEvent& event) +void PickerTool::on_mousedown(Layer& layer, GUI::MouseEvent& event) { - ASSERT(m_widget); - if (!m_widget->bitmap().rect().contains(event.position())) + if (!layer.rect().contains(event.position())) return; - auto color = m_widget->bitmap().get_pixel(event.position()); + auto color = layer.bitmap().get_pixel(event.position()); if (event.button() == GUI::MouseButton::Left) - m_widget->set_primary_color(color); + PaintableWidget::the().set_primary_color(color); else if (event.button() == GUI::MouseButton::Right) - m_widget->set_secondary_color(color); + PaintableWidget::the().set_secondary_color(color); +} + } |