Convert TransformPoint calls to Transform calls

This Cl converts remaining calls to TransformPoint to use Transform instead.

Change-Id: I7a2c000492da5dda3975b4449812f281816fdab6
Reviewed-on: https://pdfium-review.googlesource.com/2822
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index 8925c9a..a4506e7 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -845,8 +845,14 @@
   pPageView->GetCurrentMatrix(page2device);
 
   CFX_FloatRect rcDevice = GetRect();
-  page2device.TransformPoint(rcDevice.left, rcDevice.bottom);
-  page2device.TransformPoint(rcDevice.right, rcDevice.top);
+  CFX_PointF tmp =
+      page2device.Transform(CFX_PointF(rcDevice.left, rcDevice.bottom));
+  rcDevice.left = tmp.x;
+  rcDevice.bottom = tmp.y;
+
+  tmp = page2device.Transform(CFX_PointF(rcDevice.right, rcDevice.top));
+  rcDevice.right = tmp.x;
+  rcDevice.top = tmp.y;
   rcDevice.Normalize();
 
   FX_RECT rcDev = rcDevice.ToFxRect();
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp
index 44df8dd..da6f920 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -483,18 +483,11 @@
 CFX_PointF CFFL_FormFiller::FFLtoPWL(const CFX_PointF& point) {
   CFX_Matrix mt;
   mt.SetReverse(GetCurMatrix());
-
-  CFX_PointF pt = point;
-  mt.TransformPoint(pt.x, pt.y);
-  return pt;
+  return mt.Transform(point);
 }
 
 CFX_PointF CFFL_FormFiller::PWLtoFFL(const CFX_PointF& point) {
-  CFX_Matrix mt = GetCurMatrix();
-
-  CFX_PointF pt = point;
-  mt.TransformPoint(pt.x, pt.y);
-  return pt;
+  return GetCurMatrix().Transform(point);
 }
 
 CFX_PointF CFFL_FormFiller::WndtoPWL(CPDFSDK_PageView* pPageView,
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index 57d5d4d..e1fba8d 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -855,12 +855,11 @@
   CFX_Matrix device2page;
   device2page.SetReverse(page2device);
 
-  FX_FLOAT page_x_f = static_cast<FX_FLOAT>(device_x);
-  FX_FLOAT page_y_f = static_cast<FX_FLOAT>(device_y);
-  device2page.TransformPoint(page_x_f, page_y_f);
+  CFX_PointF pos = device2page.Transform(CFX_PointF(
+      static_cast<FX_FLOAT>(device_x), static_cast<FX_FLOAT>(device_y)));
 
-  *page_x = page_x_f;
-  *page_y = page_y_f;
+  *page_x = pos.x;
+  *page_y = pos.y;
 #endif  // PDF_ENABLE_XFA
 }
 
@@ -885,12 +884,11 @@
 #else   // PDF_ENABLE_XFA
   CFX_Matrix page2device =
       pPage->GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate);
-  FX_FLOAT device_x_f = static_cast<FX_FLOAT>(page_x);
-  FX_FLOAT device_y_f = static_cast<FX_FLOAT>(page_y);
-  page2device.TransformPoint(device_x_f, device_y_f);
+  CFX_PointF pos = page2device.Transform(
+      CFX_PointF(static_cast<FX_FLOAT>(page_x), static_cast<FX_FLOAT>(page_y)));
 
-  *device_x = FXSYS_round(device_x_f);
-  *device_y = FXSYS_round(device_y_f);
+  *device_x = FXSYS_round(pos.x);
+  *device_y = FXSYS_round(pos.y);
 #endif  // PDF_ENABLE_XFA
 }
 
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
index b708a36..8b5bb3d 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
@@ -158,12 +158,11 @@
   device2page.SetReverse(
       GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate));
 
-  FX_FLOAT page_x_f = static_cast<FX_FLOAT>(device_x);
-  FX_FLOAT page_y_f = static_cast<FX_FLOAT>(device_y);
-  device2page.TransformPoint(page_x_f, page_y_f);
+  CFX_PointF pos = device2page.Transform(CFX_PointF(
+      static_cast<FX_FLOAT>(device_x), static_cast<FX_FLOAT>(device_y)));
 
