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. :^) :^)
This commit is contained in:
Karol Kosek 2022-06-05 18:21:44 +02:00 committed by Sam Atkins
parent 3d7838c5fb
commit ab6288fd3d

View file

@ -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();
}