1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:07:44 +00:00

LibGfx: Make Color use east-const

This commit is contained in:
Sam Atkins 2021-10-24 15:22:26 +01:00 committed by Andreas Kling
parent 40a0a995af
commit 639c913e58
2 changed files with 15 additions and 15 deletions

View file

@ -28,7 +28,7 @@ String Color::to_string_without_alpha() const
return String::formatted("#{:02x}{:02x}{:02x}", red(), green(), blue());
}
static Optional<Color> parse_rgb_color(const StringView& string)
static Optional<Color> parse_rgb_color(StringView const& string)
{
VERIFY(string.starts_with("rgb("));
VERIFY(string.ends_with(")"));
@ -49,7 +49,7 @@ static Optional<Color> parse_rgb_color(const StringView& string)
return Color(r, g, b);
}
static Optional<Color> parse_rgba_color(const StringView& string)
static Optional<Color> parse_rgba_color(StringView const& string)
{
VERIFY(string.starts_with("rgba("));
VERIFY(string.ends_with(")"));
@ -73,13 +73,13 @@ static Optional<Color> parse_rgba_color(const StringView& string)
return Color(r, g, b, a);
}
Optional<Color> Color::from_string(const StringView& string)
Optional<Color> Color::from_string(StringView const& string)
{
if (string.is_empty())
return {};
struct ColorAndWebName {
constexpr ColorAndWebName(RGBA32 c, const char* n)
constexpr ColorAndWebName(RGBA32 c, char const* n)
: color(c)
, name(n)
{
@ -313,7 +313,7 @@ Optional<Color> Color::from_string(const StringView& string)
}
bool IPC::encode(IPC::Encoder& encoder, const Color& color)
bool IPC::encode(IPC::Encoder& encoder, Color const& color)
{
encoder << color.value();
return true;
@ -328,7 +328,7 @@ bool IPC::decode(IPC::Decoder& decoder, Color& color)
return true;
}
void AK::Formatter<Gfx::Color>::format(FormatBuilder& builder, const Gfx::Color& value)
void AK::Formatter<Gfx::Color>::format(FormatBuilder& builder, Gfx::Color const& value)
{
Formatter<StringView>::format(builder, value.to_string());
}