-  *page_x = page_x_f;
-  *page_y = page_y_f;
+  *page_x = pos.x;
+  *page_y = pos.y;
 }
 
 void CPDFXFA_Page::PageToDevice(int start_x,
@@ -181,12 +180,11 @@
   CFX_Matrix page2device =
       GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate);
 
-  FX_FLOAT device_x_f = static_cast<FX_FLOAT>(page_x);
-  FX_FLOAT device_y_f = static_cast<FX_FLOAT>(page_y);
-  page2device.TransformPoint(device_x_f, device_y_f);
+  CFX_PointF pos = page2device.Transform(
+      CFX_PointF(static_cast<FX_FLOAT>(page_x), static_cast<FX_FLOAT>(page_y)));
 
-  *device_x = FXSYS_round(device_x_f);
-  *device_y = FXSYS_round(device_y_f);
+  *device_x = FXSYS_round(pos.x);
+  *device_y = FXSYS_round(pos.y);
 }
 
 CFX_Matrix CPDFXFA_Page::GetDisplayMatrix(int xPos,
diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp
index 5b6fd55..1acc577 100644
--- a/fpdfsdk/fxedit/fxet_edit.cpp
+++ b/fpdfsdk/fxedit/fxet_edit.cpp
@@ -63,10 +63,8 @@
                     CFX_Matrix* pUser2Device,
                     const CFX_ByteString& str,
                     FX_ARGB crTextFill,
-                    FX_ARGB crTextStroke,
                     int32_t nHorzScale) {
-  FX_FLOAT x = pt.x, y = pt.y;
-  pUser2Device->TransformPoint(x, y);
+  CFX_PointF pos = pUser2Device->Transform(pt);
 
   if (pFont) {
     if (nHorzScale != 100) {
@@ -77,44 +75,16 @@
       ro.m_Flags = RENDER_CLEARTYPE;
       ro.m_ColorMode = RENDER_COLOR_NORMAL;
 
-      if (crTextStroke != 0) {
-        CFX_PointF pt1;
-        CFX_PointF pt2;
-        pUser2Device->TransformPoint(pt1.x, pt1.y);
-        pUser2Device->TransformPoint(pt2.x, pt2.y);
-        CFX_GraphStateData gsd;
-        gsd.m_LineWidth =
-            (FX_FLOAT)FXSYS_fabs((pt2.x + pt2.y) - (pt1.x + pt1.y));
-
-        CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, &mt,
-                                          str, crTextFill, crTextStroke, &gsd,
-                                          &ro);
-      } else {
-        CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, &mt,
-                                          str, crTextFill, 0, nullptr, &ro);
-      }
+      CPDF_TextRenderer::DrawTextString(pDevice, pos.x, pos.y, pFont, fFontSize,
+                                        &mt, str, crTextFill, nullptr, &ro);
     } else {
       CPDF_RenderOptions ro;
       ro.m_Flags = RENDER_CLEARTYPE;
       ro.m_ColorMode = RENDER_COLOR_NORMAL;
 
-      if (crTextStroke != 0) {
-        CFX_PointF pt1;
-        CFX_PointF pt2;
-        pUser2Device->TransformPoint(pt1.x, pt1.y);
-        pUser2Device->TransformPoint(pt2.x, pt2.y);
-        CFX_GraphStateData gsd;
-        gsd.m_LineWidth =
-            (FX_FLOAT)FXSYS_fabs((pt2.x + pt2.y) - (pt1.x + pt1.y));
-
-        CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize,
-                                          pUser2Device, str, crTextFill,
-                                          crTextStroke, &gsd, &ro);
-      } else {
-        CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize,
-                                          pUser2Device, str, crTextFill, 0,
-                                          nullptr, &ro);
-      }
+      CPDF_TextRenderer::DrawTextString(pDevice, pos.x, pos.y, pFont, fFontSize,
+                                        pUser2Device, str, crTextFill, nullptr,
+                                        &ro);
     }
   }
 }
