Add pixel test for image-path misalignment

Adds a pixel test that demonstrates misalignment between images and
paths with the same (fractional) coordinates. When coordinates do not
align exactly with pixels, PDFium uses different rounding logic for
these two cases, resulting in visually perceptible errors.

Both AGG and Skia backends currently get this wrong; the expected image
was generated by using a green rectangle in place of the green image in
the test file. When fixing this test, it's not important to match the
expected image exactly, just that the result is consistent between
images and paths.

Bug: pdfium:1973
Change-Id: Idff84fd7d76a1cfb01ca0aa25531e6255b54aea2
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/103213
Auto-Submit: K. Moon <kmoon@chromium.org>
Reviewed-by: Nigi <nigi@chromium.org>
Commit-Queue: Nigi <nigi@chromium.org>
diff --git a/testing/SUPPRESSIONS b/testing/SUPPRESSIONS
index 25f9042..3745c95 100644
--- a/testing/SUPPRESSIONS
+++ b/testing/SUPPRESSIONS
@@ -502,6 +502,9 @@
 # TODO(pdfium:1963): Remove after associated bug is fixed
 bug_1963.in * * * skia
 
+# TODO(pdfium:1973): Remove after associated bug is fixed
+bug_1973.in * * * agg,skia
+
 # TODO(chromium:237527): Remove after associated bug is fixed
 bug_237527_1.in * * * *
 
@@ -514,7 +517,7 @@
 # TODO(chromium:725555, skia:9265): Remove after associated bug is fixed
 bug_725555.in * * * skia
 
-# TODO(pdfium:983289): Remove after associated bug is fixed
+# TODO(chromium:983289): Remove after associated bug is fixed
 bug_983289.in * * * agg
 
 # TODO(chromium:1028991): Remove after associated bug is fixed
diff --git a/testing/resources/pixel/bug_1973.in b/testing/resources/pixel/bug_1973.in
new file mode 100644
index 0000000..1d5602d
--- /dev/null
+++ b/testing/resources/pixel/bug_1973.in
@@ -0,0 +1,81 @@
+{{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 [ 240 570 345 650 ]
+  /Resources <<
+    /XObject <<
+      /Img 5 0 R
+    >>
+  >>
+>>
+endobj
+
+% Content stream matching coordinates in form_button0.pdf.
+{{object 4 0}} <<
+  {{streamlen}}
+>>
+stream
+q
+  89.555968 0 0 67.166976 247.7222 576.8333 cm
+  q
+    1 0 0 rg
+    0 0 1 1 re
+    f
+  Q
+  /Img Do
+Q
+endstream
+endobj
+
+% A 1024x768 image with a single (0x00), indexed color (0x00FF00).
+{{object 5 0}} <<
+  /Type /XObject
+  /Subtype /Image
+  /BitsPerComponent 8
+  /ColorSpace [ /Indexed /DeviceRGB 0 <00FF00> ]
+  /Filter [ /ASCIIHexDecode /FlateDecode ]
+  /Height 768
+  /Width 1024
+  {{streamlen}}
+>>
+stream
+78DAEDC13101000000C2A0F54F6D067FA00000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000003E0300B40001
+endstream
+endobj
+
+{{xref}}
+{{trailer}}
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/bug_1973_expected.pdf.0.png b/testing/resources/pixel/bug_1973_expected.pdf.0.png
new file mode 100644
index 0000000..8d75b62
--- /dev/null
+++ b/testing/resources/pixel/bug_1973_expected.pdf.0.png
Binary files differ