[SkiaPaths] Make MatrixChanged() indicate changes of all its elements.

MatrixChanged() only returns true when any of its elements |a|, |b|,
|c| or |d| changes. In pdfium:1402, the two adjacent characters'
CFX_Matrixes are only different in elements |e| or |f|, which leads to
MatrixChanged() returning false and SkiaPaths skipping rendering the
second character when cache printing is disabled. To fix this, make
MatrixChanged() return true when any of the elements in the matrix
changes.

Bug: pdfium:1402
Change-Id: I85ef5bb8d1752f083497c6a52f1b4acb180e84cd
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/61210
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Hui Yingst <nigi@chromium.org>
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index aae7a5d..f29022f 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -1179,11 +1179,7 @@
   }
 
   bool MatrixChanged(const CFX_Matrix* pMatrix) const {
-    CFX_Matrix identityMatrix;
-    if (!pMatrix)
-      pMatrix = &identityMatrix;
-    return pMatrix->a != m_drawMatrix.a || pMatrix->b != m_drawMatrix.b ||
-           pMatrix->c != m_drawMatrix.c || pMatrix->d != m_drawMatrix.d;
+    return pMatrix ? *pMatrix != m_drawMatrix : m_drawMatrix.IsIdentity();
   }
 
   bool StateChanged(const CFX_GraphStateData* pState,
diff --git a/testing/SUPPRESSIONS b/testing/SUPPRESSIONS
index 4dd10ef..b3059e9 100644
--- a/testing/SUPPRESSIONS
+++ b/testing/SUPPRESSIONS
@@ -331,6 +331,9 @@
 # TODO(pdfium:1331): Remove after associated bug is fixed
 bug_1331.in * * *
 
+# TODO(pdfium:1461): Remove after associated bug is fixed
+bug_1402.in win * *
+
 # TODO(pdfium:1457): Remove after associated bug is fixed
 bug_1457.in * * *
 
diff --git a/testing/resources/pixel/bug_1402.in b/testing/resources/pixel/bug_1402.in
new file mode 100644
index 0000000..c911e4f
--- /dev/null
+++ b/testing/resources/pixel/bug_1402.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
+  /Resources <<
+    /ProcSet [/PDF /Text]
+    /Font <<
+      /G2 4 0 R
+    >>
+  >>
+  /Contents [5 0 R]
+  /MediaBox [0 0 200 200]
+>>
+endobj
+{{object 4 0}} <<
+  /Type /Font
+  /Subtype /Type0
+  /BaseFont /HonMincho-M
+  /Encoding /90pv-RKSJ-H
+  /DescendantFonts [7 0 R]
+>>
+endobj
+{{object 5 0}} <<
+  {{streamlen}}
+>>
+stream
+BT
+/G2 6 Tf
+6 0 0 6 100 100 Tm
+0 0 0 1 k
+<eb42>Tj
+0 -12 TD
+<eb42>Tj
+-12 0 TD
+<eb42>Tj
+ET
+endstream
+endobj
+{{object 6 0}} <<
+  /Type /FontDescriptor
+  /Descent -120
+  /CapHeight 709
+  /StemV 81
+  /Flags 6
+  /XHeight 450
+  /Style <<
+    /Panose <010502020500000000000000>
+  >>
+  /FontBBox [-165 -221 1066 952]
+  /FontName /HonMincho-M
+  /ItalicAngle 0
+  /Ascent 880
+>>
+endobj
+{{object 7 0}} <<
+  /Type /Font
+  /Subtype /CIDFontType2
+  /BaseFont /HonMincho-M
+  /FontDescriptor 6 0 R
+  /DW 1000
+  /W [1 [250] 18 19 500 54 [833] 81 [583]]
+  /CIDSystemInfo <<
+    /Supplement 2
+    /Registry (Adobe)
+    /Ordering (Japan1)
+  >>
+>>
+endobj
+{{xref}}
+{{trailer}}
+{{startxref}}
+%%EOF
diff --git a/testing/resources/pixel/bug_1402_expected.pdf.0.png b/testing/resources/pixel/bug_1402_expected.pdf.0.png
new file mode 100644
index 0000000..cf913bd
--- /dev/null
+++ b/testing/resources/pixel/bug_1402_expected.pdf.0.png
Binary files differ
diff --git a/testing/resources/pixel/bug_1402_expected_mac.pdf.0.png b/testing/resources/pixel/bug_1402_expected_mac.pdf.0.png
new file mode 100644
index 0000000..9602820
--- /dev/null
+++ b/testing/resources/pixel/bug_1402_expected_mac.pdf.0.png
Binary files differ