mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:27:45 +00:00
LibGfx: Fix const-correctness issues
This commit is contained in:
parent
38b6eedd54
commit
bfe081caad
9 changed files with 16 additions and 13 deletions
|
@ -42,7 +42,7 @@ private:
|
||||||
u8* m_data;
|
u8* m_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
static ByteBuffer write_pixel_data(RefPtr<Bitmap> const bitmap, int pixel_row_data_size, int bytes_per_pixel, bool include_alpha_channel)
|
static ByteBuffer write_pixel_data(RefPtr<Bitmap const> bitmap, int pixel_row_data_size, int bytes_per_pixel, bool include_alpha_channel)
|
||||||
{
|
{
|
||||||
int image_size = pixel_row_data_size * bitmap->height();
|
int image_size = pixel_row_data_size * bitmap->height();
|
||||||
auto buffer_result = ByteBuffer::create_uninitialized(image_size);
|
auto buffer_result = ByteBuffer::create_uninitialized(image_size);
|
||||||
|
@ -78,7 +78,7 @@ static ByteBuffer compress_pixel_data(ByteBuffer const& pixel_data, BMPWriter::C
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteBuffer BMPWriter::dump(RefPtr<Bitmap> const bitmap, DibHeader dib_header)
|
ByteBuffer BMPWriter::dump(RefPtr<Bitmap const> bitmap, DibHeader dib_header)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (dib_header) {
|
switch (dib_header) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
V4 = 108,
|
V4 = 108,
|
||||||
};
|
};
|
||||||
|
|
||||||
ByteBuffer dump(RefPtr<Bitmap> const, DibHeader dib_header = DibHeader::V4);
|
ByteBuffer dump(RefPtr<Bitmap const>, DibHeader dib_header = DibHeader::V4);
|
||||||
|
|
||||||
inline void set_compression(Compression compression) { m_compression = compression; }
|
inline void set_compression(Compression compression) { m_compression = compression; }
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2023, Andreas Kling <kling@serenityos.org>
|
||||||
* Copyright (c) 2022, Timothy Slater <tslater2006@gmail.com>
|
* Copyright (c) 2022, Timothy Slater <tslater2006@gmail.com>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2023, Andreas Kling <kling@serenityos.org>
|
||||||
* Copyright (c) 2022, Timothy Slater <tslater2006@gmail.com>
|
* Copyright (c) 2022, Timothy Slater <tslater2006@gmail.com>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Stephan Unverwerth <s.unverwerth@serenityos.org>
|
* Copyright (c) 2020, Stephan Unverwerth <s.unverwerth@serenityos.org>
|
||||||
|
* Copyright (c) 2023, Andreas Kling <kling@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -202,7 +203,7 @@ public:
|
||||||
Font const& bold_variant() const;
|
Font const& bold_variant() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable RefPtr<Gfx::Font> m_bold_variant;
|
mutable RefPtr<Gfx::Font const> m_bold_variant;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, the SerenityOS developers.
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
|
* Copyright (c) 2023, Andreas Kling <kling@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -33,7 +34,7 @@ public:
|
||||||
|
|
||||||
// ^Gfx::Font
|
// ^Gfx::Font
|
||||||
virtual NonnullRefPtr<Font> clone() const override { return MUST(try_clone()); } // FIXME: clone() should not need to be implemented
|
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 u8 presentation_size() const override { return m_point_height; }
|
||||||
virtual float pixel_size() const override { return m_point_height * 1.33333333f; }
|
virtual float pixel_size() const override { return m_point_height * 1.33333333f; }
|
||||||
virtual Gfx::FontPixelMetrics pixel_metrics() const override;
|
virtual Gfx::FontPixelMetrics pixel_metrics() const override;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, the SerenityOS developers.
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
|
* Copyright (c) 2023, Andreas Kling <kling@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* 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(); }
|
virtual bool is_fixed_width() const override { return m_input_font->is_fixed_width(); }
|
||||||
|
|
||||||
private:
|
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_buffer(move(input_font_buffer))
|
||||||
, m_input_font(move(input_font))
|
, m_input_font(move(input_font))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteBuffer m_input_font_buffer;
|
ByteBuffer m_input_font_buffer;
|
||||||
NonnullRefPtr<Gfx::VectorFont> m_input_font;
|
NonnullRefPtr<Gfx::VectorFont const> m_input_font;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2023, Andreas Kling <kling@serenityos.org>
|
||||||
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
|
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
|
||||||
* Copyright (c) 2022, Filiph Sandström <filiph.sandstrom@filfatstudios.com>
|
* Copyright (c) 2022, Filiph Sandström <filiph.sandstrom@filfatstudios.com>
|
||||||
*
|
*
|
||||||
|
@ -22,7 +22,7 @@ PaletteImpl::PaletteImpl(Core::AnonymousBuffer buffer)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Palette::Palette(PaletteImpl const& impl)
|
Palette::Palette(PaletteImpl& impl)
|
||||||
: m_impl(impl)
|
: m_impl(impl)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2023, Andreas Kling <kling@serenityos.org>
|
||||||
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
|
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
|
||||||
* Copyright (c) 2022, Filiph Sandström <filiph.sandstrom@filfatstudios.com>
|
* Copyright (c) 2022, Filiph Sandström <filiph.sandstrom@filfatstudios.com>
|
||||||
*
|
*
|
||||||
|
@ -59,7 +59,7 @@ private:
|
||||||
class Palette {
|
class Palette {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Palette(PaletteImpl const&);
|
explicit Palette(PaletteImpl&);
|
||||||
~Palette() = default;
|
~Palette() = default;
|
||||||
|
|
||||||
Color accent() const { return color(ColorRole::Accent); }
|
Color accent() const { return color(ColorRole::Accent); }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue