[Skia] Fix the issue that wrong scale is applied to y position.
If a glyph's transformation matrix is [a b c d 0 0], then `a` is
the scale factor applied to its x position, `d` is the scale
factor applied to its y position, and `b`,`c` are used for skewing
the original glyph bitmap.
However, when rendering bug_1402, cp.m_AdjustMatrix[1] (AKA `b`) is
used for scaling the glyph on the y axis, which happens to be 0 and
erased the glyph's y position. This resulted in all characters with
the same transformation matrix are rendered lower than expected.
This CL fixes the issue by apply `-cp.m_AdjustMatrix[3]` (`d`) as
the scale factor of a glyph's y position, which takes consideration
that the y position is inverted from character to device.
Bug: pdfium:1740
Change-Id: I5ed3d2f36562564ebf1039ec18a7354adee2af87
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/87410
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Nigi <nigi@chromium.org>
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 0a23b66..a420cb0 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -965,7 +965,7 @@
rsxform->fSCos = cp.m_AdjustMatrix[0];
rsxform->fSSin = cp.m_AdjustMatrix[1];
rsxform->fTx = cp.m_AdjustMatrix[0] * positions[index].fX;
- rsxform->fTy = cp.m_AdjustMatrix[1] * positions[index].fY;
+ rsxform->fTy = -cp.m_AdjustMatrix[3] * positions[index].fY;
} else {
rsxform->fSCos = 1;
rsxform->fSSin = 0;
@@ -1776,7 +1776,7 @@
rsxform->fSCos = cp.m_AdjustMatrix[0];
rsxform->fSSin = cp.m_AdjustMatrix[1];
rsxform->fTx = cp.m_AdjustMatrix[0] * positions[index].fX;
- rsxform->fTy = cp.m_AdjustMatrix[1] * positions[index].fY;
+ rsxform->fTy = -cp.m_AdjustMatrix[3] * positions[index].fY;
} else {
rsxform->fSCos = 1;
rsxform->fSSin = 0;
diff --git a/testing/SUPPRESSIONS b/testing/SUPPRESSIONS
index 94079b8..8d93b82 100644
--- a/testing/SUPPRESSIONS
+++ b/testing/SUPPRESSIONS
@@ -349,9 +349,6 @@
# TODO(pdfium:1461): Remove after associated bug is fixed
bug_1402.in win * * *
-# TODO(pdfium:1740): Remove after associated bug is fixed
-bug_1402.in * * * skia,skiapaths
-
# TODO(pdfium:1466): Remove after associated bug is fixed
bug_1449.in linux * * *
diff --git a/testing/resources/pixel/bug_1402_expected_skia.pdf.0.png b/testing/resources/pixel/bug_1402_expected_skia.pdf.0.png
new file mode 100644
index 0000000..ef8d744
--- /dev/null
+++ b/testing/resources/pixel/bug_1402_expected_skia.pdf.0.png
Binary files differ
diff --git a/testing/resources/pixel/bug_1402_expected_skia_mac.pdf.0.png b/testing/resources/pixel/bug_1402_expected_skia_mac.pdf.0.png
new file mode 100644
index 0000000..890456b
--- /dev/null
+++ b/testing/resources/pixel/bug_1402_expected_skia_mac.pdf.0.png
Binary files differ
diff --git a/testing/resources/pixel/bug_1402_expected_skiapaths_mac.pdf.0.png b/testing/resources/pixel/bug_1402_expected_skiapaths_mac.pdf.0.png
new file mode 100644
index 0000000..bd0190d
--- /dev/null
+++ b/testing/resources/pixel/bug_1402_expected_skiapaths_mac.pdf.0.png
Binary files differ