1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 14:47:46 +00:00

LibGfx: Fix const-correctness issues

This commit is contained in:
Andreas Kling 2023-02-20 19:03:29 +01:00
parent 38b6eedd54
commit bfe081caad
9 changed files with 16 additions and 13 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2020, Stephan Unverwerth <s.unverwerth@serenityos.org>
* Copyright (c) 2023, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -202,7 +203,7 @@ public:
Font const& bold_variant() const;
private:
mutable RefPtr<Gfx::Font> m_bold_variant;
mutable RefPtr<Gfx::Font const> m_bold_variant;
};
}

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2022, the SerenityOS developers.
* Copyright (c) 2023, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -33,7 +34,7 @@ public:
// ^Gfx::Font
virtual NonnullRefPtr<Font> clone() const override { return MUST(try_clone()); } // FIXME: clone() should not need to be implemented
virtual ErrorOr<NonnullRefPtr<Font>> try_clone() const override { return *this; }
virtual ErrorOr<NonnullRefPtr<Font>> try_clone() const override { return const_cast<ScaledFont&>(*this); }
virtual u8 presentation_size() const override { return m_point_height; }
virtual float pixel_size() const override { return m_point_height * 1.33333333f; }
virtual Gfx::FontPixelMetrics pixel_metrics() const override;

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2022, the SerenityOS developers.
* Copyright (c) 2023, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -38,14 +39,14 @@ public:
virtual bool is_fixed_width() const override { return m_input_font->is_fixed_width(); }
private:
Font(NonnullRefPtr<Gfx::VectorFont> input_font, ByteBuffer input_font_buffer)
Font(NonnullRefPtr<Gfx::VectorFont const> input_font, ByteBuffer input_font_buffer)
: m_input_font_buffer(move(input_font_buffer))
, m_input_font(move(input_font))
{
}
ByteBuffer m_input_font_buffer;
NonnullRefPtr<Gfx::VectorFont> m_input_font;
NonnullRefPtr<Gfx::VectorFont const> m_input_font;
};
}