From 6ceb185865e242462c4f4ad310ec0c0a928c2f31 Mon Sep 17 00:00:00 2001 From: MacDue Date: Sat, 18 Feb 2023 13:40:10 +0000 Subject: [PATCH] LibGfx: Add `ALWAYS_INLINE` to Color::mixed_with()/interpolate() I can see small speedup of about 6-7% with this for some gradient painting, though Tim has been able to see an ~30% speedup in some resizing cases so this seems like a worthwhile change. Co-authored-by: Tim Ledbetter --- Userland/Libraries/LibGfx/Color.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibGfx/Color.h b/Userland/Libraries/LibGfx/Color.h index afa6a4873a..5d85f35692 100644 --- a/Userland/Libraries/LibGfx/Color.h +++ b/Userland/Libraries/LibGfx/Color.h @@ -237,7 +237,7 @@ public: #endif } - Color mixed_with(Color other, float weight) const + ALWAYS_INLINE Color mixed_with(Color other, float weight) const { if (alpha() == other.alpha() || with_alpha(0) == other.with_alpha(0)) return interpolate(other, weight); @@ -255,7 +255,7 @@ public: }; } - Color interpolate(Color other, float weight) const noexcept + ALWAYS_INLINE Color interpolate(Color other, float weight) const noexcept { return Gfx::Color { round_to(mix(red(), other.red(), weight)),