1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:57:45 +00:00

LibGfx: Remove ancient unused NO_FPU macros

This commit is contained in:
Andreas Kling 2021-08-18 11:03:57 +02:00
parent 0ed2a03450
commit 2432c5264b
2 changed files with 8 additions and 16 deletions

View file

@ -34,19 +34,17 @@ namespace Gfx {
using AK::SIMD::f32x4;
#ifndef NO_FPU
# ifdef __SSE__
#ifdef __SSE__
// Transform f32x4 from gamma2.2 space to linear space
// Assumes x is in range [0, 1]
// FIXME: Remove this hack once clang-11 is available as the default in Github Actions.
// This is apparently sometime mid-December. https://github.com/actions/virtual-environments/issues/2130
# if !defined(__clang__) || __clang_major__ >= 11
# if !defined(__clang__) || __clang_major__ >= 11
constexpr f32x4 gamma_to_linear4(f32x4 x)
# else
# else
inline f32x4 gamma_to_linear4(f32x4 x)
# endif
# endif
{
return (0.8f + 0.2f * x) * x * x;
}
@ -69,7 +67,7 @@ inline f32x4 gamma_accurate_lerp4(f32x4 v1, f32x4 v2, float mix)
return linear_to_gamma4(gamma_to_linear4(v1) * (1 - mix) + gamma_to_linear4(v2) * mix);
}
# endif
#endif
// Transform scalar from gamma2.2 space to linear space
// Assumes x is in range [0, 1]
@ -100,7 +98,7 @@ inline float gamma_accurate_lerp(float v1, float v2, float mix)
// The output is entirely a when mix = 0 and entirely b when mix = 1
inline Color gamma_accurate_blend(Color a, Color b, float mix)
{
# ifdef __SSE__
#ifdef __SSE__
f32x4 ac = {
(float)a.red(),
(float)a.green(),
@ -113,15 +111,13 @@ inline Color gamma_accurate_blend(Color a, Color b, float mix)
};
f32x4 out = 255.f * gamma_accurate_lerp4(ac * (1.f / 255.f), bc * (1.f / 255.f), mix);
return Color(out[0], out[1], out[2]);
# else
#else
return {
static_cast<u8>(255.f * gamma_accurate_lerp(a.red() / 255.f, b.red() / 255.f, mix)),
static_cast<u8>(255.f * gamma_accurate_lerp(a.green() / 255.f, b.green() / 255.f, mix)),
static_cast<u8>(255.f * gamma_accurate_lerp(a.blue() / 255.f, b.blue() / 255.f, mix)),
};
# endif
}
#endif
}
}

View file

@ -228,10 +228,6 @@ void Painter::fill_rect_with_gradient(Orientation orientation, const IntRect& a_
return;
}
#ifdef NO_FPU
return fill_rect(a_rect, gradient_start);
#endif
auto rect = to_physical(a_rect);
auto clipped_rect = IntRect::intersection(rect, clip_rect() * scale());
if (clipped_rect.is_empty())