summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-10-01 14:04:05 +0200
committerAndreas Kling <kling@serenityos.org>2022-10-02 21:14:02 +0200
commita494bd24f15c17eb9257fa2343640fa6a7433ed9 (patch)
tree360022ddccd49abcaa6a748be673bf9b0909b868
parent46a13c3d2ec7771ac533f88175c5e2bda1e1fffd (diff)
downloadserenity-a494bd24f15c17eb9257fa2343640fa6a7433ed9.zip
LibGfx: Add a way to get the Painter's current 2D translation
-rw-r--r--Userland/Libraries/LibGfx/Painter.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGfx/Painter.h b/Userland/Libraries/LibGfx/Painter.h
index ca52b455a4..3405d0befd 100644
--- a/Userland/Libraries/LibGfx/Painter.h
+++ b/Userland/Libraries/LibGfx/Painter.h
@@ -142,6 +142,8 @@ public:
void translate(int dx, int dy) { translate({ dx, dy }); }
void translate(IntPoint const& delta) { state().translation.translate_by(delta); }
+ IntPoint translation() const { return state().translation; }
+
Gfx::Bitmap* target() { return m_target.ptr(); }
void save() { m_state_stack.append(m_state_stack.last()); }
@@ -156,7 +158,6 @@ public:
int scale() const { return state().scale; }
protected:
- IntPoint translation() const { return state().translation; }
IntRect to_physical(IntRect const& r) const { return r.translated(translation()) * scale(); }
IntPoint to_physical(IntPoint const& p) const { return p.translated(translation()) * scale(); }
void set_physical_pixel_with_draw_op(u32& pixel, Color const&);