mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:17:44 +00:00
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:
parent
3cc074c1b0
commit
6ceb185865
1 changed files with 2 additions and 2 deletions
|
@ -237,7 +237,7 @@ public:
|
||||||
#endif
|
#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))
|
if (alpha() == other.alpha() || with_alpha(0) == other.with_alpha(0))
|
||||||
return interpolate(other, weight);
|
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 {
|
return Gfx::Color {
|
||||||
round_to<u8>(mix<float>(red(), other.red(), weight)),
|
round_to<u8>(mix<float>(red(), other.red(), weight)),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue