diff --git a/Userland/Libraries/LibGfx/Color.cpp b/Userland/Libraries/LibGfx/Color.cpp index bed286acb1..75af331380 100644 --- a/Userland/Libraries/LibGfx/Color.cpp +++ b/Userland/Libraries/LibGfx/Color.cpp @@ -28,7 +28,7 @@ String Color::to_string_without_alpha() const return String::formatted("#{:02x}{:02x}{:02x}", red(), green(), blue()); } -static Optional parse_rgb_color(const StringView& string) +static Optional parse_rgb_color(StringView const& string) { VERIFY(string.starts_with("rgb(")); VERIFY(string.ends_with(")")); @@ -49,7 +49,7 @@ static Optional parse_rgb_color(const StringView& string) return Color(r, g, b); } -static Optional parse_rgba_color(const StringView& string) +static Optional parse_rgba_color(StringView const& string) { VERIFY(string.starts_with("rgba(")); VERIFY(string.ends_with(")")); @@ -73,13 +73,13 @@ static Optional parse_rgba_color(const StringView& string) return Color(r, g, b, a); } -Optional Color::from_string(const StringView& string) +Optional 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::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::format(FormatBuilder& builder, const Gfx::Color& value) +void AK::Formatter::format(FormatBuilder& builder, Gfx::Color const& value) { Formatter::format(builder, value.to_string()); } diff --git a/Userland/Libraries/LibGfx/Color.h b/Userland/Libraries/LibGfx/Color.h index 003e1d2324..cdd1262498 100644 --- a/Userland/Libraries/LibGfx/Color.h +++ b/Userland/Libraries/LibGfx/Color.h @@ -203,7 +203,7 @@ public: #endif } - Color interpolate(const Color& other, float weight) const noexcept + Color interpolate(Color const& other, float weight) const noexcept { u8 r = red() + roundf(static_cast(other.red() - red()) * weight); u8 g = green() + roundf(static_cast(other.green() - green()) * weight); @@ -212,7 +212,7 @@ public: return Color(r, g, b, a); } - constexpr Color multiply(const Color& other) const + constexpr Color multiply(Color const& other) const { return Color( red() * other.red() / 255, @@ -271,26 +271,26 @@ public: return Color(~red(), ~green(), ~blue(), alpha()); } - constexpr Color xored(const Color& other) const + constexpr Color xored(Color const& other) const { return Color(((other.m_value ^ m_value) & 0x00ffffff) | (m_value & 0xff000000)); } constexpr RGBA32 value() const { return m_value; } - constexpr bool operator==(const Color& other) const + constexpr bool operator==(Color const& other) const { return m_value == other.m_value; } - constexpr bool operator!=(const Color& other) const + constexpr bool operator!=(Color const& other) const { return m_value != other.m_value; } String to_string() const; String to_string_without_alpha() const; - static Optional from_string(const StringView&); + static Optional from_string(StringView const&); constexpr HSV to_hsv() const { @@ -333,7 +333,7 @@ public: return from_hsv({ hue, saturation, value }); } - static constexpr Color from_hsv(const HSV& hsv) + static constexpr Color from_hsv(HSV const& hsv) { VERIFY(hsv.hue >= 0.0 && hsv.hue < 360.0); VERIFY(hsv.saturation >= 0.0 && hsv.saturation <= 1.0); @@ -499,14 +499,14 @@ namespace AK { template<> struct Formatter : public Formatter { - void format(FormatBuilder& builder, const Gfx::Color& value); + void format(FormatBuilder& builder, Gfx::Color const& value); }; } namespace IPC { -bool encode(Encoder&, const Gfx::Color&); +bool encode(Encoder&, Gfx::Color const&); bool decode(Decoder&, Gfx::Color&); }