Render 2-point paths as thin lines in fill mode.

This CL modifies CheckSimpleLinePath() to make the following
improvements:

- A simple 2-point path should be rendered as a thin line even if it
  doesn't form an enclosed area.

- By comparing the rendering results of bug_1639_1.in from other
  rendering tools, a simple path that forms a straight line should
  always be rendered thin disregarding it's diagonal or not.

Bug: pdfium:1639
Change-Id: I66921138c6f0f465e088ac34054a0446a06dbbb4
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/78191
Commit-Queue: Hui Yingst <nigi@chromium.org>
Reviewed-by: Daniel Hosseinian <dhoss@chromium.org>
diff --git a/DEPS b/DEPS
index eebc457..2ab889f 100644
--- a/DEPS
+++ b/DEPS
@@ -89,7 +89,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling pdfium_tests
   # and whatever else without interference from each other.
-  'pdfium_tests_revision': '7adedee8c61163fb68005fdbd968f16532bb04d4',
+  'pdfium_tests_revision': '61bf033292709e29941375f45183db852e74977c',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling skia
   # and whatever else without interference from each other.
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index dcba015..794d1cd 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -315,21 +315,21 @@
   return true;
 }
 
-// Returns true if the simple path contains 3 points which draw a line from
-// A->B->A and form a zero area.
+// Returns true if the path is a 3-point path that draws A->B->A and forms a
+// zero area, or a 2-point path which draws A->B.
 bool CheckSimpleLinePath(pdfium::span<const FX_PATHPOINT> points,
                          const CFX_Matrix* matrix,
                          bool adjust,
                          CFX_PathData* new_path,
                          bool* thin,
                          bool* set_identity) {
-  if (points.size() != 3)
+  if (points.size() != 2 && points.size() != 3)
     return false;
 
   if (points[0].m_Type != FXPT_TYPE::MoveTo ||
       points[1].m_Type != FXPT_TYPE::LineTo ||
-      points[2].m_Type != FXPT_TYPE::LineTo ||
-      points[0].m_Point != points[2].m_Point) {
+      (points.size() == 3 && (points[2].m_Type != FXPT_TYPE::LineTo ||
+                              points[0].m_Point != points[2].m_Point))) {
     return false;
   }
 
@@ -353,11 +353,7 @@
   if (adjust && matrix)
     *set_identity = true;
 
-  // Note, both x and y coordinates of the end points need to be different.
-  if (points[0].m_Point.x != points[1].m_Point.x &&
-      points[0].m_Point.y != points[1].m_Point.y) {
-    *thin = true;
-  }
+  *thin = true;
   return true;
 }
 
@@ -418,9 +414,7 @@
                      bool* set_identity) {
   *set_identity = false;
 
-  // TODO(crbug.com/pdfium/1639): Need to handle the case when there are
-  // only 2 points in the path that forms a zero area.
-  if (points.size() < 3)
+  if (points.size() < 2)
     return false;
 
   if (CheckSimpleLinePath(points, matrix, adjust, new_path, thin,
diff --git a/testing/resources/pixel/bug_1639_1_expected.pdf.0.png b/testing/resources/pixel/bug_1639_1_expected.pdf.0.png
index f97e340..2734462 100644
--- a/testing/resources/pixel/bug_1639_1_expected.pdf.0.png
+++ b/testing/resources/pixel/bug_1639_1_expected.pdf.0.png
Binary files differ