LibWeb: Use nearest-neighbor scaling for ScalingMode::SmoothPixels

Adjust the translation from Gfx::ScalingMode to Skia SkFilterMode, so
that CSS::ImageRendering::Pixelated will result in
SkFilterMode::kNearest.

Before:
ScalingMode::SmoothPixels -> kLinear

After:
ScalingMode::SmoothPixels -> kNearest

Fixes #1170
This commit is contained in:
simonkrauter 2024-08-27 20:43:22 -03:00 committed by Jelle Raaijmakers
parent 5352b0db58
commit 820676857a
Notes: github-actions[bot] 2024-08-28 17:31:43 +00:00

View file

@ -317,9 +317,9 @@ static SkSamplingOptions to_skia_sampling_options(Gfx::ScalingMode scaling_mode)
{
switch (scaling_mode) {
case Gfx::ScalingMode::NearestNeighbor:
case Gfx::ScalingMode::SmoothPixels:
return SkSamplingOptions(SkFilterMode::kNearest);
case Gfx::ScalingMode::BilinearBlend:
case Gfx::ScalingMode::SmoothPixels:
return SkSamplingOptions(SkFilterMode::kLinear);
case Gfx::ScalingMode::BoxSampling:
return SkSamplingOptions(SkCubicResampler::Mitchell());