@@ -748,7 +718,6 @@
                         CFX_Matrix* pUser2Device,
                         CFX_Edit* pEdit,
                         FX_COLORREF crTextFill,
-                        FX_COLORREF crTextStroke,
                         const CFX_FloatRect& rcClip,
                         const CFX_PointF& ptOffset,
                         const CPVT_WordRange* pRange,
@@ -830,7 +799,7 @@
               DrawTextString(
                   pDevice, CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
                   pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device,
-                  sTextBuf.MakeString(), crOldFill, crTextStroke, nHorzScale);
+                  sTextBuf.MakeString(), crOldFill, nHorzScale);
 
               sTextBuf.Clear();
             }
@@ -848,17 +817,17 @@
                                   word.ptWord.y + ptOffset.y),
               pFontMap->GetPDFFont(word.nFontIndex), fFontSize, pUser2Device,
               GetPDFWordString(pFontMap, word.nFontIndex, word.Word, SubWord),
-              crCurFill, crTextStroke, nHorzScale);
+              crCurFill, nHorzScale);
         }
         oldplace = place;
       }
     }
 
     if (sTextBuf.GetLength() > 0) {
-      DrawTextString(
-          pDevice, CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
-          pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device,
-          sTextBuf.MakeString(), crOldFill, crTextStroke, nHorzScale);
+      DrawTextString(pDevice,
+                     CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
+                     pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device,
+                     sTextBuf.MakeString(), crOldFill, nHorzScale);
     }
   }
 
diff --git a/fpdfsdk/fxedit/fxet_edit.h b/fpdfsdk/fxedit/fxet_edit.h
index c8caeb9..ab83af2 100644
--- a/fpdfsdk/fxedit/fxet_edit.h
+++ b/fpdfsdk/fxedit/fxet_edit.h
@@ -324,7 +324,6 @@
                        CFX_Matrix* pUser2Device,
                        CFX_Edit* pEdit,
                        FX_COLORREF crTextFill,
-                       FX_COLORREF crTextStroke,
                        const CFX_FloatRect& rcClip,
                        const CFX_PointF& ptOffset,
                        const CPVT_WordRange* pRange,
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp
index 4aa3d92..f96455e 100644
--- a/fpdfsdk/pdfwindow/PWL_Edit.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp
@@ -266,7 +266,8 @@
       m_pEdit->GetPasswordChar());
 
   if (sEditBefore.GetLength() > 0)
-    sText << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC()
+    sText << "BT\n"
+          << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC()
           << sEditBefore.AsStringC() << "ET\n";
 
   wrTemp = CPWL_Utils::OverlapWordRange(wrVisible, wrSelect);
@@ -286,7 +287,8 @@
       m_pEdit->GetPasswordChar());
 
   if (sEditAfter.GetLength() > 0)
-    sText << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC()
+    sText << "BT\n"
+          << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC()
           << sEditAfter.AsStringC() << "ET\n";
 
   if (sText.GetLength() > 0) {
@@ -394,9 +396,8 @@
   CFX_SystemHandler* pSysHandler = GetSystemHandler();
   CFX_Edit::DrawEdit(
       pDevice, pUser2Device, m_pEdit.get(),
-      CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()),
-      CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()),
-      rcClip, CFX_PointF(), pRange, pSysHandler, m_pFormFiller);
+      CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), rcClip,
+      CFX_PointF(), pRange, pSysHandler, m_pFormFiller);
 }
 
 bool CPWL_Edit::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) {
@@ -491,7 +492,8 @@
   CFX_ByteTextBuf sRet;
   CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit.get(), ptOffset);
   if (sEdit.GetLength() > 0) {
-    sRet << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC()
+    sRet << "BT\n"
+         << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC()
          << sEdit.AsStringC() << "ET\n";
   }
   return sRet.MakeString();
diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
index 3f5dfef..c7e8c9e 100644
--- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp
+++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
@@ -172,7 +172,6 @@
       if (pSysHandler && pSysHandler->IsSelectionImplemented()) {
         CFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
                            CPWL_Utils::PWLColorToFXColor(GetTextColor()),
-                           CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()),
                            rcList, ptOffset, nullptr, pSysHandler,
                            m_pFormFiller);
         pSysHandler->OutputSelectedRect(m_pFormFiller, rcItem);
