diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-17 13:35:17 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-17 13:40:34 +0200 |
commit | 8c863ad9590da806b5367a27a346182a072d10da (patch) | |
tree | 16d0ff8f6a913bd34bae167e4a5dffa6e4f872de /Userland/Libraries/LibGfx | |
parent | 57260174146420129f2ff278f7c5b9315e7dc3bc (diff) | |
download | serenity-8c863ad9590da806b5367a27a346182a072d10da.zip |
LibGfx: Make Path::bounding_box() and Path::split_lines() const
Use a const_cast internally when segmentizing. As far as clients are
concerned, these are const operations.
Diffstat (limited to 'Userland/Libraries/LibGfx')
-rw-r--r-- | Userland/Libraries/LibGfx/Path.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibGfx/Path.h b/Userland/Libraries/LibGfx/Path.h index f5f3988a83..afda4d00f7 100644 --- a/Userland/Libraries/LibGfx/Path.h +++ b/Userland/Libraries/LibGfx/Path.h @@ -169,10 +169,10 @@ public: }; const NonnullRefPtrVector<Segment>& segments() const { return m_segments; } - const auto& split_lines() + auto& split_lines() const { if (!m_split_lines.has_value()) { - segmentize_path(); + const_cast<Path*>(this)->segmentize_path(); VERIFY(m_split_lines.has_value()); } return m_split_lines.value(); @@ -184,10 +184,10 @@ public: m_split_lines.clear(); } - const Gfx::FloatRect& bounding_box() + Gfx::FloatRect const& bounding_box() const { if (!m_bounding_box.has_value()) { - segmentize_path(); + const_cast<Path*>(this)->segmentize_path(); VERIFY(m_bounding_box.has_value()); } return m_bounding_box.value(); |