From 7d29262b8bbabd43b45b296df0e6f4af1b36d562 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Thu, 30 Mar 2023 14:48:34 +0100 Subject: [PATCH] LibWeb: Move to_gfx_scaling_mode() helper There's no longer any reason to have this in StyleValue.h --- Userland/Libraries/LibWeb/CSS/ComputedValues.h | 16 ++++++++++++++++ Userland/Libraries/LibWeb/CSS/StyleValue.h | 16 ---------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Userland/Libraries/LibWeb/CSS/ComputedValues.h b/Userland/Libraries/LibWeb/CSS/ComputedValues.h index bf5abfc1f3..48bb3e206d 100644 --- a/Userland/Libraries/LibWeb/CSS/ComputedValues.h +++ b/Userland/Libraries/LibWeb/CSS/ComputedValues.h @@ -160,6 +160,22 @@ struct BorderRadiusData { CSS::LengthPercentage vertical_radius { InitialValues::border_radius() }; }; +// FIXME: Find a better place for this helper. +inline Gfx::Painter::ScalingMode to_gfx_scaling_mode(CSS::ImageRendering css_value) +{ + switch (css_value) { + case CSS::ImageRendering::Auto: + case CSS::ImageRendering::HighQuality: + case CSS::ImageRendering::Smooth: + return Gfx::Painter::ScalingMode::BilinearBlend; + case CSS::ImageRendering::CrispEdges: + return Gfx::Painter::ScalingMode::NearestNeighbor; + case CSS::ImageRendering::Pixelated: + return Gfx::Painter::ScalingMode::SmoothPixels; + } + VERIFY_NOT_REACHED(); +} + class ComputedValues { public: CSS::Float float_() const { return m_noninherited.float_; } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValue.h index 86d140907e..546882aabf 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.h @@ -36,22 +36,6 @@ namespace Web::CSS { -// FIXME: Find a better place for this helper. -inline Gfx::Painter::ScalingMode to_gfx_scaling_mode(CSS::ImageRendering css_value) -{ - switch (css_value) { - case CSS::ImageRendering::Auto: - case CSS::ImageRendering::HighQuality: - case CSS::ImageRendering::Smooth: - return Gfx::Painter::ScalingMode::BilinearBlend; - case CSS::ImageRendering::CrispEdges: - return Gfx::Painter::ScalingMode::NearestNeighbor; - case CSS::ImageRendering::Pixelated: - return Gfx::Painter::ScalingMode::SmoothPixels; - } - VERIFY_NOT_REACHED(); -} - template struct ValueComparingNonnullRefPtr : public NonnullRefPtr { using NonnullRefPtr::NonnullRefPtr;