diff options
-rw-r--r-- | Userland/Libraries/LibGfx/Gamma.h | 20 | ||||
-rw-r--r-- | Userland/Libraries/LibGfx/Painter.cpp | 4 |
2 files changed, 8 insertions, 16 deletions
diff --git a/Userland/Libraries/LibGfx/Gamma.h b/Userland/Libraries/LibGfx/Gamma.h index 9f0bfaacfe..04bc7dfa6c 100644 --- a/Userland/Libraries/LibGfx/Gamma.h +++ b/Userland/Libraries/LibGfx/Gamma.h @@ -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 +} } diff --git a/Userland/Libraries/LibGfx/Painter.cpp b/Userland/Libraries/LibGfx/Painter.cpp index 30cf9e4fee..b5f06dd68a 100644 --- a/Userland/Libraries/LibGfx/Painter.cpp +++ b/Userland/Libraries/LibGfx/Painter.cpp @@ -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()) |