From ab6288fd3d87ee5979f959daca1141bc2b76f6ef Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Sun, 5 Jun 2022 18:21:44 +0200 Subject: [PATCH] LibWeb: Use SmoothPixels scaling mode as the pixelated rendering It's probably not in 1:1 as spec says, as it wants us to first upscale the image to the nearest integer and then downscale it bilinearly. But this mode still falls into the general description of the value: > The image is scaled in a way that preserves the pixelated nature of > the original as much as possible, but allows minor smoothing instead > of awkward distortion when necessary. Also, this way we don't have to allocate the memory just for the integer scale. :^) :^) --- Userland/Libraries/LibWeb/CSS/StyleValue.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValue.h index be50c97dba..d6eb02855b 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.h @@ -67,8 +67,9 @@ inline Gfx::Painter::ScalingMode to_gfx_scaling_mode(CSS::ImageRendering css_val case CSS::ImageRendering::Smooth: return Gfx::Painter::ScalingMode::BilinearBlend; case CSS::ImageRendering::CrispEdges: - case CSS::ImageRendering::Pixelated: return Gfx::Painter::ScalingMode::NearestNeighbor; + case CSS::ImageRendering::Pixelated: + return Gfx::Painter::ScalingMode::SmoothPixels; } VERIFY_NOT_REACHED(); }