@@ -180,15 +179,14 @@
         CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcItem,
                                  ArgbEncode(255, 0, 51, 113));
         CFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
-                           ArgbEncode(255, 255, 255, 255), 0, rcList, ptOffset,
+                           ArgbEncode(255, 255, 255, 255), rcList, ptOffset,
                            nullptr, pSysHandler, m_pFormFiller);
       }
     } else {
       CFX_SystemHandler* pSysHandler = GetSystemHandler();
       CFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
-                         CPWL_Utils::PWLColorToFXColor(GetTextColor()),
-                         CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()),
-                         rcList, ptOffset, nullptr, pSysHandler, nullptr);
+                         CPWL_Utils::PWLColorToFXColor(GetTextColor()), rcList,
+                         ptOffset, nullptr, pSysHandler, nullptr);
     }
   }
 }
diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/pdfwindow/PWL_Wnd.cpp
index f5d97ad..1f13e2a 100644
--- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp
@@ -32,7 +32,6 @@
       dwBorderWidth(1),
       sBorderColor(),
       sTextColor(),
-      sTextStrokeColor(),
       nTransparency(255),
       fFontSize(PWL_DEFAULT_FONTSIZE),
       sDash(3, 0, 0),
@@ -559,22 +558,10 @@
   m_sPrivateParam.sBackgroundColor = color;
 }
 
-void CPWL_Wnd::SetTextColor(const CPWL_Color& color) {
-  m_sPrivateParam.sTextColor = color;
-}
-
-void CPWL_Wnd::SetTextStrokeColor(const CPWL_Color& color) {
-  m_sPrivateParam.sTextStrokeColor = color;
-}
-
 CPWL_Color CPWL_Wnd::GetTextColor() const {
   return m_sPrivateParam.sTextColor;
 }
 
-CPWL_Color CPWL_Wnd::GetTextStrokeColor() const {
-  return m_sPrivateParam.sTextStrokeColor;
-}
-
 BorderStyle CPWL_Wnd::GetBorderStyle() const {
   return m_sPrivateParam.nBorderStyle;
 }
diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.h b/fpdfsdk/pdfwindow/PWL_Wnd.h
index 92c099f..9c378f0 100644
--- a/fpdfsdk/pdfwindow/PWL_Wnd.h
+++ b/fpdfsdk/pdfwindow/PWL_Wnd.h
@@ -181,7 +181,6 @@
     dwBorderWidth = 0;
     sBorderColor.Reset();
     sTextColor.Reset();
-    sTextStrokeColor.Reset();
     nTransparency = 0;
     fFontSize = 0.0f;
     sDash.Reset();
@@ -204,7 +203,6 @@
   int32_t dwBorderWidth;              // optional
   CPWL_Color sBorderColor;            // optional
   CPWL_Color sTextColor;              // optional
-  CPWL_Color sTextStrokeColor;        // optional
   int32_t nTransparency;              // optional
   FX_FLOAT fFontSize;                 // optional
   CPWL_Dash sDash;                    // optional
@@ -286,15 +284,12 @@
                         uint32_t msg,
                         intptr_t wParam = 0,
                         intptr_t lParam = 0);
-  virtual void SetTextColor(const CPWL_Color& color);
-  virtual void SetTextStrokeColor(const CPWL_Color& color);
   virtual void SetVisible(bool bVisible);
 
   virtual CFX_FloatRect GetFocusRect() const;
   virtual CPWL_Color GetBackgroundColor() const;
   virtual CPWL_Color GetBorderColor() const;
   virtual CPWL_Color GetTextColor() const;
-  virtual CPWL_Color GetTextStrokeColor() const;
   virtual FX_FLOAT GetFontSize() const;
   virtual int32_t GetInnerBorderWidth() const;
   virtual CPWL_Color GetBorderLeftTopColor(BorderStyle nBorderStyle) const;