[Skia] Choose sampling options depending on the interpolate values
Currently Skia rendering process doesn't respect
`FXDIB_ResampleOptions` when drawing bitmap images. This CL makes sure
that if interpolate value from `FXDIB_ResampleOptions` is true for an
image project, the linear sampling options will be applied to render
the image smoother.
This change fixed multiple corpus tests and partially improved the Skia rendering result for 3_interpolate_image.pdf (pdfium:1790).
Bug: pdfium:1789, pdfium:1790, pdfium:1868
Change-Id: I320d61da9695cb9f574b29faa5444fcb12f42fd5
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/96790
Commit-Queue: Nigi <nigi@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/DEPS b/DEPS
index cf3d15d..906e786 100644
--- a/DEPS
+++ b/DEPS
@@ -122,7 +122,7 @@
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling pdfium_tests
# and whatever else without interference from each other.
- 'pdfium_tests_revision': '317dd8a84c65676c7ceb6c1dad0e54eaa0b71417',
+ 'pdfium_tests_revision': 'df57549d76bdd644427d463d0e5b8ec0fc3dd7be',
# Three lines of non-changing comments so that
# the commit queue can handle CLs rolling skia
# and whatever else without interference from each other.
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 1531be4..f26dc1c 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -2574,9 +2574,13 @@
}
}
} else {
+ SkSamplingOptions sampling_options =
+ options.bInterpolateBilinear
+ ? SkSamplingOptions(SkFilterMode::kLinear, SkMipmapMode::kLinear)
+ : SkSamplingOptions();
m_pCanvas->drawImageRect(skBitmap.asImage(),
- SkRect::MakeWH(width, height),
- SkSamplingOptions(), &paint);
+ SkRect::MakeWH(width, height), sampling_options,
+ &paint);
}
}
DebugValidate(m_pBitmap, m_pBackdropBitmap);
diff --git a/testing/SUPPRESSIONS b/testing/SUPPRESSIONS
index 8fbbd75..0a84379 100644
--- a/testing/SUPPRESSIONS
+++ b/testing/SUPPRESSIONS
@@ -50,9 +50,6 @@
3_4_textbox.pdf * * * *
-# TODO(pdfium:1789): Remove after associated bug is fixed
-3_image_imagemask.pdf * * * skia
-
# TODO(pdfium:1790): Remove after associated bug is fixed
3_interpolate_image.pdf * * * skia
@@ -198,9 +195,6 @@
# TODO(pdfium:1869): Remove after associated bug is fixed
bug_880920.pdf * * * skia
-# TODO(pdfium:1868): Remove after associated bug is fixed
-bug_898443.pdf * * * skia
-
bug_white_space.pdf mac * * *
calcorderindex_test.pdf * * * *
calculate_average.pdf mac * * *
@@ -379,9 +373,6 @@
# TODO(pdfium:1856): Remove after associated bug is fixed
image_bmp.pdf * * * skia
-# TODO(pdfium:1859): Remove after associated bug is fixed
-image_foxit.pdf * * * skia
-
# TODO(pdfium:1856): Remove after associated bug is fixed
image_gif.pdf * * * skia
diff --git a/testing/resources/pixel/xfa_specific/resolve_nodes_0_expected_skia.pdf.0.png b/testing/resources/pixel/xfa_specific/resolve_nodes_0_expected_skia.pdf.0.png
index 30f7709..e454dfd 100644
--- a/testing/resources/pixel/xfa_specific/resolve_nodes_0_expected_skia.pdf.0.png
+++ b/testing/resources/pixel/xfa_specific/resolve_nodes_0_expected_skia.pdf.0.png
Binary files differ