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 <timledbetter@gmail.com>
This commit is contained in:
MacDue 2023-02-18 13:40:10 +00:00 committed by Jelle Raaijmakers
parent 3cc074c1b0
commit 6ceb185865
Notes: sideshowbarker 2024-07-17 00:07:09 +09:00

View File

@ -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<u8>(mix<float>(red(), other.red(), weight)),