Add pixel test for 8-bit image scaling

Adds a pixel test that covers 8-bit to 8-bit image scaling, such as when
a soft mask is scaled. The Skia renderer currently handles this case
poorly because it uses nearest neighbor scaling for 8-bit images.

Bug: pdfium:1976
Change-Id: I02816c90168bcdffb003c5ba581b4b54834015f6
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/103870
Commit-Queue: K. Moon <kmoon@chromium.org>
Reviewed-by: Nigi <nigi@chromium.org>
diff --git a/testing/SUPPRESSIONS b/testing/SUPPRESSIONS
index 0746c48..f5bb133 100644
--- a/testing/SUPPRESSIONS
+++ b/testing/SUPPRESSIONS
@@ -397,11 +397,14 @@
 # TODO(pdfium:1963): Remove after associated bug is fixed
 bug_1963.in * * * skia
 
+# TODO(pdfium:1968): Remove after associated bug is fixed
+bug_1966.in * * * skia
+
 # TODO(pdfium:1973): Remove after associated bug is fixed
 bug_1973.in * * * agg,skia
 
-# TODO(pdfium:1968): Remove after associated bug is fixed
-bug_1966.in * * * skia
+# TODO(pdfium:1976): Remove after associated bug is fixed
+bug_1976.in * * * skia
 
 # TODO(chromium:237527): Remove after associated bug is fixed
 bug_237527_1.in * * * *
diff --git a/testing/resources/pixel/bug_1976.in b/testing/resources/pixel/bug_1976.in
new file mode 100644
index 0000000..696f5da
--- /dev/null
+++ b/testing/resources/pixel/bug_1976.in
@@ -0,0 +1,83 @@
+{{header}}
+{{object 1 0}} <<
+  /Type /Catalog
+  /Pages 2 0 R
+>>
+endobj
+{{object 2 0}} <<
+  /Type /Pages
+  /Count 1
+  /Kids [3 0 R]
+>>
+endobj
+{{object 3 0}} <<
+  /Type /Page
+  /Parent 2 0 R
+  /Contents 4 0 R
+  /MediaBox [0 0 96 96]
+  /Resources <<
+    /XObject <<
+      /X0 5 0 R
+    >>
+  >>
+>>
+endobj
+
+% Green and red checkerboard. When scaled down, the green and red should blend
+% together into a darker yellow.
+{{object 4 0}} <<
+  {{streamlen}}
+>>
+stream
+q
+  % Solid green square.
+  0 1 0 rg
+  16 16 64 64 re f
+Q
+q
+  % Transparent and red checkerboard.
+  64 0 0 64 16 16 cm
+  /X0 Do
+Q
+endstream
+endobj
+
+% Single pixel image with /SMask to trigger masked image rendering.
+{{object 5 0}} <<
+  /Type /XObject
+  /Subtype /Image
+  /BitsPerComponent 8
+  /ColorSpace /DeviceRGB
+  /Filter /ASCIIHexDecode
+  /Height 1
+  /SMask 6 0 R
+  /Width 1
+  {{streamlen}}
+>>
+stream
+FF 00 00
+endstream
+endobj
+
+% Grayscale checkerboard to trigger 8-bit to 8-bit scaling. Scaling down by a
+% multiple of 2 using nearest neighbor gives particularly bad results.
+{{object 6 0}} <<
+  /Type /XObject
+  /Subtype /Image
+  /BitsPerComponent 8
+  /ColorSpace /DeviceGray
+  /Filter [/ASCII85Decode /FlateDecode]
+  /Height 128
+  /Width 128
+  {{streamlen}}
+>>
+stream
+GhVQ20b"*_#f&.lRiX?CBI7,$dqQl"iofLfkND$kkND$kkND$kkND$kkND$kkND$kkND$kkND$kkND$k
+kND$kkND$kkND$kkND$kkND$kkN@?Q?he3kdJ~>
+endstream
+endobj
+
+{{xref}}
+{{trailer}}
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/bug_1976_expected.pdf.0.png b/testing/resources/pixel/bug_1976_expected.pdf.0.png
new file mode 100644
index 0000000..59bfc84
--- /dev/null
+++ b/testing/resources/pixel/bug_1976_expected.pdf.0.png
Binary files differ