Add test for masked image clipping issue

Adds a minimal test case demonstrating Skia-specific rendering issues
with clipping and masked images. The clip is popped by the "Q" operator,
and should not affect the subsequent image display operation, but does
on Skia.

Bug: pdfium:1845
Change-Id: Ic17b720342e5f7c8dee78012a441277348f035e9
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/102211
Reviewed-by: Nigi <nigi@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Auto-Submit: K. Moon <kmoon@chromium.org>
diff --git a/testing/SUPPRESSIONS b/testing/SUPPRESSIONS
index 0b367a7..43927c0 100644
--- a/testing/SUPPRESSIONS
+++ b/testing/SUPPRESSIONS
@@ -452,6 +452,9 @@
 # TODO(pdfium:1723): Remove after associated bug is fixed
 bug_1723.in * * * *
 
+# TODO(pdfium:1845): Remove after associated bug is fixed
+bug_1845.in * * * skia
+
 # TODO(pdfium:1846): Remove after associated bug is fixed
 bug_1846.in * * * agg
 
diff --git a/testing/resources/pixel/bug_1845.in b/testing/resources/pixel/bug_1845.in
new file mode 100644
index 0000000..9fd8052
--- /dev/null
+++ b/testing/resources/pixel/bug_1845.in
@@ -0,0 +1,80 @@
+{{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
+
+% Cross formed by red horizontal rectangle overlaid with blue vertical
+% rectangle.
+{{object 4 0}} <<
+  {{streamlen}}
+>>
+stream
+q
+  % Red horizontal rectangle defined by clip.
+  8 32 80 32 re W* n
+  1 0 0 rg
+  0 0 96 96 re f
+Q
+q
+  % Blue vertical rectangle defined by masked image.
+  32 0 0 80 32 8 cm
+  /X0 Do
+Q
+endstream
+endobj
+
+% Single pixel image with /SMask to trigger masked image rendering.
+{{object 5 0}} <<
+  /Type /XObject
+  /Subtype /Image
+  /Width 1
+  /Height 1
+  /ColorSpace /DeviceRGB
+  /BitsPerComponent 8
+  /SMask 6 0 R
+  /Filter /ASCIIHexDecode
+  {{streamlen}}
+>>
+stream
+00 00 FF
+endstream
+endobj
+{{object 6 0}} <<
+  /Type /XObject
+  /Subtype /Image
+  /Width 1
+  /Height 1
+  /ColorSpace /DeviceGray
+  /BitsPerComponent 8
+  /Filter /ASCIIHexDecode
+  {{streamlen}}
+>>
+stream
+80
+endstream
+endobj
+
+{{xref}}
+{{trailer}}
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/bug_1845_expected.pdf.0.png b/testing/resources/pixel/bug_1845_expected.pdf.0.png
new file mode 100644
index 0000000..b246272
--- /dev/null
+++ b/testing/resources/pixel/bug_1845_expected.pdf.0.png
Binary files differ