Pass CFGAS_GEPath by const ref where possible.

Change-Id: I4380edff48d85476978d9bacd6127c9c54c90f34
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/80054
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fgas/graphics/cfgas_gegraphics.cpp b/xfa/fgas/graphics/cfgas_gegraphics.cpp
index 62e2173..63145ca 100644
--- a/xfa/fgas/graphics/cfgas_gegraphics.cpp
+++ b/xfa/fgas/graphics/cfgas_gegraphics.cpp
@@ -166,17 +166,15 @@
   m_info.fillColor = color;
 }
 
-void CFGAS_GEGraphics::StrokePath(const CFGAS_GEPath* path,
+void CFGAS_GEGraphics::StrokePath(const CFGAS_GEPath& path,
                                   const CFX_Matrix* matrix) {
-  if (path)
-    RenderDeviceStrokePath(path, matrix);
+  RenderDeviceStrokePath(path, matrix);
 }
 
-void CFGAS_GEGraphics::FillPath(const CFGAS_GEPath* path,
+void CFGAS_GEGraphics::FillPath(const CFGAS_GEPath& path,
                                 CFX_FillRenderOptions::FillType fill_type,
                                 const CFX_Matrix& matrix) {
-  if (path)
-    RenderDeviceFillPath(path, fill_type, matrix);
+  RenderDeviceFillPath(path, fill_type, matrix);
 }
 
 void CFGAS_GEGraphics::ConcatMatrix(const CFX_Matrix& matrix) {
@@ -202,7 +200,7 @@
   return m_renderDevice;
 }
 
-void CFGAS_GEGraphics::RenderDeviceStrokePath(const CFGAS_GEPath* path,
+void CFGAS_GEGraphics::RenderDeviceStrokePath(const CFGAS_GEPath& path,
                                               const CFX_Matrix* matrix) {
   if (m_info.strokeColor.GetType() != CFGAS_GEColor::Solid)
     return;
@@ -211,13 +209,13 @@
   if (matrix)
     m.Concat(*matrix);
 
-  m_renderDevice->DrawPath(path->GetPathData(), &m, &m_info.graphState, 0x0,
+  m_renderDevice->DrawPath(path.GetPathData(), &m, &m_info.graphState, 0x0,
                            m_info.strokeColor.GetArgb(),
                            CFX_FillRenderOptions());
 }
 
 void CFGAS_GEGraphics::RenderDeviceFillPath(
-    const CFGAS_GEPath* path,
+    const CFGAS_GEPath& path,
     CFX_FillRenderOptions::FillType fill_type,
     const CFX_Matrix& matrix) {
   CFX_Matrix m = m_info.CTM;
@@ -226,7 +224,7 @@
   const CFX_FillRenderOptions fill_options(fill_type);
   switch (m_info.fillColor.GetType()) {
     case CFGAS_GEColor::Solid:
-      m_renderDevice->DrawPath(path->GetPathData(), &m, &m_info.graphState,
+      m_renderDevice->DrawPath(path.GetPathData(), &m, &m_info.graphState,
                                m_info.fillColor.GetArgb(), 0x0, fill_options);
       return;
     case CFGAS_GEColor::Pattern:
@@ -241,7 +239,7 @@
 }
 
 void CFGAS_GEGraphics::FillPathWithPattern(
-    const CFGAS_GEPath* path,
+    const CFGAS_GEPath& path,
     const CFX_FillRenderOptions& fill_options,
     const CFX_Matrix& matrix) {
   RetainPtr<CFX_DIBitmap> bitmap = m_renderDevice->GetBitmap();
@@ -259,7 +257,7 @@
   mask->Create(data.width, data.height, FXDIB_Format::k1bppMask);
   memcpy(mask->GetBuffer(), data.maskBits, mask->GetPitch() * data.height);
   const CFX_FloatRect rectf =
-      matrix.TransformRect(path->GetPathData()->GetBoundingBox());
+      matrix.TransformRect(path.GetPathData()->GetBoundingBox());
   const FX_RECT rect = rectf.ToRoundedFxRect();
 
   CFX_DefaultRenderDevice device;
@@ -270,12 +268,12 @@
       device.SetBitMask(mask, i, j, m_info.fillColor.GetPattern()->m_foreArgb);
   }
   CFX_RenderDevice::StateRestorer restorer(m_renderDevice);
-  m_renderDevice->SetClip_PathFill(path->GetPathData(), &matrix, fill_options);
+  m_renderDevice->SetClip_PathFill(path.GetPathData(), &matrix, fill_options);
   SetDIBitsWithMatrix(bmp, CFX_Matrix());
 }
 
 void CFGAS_GEGraphics::FillPathWithShading(
-    const CFGAS_GEPath* path,
+    const CFGAS_GEPath& path,
     const CFX_FillRenderOptions& fill_options,
     const CFX_Matrix& matrix) {
   RetainPtr<CFX_DIBitmap> bitmap = m_renderDevice->GetBitmap();
@@ -388,8 +386,7 @@
   }
   if (result) {
     CFX_RenderDevice::StateRestorer restorer(m_renderDevice);
-    m_renderDevice->SetClip_PathFill(path->GetPathData(), &matrix,
-                                     fill_options);
+    m_renderDevice->SetClip_PathFill(path.GetPathData(), &matrix, fill_options);
     SetDIBitsWithMatrix(bmp, matrix);
   }
 }
diff --git a/xfa/fgas/graphics/cfgas_gegraphics.h b/xfa/fgas/graphics/cfgas_gegraphics.h
index 2f9763d..edf5d79 100644
--- a/xfa/fgas/graphics/cfgas_gegraphics.h
+++ b/xfa/fgas/graphics/cfgas_gegraphics.h
@@ -50,8 +50,8 @@
   void SetStrokeColor(const CFGAS_GEColor& color);
   void SetFillColor(const CFGAS_GEColor& color);
   void SetClipRect(const CFX_RectF& rect);
-  void StrokePath(const CFGAS_GEPath* path, const CFX_Matrix* matrix);
-  void FillPath(const CFGAS_GEPath* path,
+  void StrokePath(const CFGAS_GEPath& path, const CFX_Matrix* matrix);
+  void FillPath(const CFGAS_GEPath& path,
                 CFX_FillRenderOptions::FillType fill_type,
                 const CFX_Matrix& matrix);
   void ConcatMatrix(const CFX_Matrix& matrix);
@@ -69,15 +69,15 @@
     CFGAS_GEColor fillColor{nullptr};
   };
 
-  void RenderDeviceStrokePath(const CFGAS_GEPath* path,
+  void RenderDeviceStrokePath(const CFGAS_GEPath& path,
                               const CFX_Matrix* matrix);
-  void RenderDeviceFillPath(const CFGAS_GEPath* path,
+  void RenderDeviceFillPath(const CFGAS_GEPath& path,
                             CFX_FillRenderOptions::FillType fill_type,
                             const CFX_Matrix& matrix);
-  void FillPathWithPattern(const CFGAS_GEPath* path,
+  void FillPathWithPattern(const CFGAS_GEPath& path,
                            const CFX_FillRenderOptions& fill_options,
                            const CFX_Matrix& matrix);
-  void FillPathWithShading(const CFGAS_GEPath* path,
+  void FillPathWithShading(const CFGAS_GEPath& path,
                            const CFX_FillRenderOptions& fill_options,
                            const CFX_Matrix& matrix);
   void SetDIBitsWithMatrix(const RetainPtr<CFX_DIBBase>& source,
diff --git a/xfa/fgas/graphics/cfgas_gepath.cpp b/xfa/fgas/graphics/cfgas_gepath.cpp
index e494eb9..29cef15 100644
--- a/xfa/fgas/graphics/cfgas_gepath.cpp
+++ b/xfa/fgas/graphics/cfgas_gepath.cpp
@@ -139,10 +139,8 @@
   } while (!done);
 }
 
-void CFGAS_GEPath::AddSubpath(CFGAS_GEPath* path) {
-  if (!path)
-    return;
-  data_.Append(path->data_, nullptr);
+void CFGAS_GEPath::AddSubpath(const CFGAS_GEPath& path) {
+  data_.Append(path.data_, nullptr);
 }
 
 void CFGAS_GEPath::TransformBy(const CFX_Matrix& mt) {
diff --git a/xfa/fgas/graphics/cfgas_gepath.h b/xfa/fgas/graphics/cfgas_gepath.h
index 8f843cc..7196e61 100644
--- a/xfa/fgas/graphics/cfgas_gepath.h
+++ b/xfa/fgas/graphics/cfgas_gepath.h
@@ -41,7 +41,7 @@
               float startAngle,
               float sweepAngle);
 
-  void AddSubpath(CFGAS_GEPath* path);
+  void AddSubpath(const CFGAS_GEPath& path);
 
  private:
   void ArcToInternal(const CFX_PointF& pos,
diff --git a/xfa/fwl/theme/cfwl_carettp.cpp b/xfa/fwl/theme/cfwl_carettp.cpp
index c348cf9..30663c9 100644
--- a/xfa/fwl/theme/cfwl_carettp.cpp
+++ b/xfa/fwl/theme/cfwl_carettp.cpp
@@ -38,5 +38,5 @@
   CFGAS_GEPath path;
   path.AddRectangle(rect.left, rect.top, rect.width, rect.height);
   pGraphics->SetFillColor(CFGAS_GEColor(ArgbEncode(255, 0, 0, 0)));
-  pGraphics->FillPath(&path, CFX_FillRenderOptions::FillType::kWinding, matrix);
+  pGraphics->FillPath(path, CFX_FillRenderOptions::FillType::kWinding, matrix);
 }
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp
index 3079e07..108b844 100644
--- a/xfa/fwl/theme/cfwl_checkboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp
@@ -45,16 +45,16 @@
                                     const CFX_RectF& rtSign,
                                     FX_ARGB argbFill,
                                     const CFX_Matrix& matrix) {
-  if (!m_pCheckPath)
-    InitCheckPath(rtSign.width);
+  EnsureCheckPathInitialized(rtSign.width);
+  DCHECK(m_pCheckPath);
 
   CFX_Matrix mt;
   mt.Translate(rtSign.left, rtSign.top);
   mt.Concat(matrix);
   pGraphics->SaveGraphState();
   pGraphics->SetFillColor(CFGAS_GEColor(argbFill));
-  pGraphics->FillPath(m_pCheckPath.get(),
-                      CFX_FillRenderOptions::FillType::kWinding, mt);
+  pGraphics->FillPath(*m_pCheckPath, CFX_FillRenderOptions::FillType::kWinding,
+                      mt);
   pGraphics->RestoreGraphState();
 }
 
@@ -66,7 +66,7 @@
   path.AddEllipse(rtSign);
   pGraphics->SaveGraphState();
   pGraphics->SetFillColor(CFGAS_GEColor(argbFill));
-  pGraphics->FillPath(&path, CFX_FillRenderOptions::FillType::kWinding, matrix);
+  pGraphics->FillPath(path, CFX_FillRenderOptions::FillType::kWinding, matrix);
   pGraphics->RestoreGraphState();
 }
 
@@ -84,7 +84,7 @@
   pGraphics->SaveGraphState();
   pGraphics->SetStrokeColor(CFGAS_GEColor(argbFill));
   pGraphics->SetLineWidth(1.0f);
-  pGraphics->StrokePath(&path, &matrix);
+  pGraphics->StrokePath(path, &matrix);
   pGraphics->RestoreGraphState();
 }
 
@@ -104,7 +104,7 @@
 
   pGraphics->SaveGraphState();
   pGraphics->SetFillColor(CFGAS_GEColor(argbFill));
-  pGraphics->FillPath(&path, CFX_FillRenderOptions::FillType::kWinding, matrix);
+  pGraphics->FillPath(path, CFX_FillRenderOptions::FillType::kWinding, matrix);
   pGraphics->RestoreGraphState();
 }
 
@@ -116,7 +116,7 @@
   path.AddRectangle(rtSign.left, rtSign.top, rtSign.width, rtSign.height);
   pGraphics->SaveGraphState();
   pGraphics->SetFillColor(CFGAS_GEColor(argbFill));
-  pGraphics->FillPath(&path, CFX_FillRenderOptions::FillType::kWinding, matrix);
+  pGraphics->FillPath(path, CFX_FillRenderOptions::FillType::kWinding, matrix);
   pGraphics->RestoreGraphState();
 }
 
@@ -146,62 +146,62 @@
   }
   pGraphics->SaveGraphState();
   pGraphics->SetFillColor(CFGAS_GEColor(argbFill));
-  pGraphics->FillPath(&path, CFX_FillRenderOptions::FillType::kWinding, matrix);
+  pGraphics->FillPath(path, CFX_FillRenderOptions::FillType::kWinding, matrix);
   pGraphics->RestoreGraphState();
 }
 
-void CFWL_CheckBoxTP::InitCheckPath(float fCheckLen) {
-  if (!m_pCheckPath) {
-    m_pCheckPath = std::make_unique<CFGAS_GEPath>();
+void CFWL_CheckBoxTP::EnsureCheckPathInitialized(float fCheckLen) {
+  if (m_pCheckPath)
+    return;
 
-    float fWidth = kSignPath;
-    float fHeight = -kSignPath;
-    float fBottom = kSignPath;
-    CFX_PointF pt1(fWidth / 15.0f, fBottom + fHeight * 2 / 5.0f);
-    CFX_PointF pt2(fWidth / 4.5f, fBottom + fHeight / 16.0f);
-    CFX_PointF pt3(fWidth / 3.0f, fBottom);
-    CFX_PointF pt4(fWidth * 14 / 15.0f, fBottom + fHeight * 15 / 16.0f);
-    CFX_PointF pt5(fWidth / 3.6f, fBottom + fHeight / 3.5f);
-    CFX_PointF pt12(fWidth / 7.0f, fBottom + fHeight * 2 / 7.0f);
-    CFX_PointF pt21(fWidth / 5.0f, fBottom + fHeight / 5.0f);
-    CFX_PointF pt23(fWidth / 4.4f, fBottom + fHeight * 0 / 16.0f);
-    CFX_PointF pt32(fWidth / 4.0f, fBottom);
-    CFX_PointF pt34(fWidth * (1 / 7.0f + 7 / 15.0f),
-                    fBottom + fHeight * 4 / 5.0f);
-    CFX_PointF pt43(fWidth * (1 / 7.0f + 7 / 15.0f),
-                    fBottom + fHeight * 4 / 5.0f);
-    CFX_PointF pt45(fWidth * 7 / 15.0f, fBottom + fHeight * 8 / 7.0f);
-    CFX_PointF pt54(fWidth / 3.4f, fBottom + fHeight / 3.5f);
-    CFX_PointF pt51(fWidth / 3.6f, fBottom + fHeight / 4.0f);
-    CFX_PointF pt15(fWidth / 3.5f, fBottom + fHeight * 3.5f / 5.0f);
-    m_pCheckPath->MoveTo(pt1);
+  m_pCheckPath = std::make_unique<CFGAS_GEPath>();
 
-    CFX_PointF p1 = ScaleBezierPoint(pt12 - pt1);
-    CFX_PointF p2 = ScaleBezierPoint(pt21 - pt2);
-    m_pCheckPath->BezierTo(pt1 + p1, pt2 + p2, pt2);
+  float fWidth = kSignPath;
+  float fHeight = -kSignPath;
+  float fBottom = kSignPath;
+  CFX_PointF pt1(fWidth / 15.0f, fBottom + fHeight * 2 / 5.0f);
+  CFX_PointF pt2(fWidth / 4.5f, fBottom + fHeight / 16.0f);
+  CFX_PointF pt3(fWidth / 3.0f, fBottom);
+  CFX_PointF pt4(fWidth * 14 / 15.0f, fBottom + fHeight * 15 / 16.0f);
+  CFX_PointF pt5(fWidth / 3.6f, fBottom + fHeight / 3.5f);
+  CFX_PointF pt12(fWidth / 7.0f, fBottom + fHeight * 2 / 7.0f);
+  CFX_PointF pt21(fWidth / 5.0f, fBottom + fHeight / 5.0f);
+  CFX_PointF pt23(fWidth / 4.4f, fBottom + fHeight * 0 / 16.0f);
+  CFX_PointF pt32(fWidth / 4.0f, fBottom);
+  CFX_PointF pt34(fWidth * (1 / 7.0f + 7 / 15.0f),
+                  fBottom + fHeight * 4 / 5.0f);
+  CFX_PointF pt43(fWidth * (1 / 7.0f + 7 / 15.0f),
+                  fBottom + fHeight * 4 / 5.0f);
+  CFX_PointF pt45(fWidth * 7 / 15.0f, fBottom + fHeight * 8 / 7.0f);
+  CFX_PointF pt54(fWidth / 3.4f, fBottom + fHeight / 3.5f);
+  CFX_PointF pt51(fWidth / 3.6f, fBottom + fHeight / 4.0f);
+  CFX_PointF pt15(fWidth / 3.5f, fBottom + fHeight * 3.5f / 5.0f);
+  m_pCheckPath->MoveTo(pt1);
 
-    p1 = ScaleBezierPoint(pt23 - pt2);
-    p2 = ScaleBezierPoint(pt32 - pt3);
-    m_pCheckPath->BezierTo(pt2 + p1, pt3 + p2, pt3);
+  CFX_PointF p1 = ScaleBezierPoint(pt12 - pt1);
+  CFX_PointF p2 = ScaleBezierPoint(pt21 - pt2);
+  m_pCheckPath->BezierTo(pt1 + p1, pt2 + p2, pt2);
 
-    p1 = ScaleBezierPoint(pt34 - pt3);
-    p2 = ScaleBezierPoint(pt43 - pt4);
-    m_pCheckPath->BezierTo(pt3 + p1, pt4 + p2, pt4);
+  p1 = ScaleBezierPoint(pt23 - pt2);
+  p2 = ScaleBezierPoint(pt32 - pt3);
+  m_pCheckPath->BezierTo(pt2 + p1, pt3 + p2, pt3);
 
-    p1 = ScaleBezierPoint(pt45 - pt4);
-    p2 = ScaleBezierPoint(pt54 - pt5);
-    m_pCheckPath->BezierTo(pt4 + p1, pt5 + p2, pt5);
+  p1 = ScaleBezierPoint(pt34 - pt3);
+  p2 = ScaleBezierPoint(pt43 - pt4);
+  m_pCheckPath->BezierTo(pt3 + p1, pt4 + p2, pt4);
 
-    p1 = ScaleBezierPoint(pt51 - pt5);
-    p2 = ScaleBezierPoint(pt15 - pt1);
-    m_pCheckPath->BezierTo(pt5 + p1, pt1 + p2, pt1);
+  p1 = ScaleBezierPoint(pt45 - pt4);
+  p2 = ScaleBezierPoint(pt54 - pt5);
+  m_pCheckPath->BezierTo(pt4 + p1, pt5 + p2, pt5);
 
-    float fScale = fCheckLen / kSignPath;
-    CFX_Matrix mt;
-    mt.Scale(fScale, fScale);
+  p1 = ScaleBezierPoint(pt51 - pt5);
+  p2 = ScaleBezierPoint(pt15 - pt1);
+  m_pCheckPath->BezierTo(pt5 + p1, pt1 + p2, pt1);
 
-    m_pCheckPath->TransformBy(mt);
-  }
+  float fScale = fCheckLen / kSignPath;
+  CFX_Matrix mt;
+  mt.Scale(fScale, fScale);
+  m_pCheckPath->TransformBy(mt);
 }
 
 void CFWL_CheckBoxTP::DrawBackground(const CFWL_ThemeBackground& pParams) {
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.h b/xfa/fwl/theme/cfwl_checkboxtp.h
index d3727b1..997272a 100644
--- a/xfa/fwl/theme/cfwl_checkboxtp.h
+++ b/xfa/fwl/theme/cfwl_checkboxtp.h
@@ -57,7 +57,7 @@
                     FX_ARGB argbFill,
                     const CFX_Matrix& matrix);
 
-  void InitCheckPath(float fCheckLen);
+  void EnsureCheckPathInitialized(float fCheckLen);
 
   std::unique_ptr<CFGAS_GEPath> m_pCheckPath;
 };
diff --git a/xfa/fwl/theme/cfwl_comboboxtp.cpp b/xfa/fwl/theme/cfwl_comboboxtp.cpp
index a39b539..f7ef5b5 100644
--- a/xfa/fwl/theme/cfwl_comboboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_comboboxtp.cpp
@@ -42,7 +42,7 @@
       pParams.m_pGraphics->SaveGraphState();
       pParams.m_pGraphics->SetFillColor(CFGAS_GEColor(argb_color));
       pParams.m_pGraphics->FillPath(
-          &path, CFX_FillRenderOptions::FillType::kWinding, pParams.m_matrix);
+          path, CFX_FillRenderOptions::FillType::kWinding, pParams.m_matrix);
       pParams.m_pGraphics->RestoreGraphState();
       break;
     }
diff --git a/xfa/fwl/theme/cfwl_edittp.cpp b/xfa/fwl/theme/cfwl_edittp.cpp
index 8e09002..60285d6 100644
--- a/xfa/fwl/theme/cfwl_edittp.cpp
+++ b/xfa/fwl/theme/cfwl_edittp.cpp
@@ -25,7 +25,8 @@
     pWidget->GetBorderColorAndThickness(&cr, &fWidth);
     pParams.m_pGraphics->SetStrokeColor(CFGAS_GEColor(cr));
     pParams.m_pGraphics->SetLineWidth(fWidth);
-    pParams.m_pGraphics->StrokePath(pParams.m_pPath.Get(), &pParams.m_matrix);
+    if (pParams.m_pPath)
+      pParams.m_pGraphics->StrokePath(*pParams.m_pPath, &pParams.m_matrix);
     return;
   }
 
@@ -40,9 +41,11 @@
         CFGAS_GEGraphics* pGraphics = pParams.m_pGraphics.Get();
         pGraphics->SaveGraphState();
         pGraphics->SetFillColor(CFGAS_GEColor(FWLTHEME_COLOR_BKSelected));
-        pGraphics->FillPath(pParams.m_pPath.Get(),
-                            CFX_FillRenderOptions::FillType::kWinding,
-                            pParams.m_matrix);
+        if (pParams.m_pPath) {
+          pGraphics->FillPath(*pParams.m_pPath,
+                              CFX_FillRenderOptions::FillType::kWinding,
+                              pParams.m_matrix);
+        }
         pGraphics->RestoreGraphState();
       } else {
         CFGAS_GEPath path;
@@ -60,7 +63,7 @@
         pParams.m_pGraphics->SaveGraphState();
         pParams.m_pGraphics->SetFillColor(cr);
         pParams.m_pGraphics->FillPath(
-            &path, CFX_FillRenderOptions::FillType::kWinding, pParams.m_matrix);
+            path, CFX_FillRenderOptions::FillType::kWinding, pParams.m_matrix);
         pParams.m_pGraphics->RestoreGraphState();
       }
       break;
@@ -68,7 +71,8 @@
     case CFWL_Part::CombTextLine: {
       pParams.m_pGraphics->SetStrokeColor(CFGAS_GEColor(0xFF000000));
       pParams.m_pGraphics->SetLineWidth(1.0f);
-      pParams.m_pGraphics->StrokePath(pParams.m_pPath.Get(), &pParams.m_matrix);
+      if (pParams.m_pPath)
+        pParams.m_pGraphics->StrokePath(*pParams.m_pPath, &pParams.m_matrix);
       break;
     }
     default:
diff --git a/xfa/fwl/theme/cfwl_listboxtp.cpp b/xfa/fwl/theme/cfwl_listboxtp.cpp
index 4ce7a5f..4712cd7 100644
--- a/xfa/fwl/theme/cfwl_listboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_listboxtp.cpp
@@ -69,7 +69,7 @@
 #else
     path.AddRectangle(rtItem.left, rtItem.top, rtItem.width, rtItem.height);
 #endif
-    pGraphics->FillPath(&path, CFX_FillRenderOptions::FillType::kWinding,
+    pGraphics->FillPath(path, CFX_FillRenderOptions::FillType::kWinding,
                         matrix);
     pGraphics->RestoreGraphState();
   }
diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
index 69c627a..c47b13a 100644
--- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp
+++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
@@ -105,8 +105,8 @@
   path.AddRectangle(rtTotal.left, rtTotal.top, rtTotal.width, rtTotal.height);
   pParams.m_pGraphics->SaveGraphState();
   pParams.m_pGraphics->SetFillColor(CFGAS_GEColor(kBackgroundColor));
-  pParams.m_pGraphics->FillPath(
-      &path, CFX_FillRenderOptions::FillType::kWinding, matrix);
+  pParams.m_pGraphics->FillPath(path, CFX_FillRenderOptions::FillType::kWinding,
+                                matrix);
   pParams.m_pGraphics->RestoreGraphState();
 }
 
@@ -117,8 +117,8 @@
   path.AddRectangle(rtHead.left, rtHead.top, rtHead.width, rtHead.height);
   pParams.m_pGraphics->SaveGraphState();
   pParams.m_pGraphics->SetFillColor(CFGAS_GEColor(kBackgroundColor));
-  pParams.m_pGraphics->FillPath(
-      &path, CFX_FillRenderOptions::FillType::kWinding, matrix);
+  pParams.m_pGraphics->FillPath(path, CFX_FillRenderOptions::FillType::kWinding,
+                                matrix);
   pParams.m_pGraphics->RestoreGraphState();
 }
 
@@ -130,17 +130,17 @@
   pParams.m_pGraphics->SaveGraphState();
   pParams.m_pGraphics->SetStrokeColor(
       CFGAS_GEColor(ArgbEncode(0xff, 205, 219, 243)));
-  pParams.m_pGraphics->StrokePath(&path, &matrix);
+  pParams.m_pGraphics->StrokePath(path, &matrix);
   if (pParams.m_dwStates & CFWL_PartState_Pressed) {
     pParams.m_pGraphics->SetFillColor(
         CFGAS_GEColor(ArgbEncode(0xff, 174, 198, 242)));
     pParams.m_pGraphics->FillPath(
-        &path, CFX_FillRenderOptions::FillType::kWinding, matrix);
+        path, CFX_FillRenderOptions::FillType::kWinding, matrix);
   } else {
     pParams.m_pGraphics->SetFillColor(
         CFGAS_GEColor(ArgbEncode(0xff, 227, 235, 249)));
     pParams.m_pGraphics->FillPath(
-        &path, CFX_FillRenderOptions::FillType::kWinding, matrix);
+        path, CFX_FillRenderOptions::FillType::kWinding, matrix);
   }
 
   path.Clear();
@@ -153,7 +153,7 @@
 
   pParams.m_pGraphics->SetStrokeColor(
       CFGAS_GEColor(ArgbEncode(0xff, 50, 104, 205)));
-  pParams.m_pGraphics->StrokePath(&path, &matrix);
+  pParams.m_pGraphics->StrokePath(path, &matrix);
   pParams.m_pGraphics->RestoreGraphState();
 }
 
@@ -165,17 +165,17 @@
   pParams.m_pGraphics->SaveGraphState();
   pParams.m_pGraphics->SetStrokeColor(
       CFGAS_GEColor(ArgbEncode(0xff, 205, 219, 243)));
-  pParams.m_pGraphics->StrokePath(&path, &matrix);
+  pParams.m_pGraphics->StrokePath(path, &matrix);
   if (pParams.m_dwStates & CFWL_PartState_Pressed) {
     pParams.m_pGraphics->SetFillColor(
         CFGAS_GEColor(ArgbEncode(0xff, 174, 198, 242)));
     pParams.m_pGraphics->FillPath(
-        &path, CFX_FillRenderOptions::FillType::kWinding, matrix);
+        path, CFX_FillRenderOptions::FillType::kWinding, matrix);
   } else {
     pParams.m_pGraphics->SetFillColor(
         CFGAS_GEColor(ArgbEncode(0xff, 227, 235, 249)));
     pParams.m_pGraphics->FillPath(
-        &path, CFX_FillRenderOptions::FillType::kWinding, matrix);
+        path, CFX_FillRenderOptions::FillType::kWinding, matrix);
   }
 
   path.Clear();
@@ -188,7 +188,7 @@
 
   pParams.m_pGraphics->SetStrokeColor(
       CFGAS_GEColor(ArgbEncode(0xff, 50, 104, 205)));
-  pParams.m_pGraphics->StrokePath(&path, &matrix);
+  pParams.m_pGraphics->StrokePath(path, &matrix);
   pParams.m_pGraphics->RestoreGraphState();
 }
 
@@ -200,7 +200,7 @@
   path.LineTo(CFX_PointF(rtHSep.right(), rtHSep.top + rtHSep.height / 2));
   pParams.m_pGraphics->SaveGraphState();
   pParams.m_pGraphics->SetStrokeColor(CFGAS_GEColor(kSeparatorColor));
-  pParams.m_pGraphics->StrokePath(&path, &matrix);
+  pParams.m_pGraphics->StrokePath(path, &matrix);
   pParams.m_pGraphics->RestoreGraphState();
 }
 
@@ -212,7 +212,7 @@
   path.LineTo(rtWeekSep.BottomLeft());
   pParams.m_pGraphics->SaveGraphState();
   pParams.m_pGraphics->SetStrokeColor(CFGAS_GEColor(kSeparatorColor));
-  pParams.m_pGraphics->StrokePath(&path, &matrix);
+  pParams.m_pGraphics->StrokePath(path, &matrix);
   pParams.m_pGraphics->RestoreGraphState();
 }
 
@@ -227,7 +227,7 @@
     pParams.m_pGraphics->SetFillColor(
         CFGAS_GEColor(kDatesSelectedBackgroundColor));
     pParams.m_pGraphics->FillPath(
-        &path, CFX_FillRenderOptions::FillType::kWinding, matrix);
+        path, CFX_FillRenderOptions::FillType::kWinding, matrix);
   } else if (pParams.m_dwStates & CFWL_PartState_Hovered) {
     CFGAS_GEPath path;
     CFX_RectF rtSelDay = pParams.m_PartRect;
@@ -236,7 +236,7 @@
     pParams.m_pGraphics->SetFillColor(
         CFGAS_GEColor(kDatesHoverBackgroundColor));
     pParams.m_pGraphics->FillPath(
-        &path, CFX_FillRenderOptions::FillType::kWinding, matrix);
+        path, CFX_FillRenderOptions::FillType::kWinding, matrix);
   }
   pParams.m_pGraphics->RestoreGraphState();
 }
@@ -250,7 +250,7 @@
                     rtSelDay.height);
   pParams.m_pGraphics->SaveGraphState();
   pParams.m_pGraphics->SetStrokeColor(CFGAS_GEColor(kDatesCircleColor));
-  pParams.m_pGraphics->StrokePath(&path, &matrix);
+  pParams.m_pGraphics->StrokePath(path, &matrix);
   pParams.m_pGraphics->RestoreGraphState();
 }
 
@@ -262,7 +262,7 @@
                     rtTodayCircle.height);
   pParams.m_pGraphics->SaveGraphState();
   pParams.m_pGraphics->SetStrokeColor(CFGAS_GEColor(kDatesCircleColor));
-  pParams.m_pGraphics->StrokePath(&path, &matrix);
+  pParams.m_pGraphics->StrokePath(path, &matrix);
   pParams.m_pGraphics->RestoreGraphState();
 }
 
diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
index 68f5cb7..724854e 100644
--- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp
+++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
@@ -50,7 +50,7 @@
           CFX_PointF(rect.left + PUSHBUTTON_SIZE_Corner, rect.top));
 
       CFGAS_GEPath fillPath;
-      fillPath.AddSubpath(&strokePath);
+      fillPath.AddSubpath(strokePath);
 
       CFGAS_GEGraphics* pGraphics = pParams.m_pGraphics.Get();
       pGraphics->SaveGraphState();
@@ -66,14 +66,14 @@
                     pParams.m_matrix);
 
       pGraphics->SetStrokeColor(CFGAS_GEColor(m_pThemeData->clrBorder[iColor]));
-      pGraphics->StrokePath(&strokePath, &pParams.m_matrix);
+      pGraphics->StrokePath(strokePath, &pParams.m_matrix);
 
       fillPath.Clear();
       fillPath.AddRectangle(rtInner.left, rtInner.top, rtInner.width,
                             rtInner.height);
 
       pGraphics->SetFillColor(CFGAS_GEColor(m_pThemeData->clrFill[iColor]));
-      pGraphics->FillPath(&fillPath, CFX_FillRenderOptions::FillType::kWinding,
+      pGraphics->FillPath(fillPath, CFX_FillRenderOptions::FillType::kWinding,
                           pParams.m_matrix);
       if (pParams.m_dwStates & CFWL_PartState_Focused) {
         rtInner.Inflate(1, 1, 0, 0);
diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp
index 3d918b8..1d4ed3e 100644
--- a/xfa/fwl/theme/cfwl_scrollbartp.cpp
+++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp
@@ -96,7 +96,7 @@
   path.AddRectangle(rect.left, rect.top, rect.width, rect.height);
   pGraphics->SetStrokeColor(
       CFGAS_GEColor(m_pThemeData->clrBtnBorder[eState - 1]));
-  pGraphics->StrokePath(&path, &matrix);
+  pGraphics->StrokePath(path, &matrix);
   pGraphics->RestoreGraphState();
 }
 
@@ -126,7 +126,7 @@
     pGraphics->SetLineWidth(1);
     pGraphics->SetStrokeColor(
         CFGAS_GEColor(m_pThemeData->clrPawColorLight[eState - 1]));
-    pGraphics->StrokePath(&path, nullptr);
+    pGraphics->StrokePath(path, nullptr);
     fX++;
 
     path.Clear();
@@ -142,7 +142,7 @@
     pGraphics->SetLineWidth(1);
     pGraphics->SetStrokeColor(
         CFGAS_GEColor(m_pThemeData->clrPawColorDark[eState - 1]));
-    pGraphics->StrokePath(&path, &matrix);
+    pGraphics->StrokePath(path, &matrix);
   } else {
     float fPawLen = kPawLength;
     if (rect.height / 2 <= fPawLen) {
@@ -163,7 +163,7 @@
     pGraphics->SetLineWidth(1);
     pGraphics->SetStrokeColor(
         CFGAS_GEColor(m_pThemeData->clrPawColorLight[eState - 1]));
-    pGraphics->StrokePath(&path, &matrix);
+    pGraphics->StrokePath(path, &matrix);
     fY++;
 
     path.Clear();
@@ -179,7 +179,7 @@
     pGraphics->SetLineWidth(1);
     pGraphics->SetStrokeColor(
         CFGAS_GEColor(m_pThemeData->clrPawColorDark[eState - 1]));
-    pGraphics->StrokePath(&path, &matrix);
+    pGraphics->StrokePath(path, &matrix);
   }
 }
 
@@ -204,7 +204,7 @@
     path.AddRectangle(rect.left, fBottom - 1, rect.width, 1);
   }
   pGraphics->SetFillColor(CFGAS_GEColor(ArgbEncode(255, 238, 237, 229)));
-  pGraphics->FillPath(&path, CFX_FillRenderOptions::FillType::kWinding, matrix);
+  pGraphics->FillPath(path, CFX_FillRenderOptions::FillType::kWinding, matrix);
   path.Clear();
   path.AddRectangle(rect.left + 1, rect.top, rect.width - 2, rect.height);
   pGraphics->RestoreGraphState();
diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp
index afb922c..2febc07 100644
--- a/xfa/fwl/theme/cfwl_widgettp.cpp
+++ b/xfa/fwl/theme/cfwl_widgettp.cpp
@@ -97,7 +97,7 @@
                     rect.height - 2);
   pGraphics->SaveGraphState();
   pGraphics->SetFillColor(CFGAS_GEColor(ArgbEncode(255, 0, 0, 0)));
-  pGraphics->FillPath(&path, CFX_FillRenderOptions::FillType::kEvenOdd, matrix);
+  pGraphics->FillPath(path, CFX_FillRenderOptions::FillType::kEvenOdd, matrix);
   pGraphics->RestoreGraphState();
 }
 
@@ -118,7 +118,7 @@
   path.AddRectangle(rect.left, rect.top, rect.width, rect.height);
   pGraphics->SaveGraphState();
   pGraphics->SetFillColor(CFGAS_GEColor(fillColor));
-  pGraphics->FillPath(&path, CFX_FillRenderOptions::FillType::kWinding, matrix);
+  pGraphics->FillPath(path, CFX_FillRenderOptions::FillType::kWinding, matrix);
   pGraphics->RestoreGraphState();
 }
 
@@ -134,7 +134,7 @@
   pGraphics->SetStrokeColor(CFGAS_GEColor(0xFF000000));
   static constexpr float kDashPattern[2] = {1, 1};
   pGraphics->SetLineDash(0.0f, kDashPattern);
-  pGraphics->StrokePath(&path, &matrix);
+  pGraphics->StrokePath(path, &matrix);
   pGraphics->RestoreGraphState();
 }
 
@@ -187,7 +187,7 @@
     }
   }
   pGraphics->SetFillColor(CFGAS_GEColor(argSign));
-  pGraphics->FillPath(&path, CFX_FillRenderOptions::FillType::kWinding, matrix);
+  pGraphics->FillPath(path, CFX_FillRenderOptions::FillType::kWinding, matrix);
 }
 
 void CFWL_WidgetTP::DrawBtn(CFGAS_GEGraphics* pGraphics,
@@ -200,7 +200,7 @@
   CFGAS_GEPath path;
   path.AddRectangle(rect.left, rect.top, rect.width, rect.height);
   pGraphics->SetStrokeColor(CFGAS_GEColor(m_pColorData->clrBorder[eState - 1]));
-  pGraphics->StrokePath(&path, &matrix);
+  pGraphics->StrokePath(path, &matrix);
 }
 
 void CFWL_WidgetTP::DrawArrowBtn(CFGAS_GEGraphics* pGraphics,
diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp
index 5898c77..068214f 100644
--- a/xfa/fxfa/cxfa_fffield.cpp
+++ b/xfa/fxfa/cxfa_fffield.cpp
@@ -108,7 +108,7 @@
     path.AddRectangle(m_UIRect.left, m_UIRect.top, m_UIRect.width,
                       m_UIRect.height);
 
-  pGS->FillPath(&path, CFX_FillRenderOptions::FillType::kWinding, pMatrix);
+  pGS->FillPath(path, CFX_FillRenderOptions::FillType::kWinding, pMatrix);
 }
 
 void CXFA_FFField::DrawFocus(CFGAS_GEGraphics* pGS, CFX_Matrix* pMatrix) {
@@ -124,7 +124,7 @@
   CFGAS_GEPath path;
   path.AddRectangle(m_UIRect.left, m_UIRect.top, m_UIRect.width,
                     m_UIRect.height);
-  pGS->StrokePath(&path, pMatrix);
+  pGS->StrokePath(path, pMatrix);
 }
 
 CFWL_Widget* CXFA_FFField::GetNormalWidget() {
diff --git a/xfa/fxfa/cxfa_ffline.cpp b/xfa/fxfa/cxfa_ffline.cpp
index defb771..c54ffe0 100644
--- a/xfa/fxfa/cxfa_ffline.cpp
+++ b/xfa/fxfa/cxfa_ffline.cpp
@@ -135,6 +135,6 @@
 
   pGS->SetStrokeColor(CFGAS_GEColor(lineColor));
   pGS->SetLineCap(LineCapToFXGE(iCap));
-  pGS->StrokePath(&linePath, &mtRotate);
+  pGS->StrokePath(linePath, &mtRotate);
   pGS->RestoreGraphState();
 }
diff --git a/xfa/fxfa/cxfa_ffpushbutton.cpp b/xfa/fxfa/cxfa_ffpushbutton.cpp
index 5ae31f0..ab14e40 100644
--- a/xfa/fxfa/cxfa_ffpushbutton.cpp
+++ b/xfa/fxfa/cxfa_ffpushbutton.cpp
@@ -222,7 +222,7 @@
       CFGAS_GEPath path;
       path.AddRectangle(rtFill.left, rtFill.top, rtFill.width, rtFill.height);
       pGraphics->SetFillColor(CFGAS_GEColor(ArgbEncode(128, 128, 255, 255)));
-      pGraphics->FillPath(&path, CFX_FillRenderOptions::FillType::kWinding,
+      pGraphics->FillPath(path, CFX_FillRenderOptions::FillType::kWinding,
                           matrix);
     }
     return;
@@ -238,7 +238,7 @@
       CFGAS_GEPath path;
       CFX_RectF rect = pWidget->GetWidgetRect();
       path.AddRectangle(0, 0, rect.width, rect.height);
-      pGraphics->StrokePath(&path, &matrix);
+      pGraphics->StrokePath(path, &matrix);
     }
   }
 }
diff --git a/xfa/fxfa/parser/cxfa_box.cpp b/xfa/fxfa/parser/cxfa_box.cpp
index b472979..dd196fc 100644
--- a/xfa/fxfa/parser/cxfa_box.cpp
+++ b/xfa/fxfa/parser/cxfa_box.cpp
@@ -238,7 +238,7 @@
   }
   fillPath.Close();
 
-  fill->Draw(pGS, &fillPath, rtWidget, matrix);
+  fill->Draw(pGS, fillPath, rtWidget, matrix);
   pGS->RestoreGraphState();
 }
 
@@ -304,7 +304,7 @@
     CFGAS_GEPath arcPath;
     GetPathArcOrRounded(rtWidget, forceRound, &arcPath);
     if (edge)
-      edge->Stroke(&arcPath, pGS, matrix);
+      edge->Stroke(pGS, arcPath, matrix);
     return;
   }
   pGS->SaveGraphState();
@@ -329,25 +329,25 @@
                  FX_PI);
 
   pGS->SetStrokeColor(CFGAS_GEColor(0xFF808080));
-  pGS->StrokePath(&arcPath, &matrix);
+  pGS->StrokePath(arcPath, &matrix);
   arcPath.Clear();
   arcPath.AddArc(rtWidget.TopLeft(), rtWidget.Size(), -1.0f * FX_PI / 4.0f,
                  FX_PI);
 
   pGS->SetStrokeColor(CFGAS_GEColor(0xFFFFFFFF));
-  pGS->StrokePath(&arcPath, &matrix);
+  pGS->StrokePath(arcPath, &matrix);
   rtWidget.Deflate(fHalf, fHalf);
   arcPath.Clear();
   arcPath.AddArc(rtWidget.TopLeft(), rtWidget.Size(), 3.0f * FX_PI / 4.0f,
                  FX_PI);
 
   pGS->SetStrokeColor(CFGAS_GEColor(0xFF404040));
-  pGS->StrokePath(&arcPath, &matrix);
+  pGS->StrokePath(arcPath, &matrix);
   arcPath.Clear();
   arcPath.AddArc(rtWidget.TopLeft(), rtWidget.Size(), -1.0f * FX_PI / 4.0f,
                  FX_PI);
 
   pGS->SetStrokeColor(CFGAS_GEColor(0xFFC0C0C0));
-  pGS->StrokePath(&arcPath, &matrix);
+  pGS->StrokePath(arcPath, &matrix);
   pGS->RestoreGraphState();
 }
diff --git a/xfa/fxfa/parser/cxfa_fill.cpp b/xfa/fxfa/parser/cxfa_fill.cpp
index 899a282..77a5921 100644
--- a/xfa/fxfa/parser/cxfa_fill.cpp
+++ b/xfa/fxfa/parser/cxfa_fill.cpp
@@ -88,7 +88,7 @@
 }
 
 void CXFA_Fill::Draw(CFGAS_GEGraphics* pGS,
-                     CFGAS_GEPath* fillPath,
+                     const CFGAS_GEPath& fillPath,
                      const CFX_RectF& rtWidget,
                      const CFX_Matrix& matrix) {
   pGS->SaveGraphState();
@@ -117,7 +117,7 @@
 }
 
 void CXFA_Fill::DrawStipple(CFGAS_GEGraphics* pGS,
-                            CFGAS_GEPath* fillPath,
+                            const CFGAS_GEPath& fillPath,
                             const CFX_RectF& rtWidget,
                             const CFX_Matrix& matrix) {
   CXFA_Stipple* stipple =
@@ -127,7 +127,7 @@
 }
 
 void CXFA_Fill::DrawRadial(CFGAS_GEGraphics* pGS,
-                           CFGAS_GEPath* fillPath,
+                           const CFGAS_GEPath& fillPath,
                            const CFX_RectF& rtWidget,
                            const CFX_Matrix& matrix) {
   CXFA_Radial* radial =
@@ -137,7 +137,7 @@
 }
 
 void CXFA_Fill::DrawLinear(CFGAS_GEGraphics* pGS,
-                           CFGAS_GEPath* fillPath,
+                           const CFGAS_GEPath& fillPath,
                            const CFX_RectF& rtWidget,
                            const CFX_Matrix& matrix) {
   CXFA_Linear* linear =
@@ -147,7 +147,7 @@
 }
 
 void CXFA_Fill::DrawPattern(CFGAS_GEGraphics* pGS,
-                            CFGAS_GEPath* fillPath,
+                            const CFGAS_GEPath& fillPath,
                             const CFX_RectF& rtWidget,
                             const CFX_Matrix& matrix) {
   CXFA_Pattern* pattern =
diff --git a/xfa/fxfa/parser/cxfa_fill.h b/xfa/fxfa/parser/cxfa_fill.h
index 3253da8..d1fa47c 100644
--- a/xfa/fxfa/parser/cxfa_fill.h
+++ b/xfa/fxfa/parser/cxfa_fill.h
@@ -29,7 +29,7 @@
   void SetColor(FX_ARGB color);
 
   void Draw(CFGAS_GEGraphics* pGS,
-            CFGAS_GEPath* fillPath,
+            const CFGAS_GEPath& fillPath,
             const CFX_RectF& rtWidget,
             const CFX_Matrix& matrix);
 
@@ -39,19 +39,19 @@
   XFA_Element GetType() const;
 
   void DrawStipple(CFGAS_GEGraphics* pGS,
-                   CFGAS_GEPath* fillPath,
+                   const CFGAS_GEPath& fillPath,
                    const CFX_RectF& rtWidget,
                    const CFX_Matrix& matrix);
   void DrawRadial(CFGAS_GEGraphics* pGS,
-                  CFGAS_GEPath* fillPath,
+                  const CFGAS_GEPath& fillPath,
                   const CFX_RectF& rtWidget,
                   const CFX_Matrix& matrix);
   void DrawLinear(CFGAS_GEGraphics* pGS,
-                  CFGAS_GEPath* fillPath,
+                  const CFGAS_GEPath& fillPath,
                   const CFX_RectF& rtWidget,
                   const CFX_Matrix& matrix);
   void DrawPattern(CFGAS_GEGraphics* pGS,
-                   CFGAS_GEPath* fillPath,
+                   const CFGAS_GEPath& fillPath,
                    const CFX_RectF& rtWidget,
                    const CFX_Matrix& matrix);
 };
diff --git a/xfa/fxfa/parser/cxfa_linear.cpp b/xfa/fxfa/parser/cxfa_linear.cpp
index 7e539fc..581829b 100644
--- a/xfa/fxfa/parser/cxfa_linear.cpp
+++ b/xfa/fxfa/parser/cxfa_linear.cpp
@@ -53,7 +53,7 @@
 }
 
 void CXFA_Linear::Draw(CFGAS_GEGraphics* pGS,
-                       CFGAS_GEPath* fillPath,
+                       const CFGAS_GEPath& fillPath,
                        FX_ARGB crStart,
                        const CFX_RectF& rtFill,
                        const CFX_Matrix& matrix) {
@@ -84,7 +84,6 @@
   }
 
   CFGAS_GEShading shading(ptStart, ptEnd, false, false, crStart, crEnd);
-
   pGS->SaveGraphState();
   pGS->SetFillColor(CFGAS_GEColor(&shading));
   pGS->FillPath(fillPath, CFX_FillRenderOptions::FillType::kWinding, matrix);
diff --git a/xfa/fxfa/parser/cxfa_linear.h b/xfa/fxfa/parser/cxfa_linear.h
index 7d61fc6..7703466 100644
--- a/xfa/fxfa/parser/cxfa_linear.h
+++ b/xfa/fxfa/parser/cxfa_linear.h
@@ -23,7 +23,7 @@
   ~CXFA_Linear() override;
 
   void Draw(CFGAS_GEGraphics* pGS,
-            CFGAS_GEPath* fillPath,
+            const CFGAS_GEPath& fillPath,
             FX_ARGB crStart,
             const CFX_RectF& rtFill,
             const CFX_Matrix& matrix);
diff --git a/xfa/fxfa/parser/cxfa_pattern.cpp b/xfa/fxfa/parser/cxfa_pattern.cpp
index 0005abd..8109f1d 100644
--- a/xfa/fxfa/parser/cxfa_pattern.cpp
+++ b/xfa/fxfa/parser/cxfa_pattern.cpp
@@ -51,13 +51,12 @@
 }
 
 void CXFA_Pattern::Draw(CFGAS_GEGraphics* pGS,
-                        CFGAS_GEPath* fillPath,
+                        const CFGAS_GEPath& fillPath,
                         FX_ARGB crStart,
                         const CFX_RectF& rtFill,
                         const CFX_Matrix& matrix) {
   CXFA_Color* pColor = GetColorIfExists();
   FX_ARGB crEnd = pColor ? pColor->GetValue() : CXFA_Color::kBlackColor;
-
   FX_HatchStyle iHatch = FX_HatchStyle::Cross;
   switch (GetType()) {
     case XFA_AttributeValue::CrossDiagonal:
@@ -80,7 +79,6 @@
   }
 
   CFGAS_GEPattern pattern(iHatch, crEnd, crStart);
-
   pGS->SaveGraphState();
   pGS->SetFillColor(CFGAS_GEColor(&pattern, 0x0));
   pGS->FillPath(fillPath, CFX_FillRenderOptions::FillType::kWinding, matrix);
diff --git a/xfa/fxfa/parser/cxfa_pattern.h b/xfa/fxfa/parser/cxfa_pattern.h
index 4e52b6c..370f686 100644
--- a/xfa/fxfa/parser/cxfa_pattern.h
+++ b/xfa/fxfa/parser/cxfa_pattern.h
@@ -23,7 +23,7 @@
   ~CXFA_Pattern() override;
 
   void Draw(CFGAS_GEGraphics* pGS,
-            CFGAS_GEPath* fillPath,
+            const CFGAS_GEPath& fillPath,
             FX_ARGB crStart,
             const CFX_RectF& rtFill,
             const CFX_Matrix& matrix);
diff --git a/xfa/fxfa/parser/cxfa_radial.cpp b/xfa/fxfa/parser/cxfa_radial.cpp
index 4b4558e..a65d72c 100644
--- a/xfa/fxfa/parser/cxfa_radial.cpp
+++ b/xfa/fxfa/parser/cxfa_radial.cpp
@@ -54,7 +54,7 @@
 }
 
 void CXFA_Radial::Draw(CFGAS_GEGraphics* pGS,
-                       CFGAS_GEPath* fillPath,
+                       const CFGAS_GEPath& fillPath,
                        FX_ARGB crStart,
                        const CFX_RectF& rtFill,
                        const CFX_Matrix& matrix) {
diff --git a/xfa/fxfa/parser/cxfa_radial.h b/xfa/fxfa/parser/cxfa_radial.h
index c21cc68..17ee719 100644
--- a/xfa/fxfa/parser/cxfa_radial.h
+++ b/xfa/fxfa/parser/cxfa_radial.h
@@ -20,7 +20,7 @@
   ~CXFA_Radial() override;
 
   void Draw(CFGAS_GEGraphics* pGS,
-            CFGAS_GEPath* fillPath,
+            const CFGAS_GEPath& fillPath,
             FX_ARGB crStart,
             const CFX_RectF& rtFill,
             const CFX_Matrix& matrix);
diff --git a/xfa/fxfa/parser/cxfa_rectangle.cpp b/xfa/fxfa/parser/cxfa_rectangle.cpp
index 930ca8e..7ecd4c5 100644
--- a/xfa/fxfa/parser/cxfa_rectangle.cpp
+++ b/xfa/fxfa/parser/cxfa_rectangle.cpp
@@ -339,7 +339,7 @@
       bool bEmpty = path.IsEmpty();
       if (!bEmpty) {
         if (stroke)
-          stroke->Stroke(&path, pGS, matrix);
+          stroke->Stroke(pGS, path, matrix);
         path.Clear();
       }
       bStart = true;
@@ -350,7 +350,7 @@
     bStart = !stroke->SameStyles(strokes[(i + 1) % 8], 0);
     if (bStart) {
       if (stroke)
-        stroke->Stroke(&path, pGS, matrix);
+        stroke->Stroke(pGS, path, matrix);
       path.Clear();
     }
   }
@@ -360,7 +360,7 @@
       path.Close();
     }
     if (strokes[7])
-      strokes[7]->Stroke(&path, pGS, matrix);
+      strokes[7]->Stroke(pGS, path, matrix);
   }
 }
 
@@ -381,8 +381,7 @@
   pathLT.LineTo(CFX_PointF(rt.left + fLineWidth, fBottom - fLineWidth));
   pathLT.LineTo(CFX_PointF(rt.left, fBottom));
   pGraphic->SetFillColor(CFGAS_GEColor(argbTopLeft));
-  pGraphic->FillPath(&pathLT, CFX_FillRenderOptions::FillType::kWinding,
-                     matrix);
+  pGraphic->FillPath(pathLT, CFX_FillRenderOptions::FillType::kWinding, matrix);
 
   CFGAS_GEPath pathRB;
   pathRB.MoveTo(CFX_PointF(fRight, rt.top));
@@ -393,8 +392,7 @@
   pathRB.LineTo(CFX_PointF(fRight - fLineWidth, rt.top + fLineWidth));
   pathRB.LineTo(CFX_PointF(fRight, rt.top));
   pGraphic->SetFillColor(CFGAS_GEColor(argbBottomRight));
-  pGraphic->FillPath(&pathRB, CFX_FillRenderOptions::FillType::kWinding,
-                     matrix);
+  pGraphic->FillPath(pathRB, CFX_FillRenderOptions::FillType::kWinding, matrix);
 }
 
 void CXFA_Rectangle::StrokeLowered(CFGAS_GEGraphics* pGS,
@@ -409,7 +407,7 @@
   path.AddRectangle(rt.left, rt.top, rt.width, rt.height);
   path.AddRectangle(rtInner.left, rtInner.top, rtInner.width, rtInner.height);
   pGS->SetFillColor(CFGAS_GEColor(0xFF000000));
-  pGS->FillPath(&path, CFX_FillRenderOptions::FillType::kEvenOdd, matrix);
+  pGS->FillPath(path, CFX_FillRenderOptions::FillType::kEvenOdd, matrix);
   StrokeRect(pGS, rtInner, fHalfWidth, matrix, 0xFF808080, 0xFFC0C0C0);
 }
 
@@ -425,7 +423,7 @@
   path.AddRectangle(rt.left, rt.top, rt.width, rt.height);
   path.AddRectangle(rtInner.left, rtInner.top, rtInner.width, rtInner.height);
   pGS->SetFillColor(CFGAS_GEColor(0xFF000000));
-  pGS->FillPath(&path, CFX_FillRenderOptions::FillType::kEvenOdd, matrix);
+  pGS->FillPath(path, CFX_FillRenderOptions::FillType::kEvenOdd, matrix);
   StrokeRect(pGS, rtInner, fHalfWidth, matrix, 0xFFFFFFFF, 0xFF808080);
 }
 
diff --git a/xfa/fxfa/parser/cxfa_stipple.cpp b/xfa/fxfa/parser/cxfa_stipple.cpp
index 08413e7..1741315 100644
--- a/xfa/fxfa/parser/cxfa_stipple.cpp
+++ b/xfa/fxfa/parser/cxfa_stipple.cpp
@@ -51,7 +51,7 @@
 }
 
 void CXFA_Stipple::Draw(CFGAS_GEGraphics* pGS,
-                        CFGAS_GEPath* fillPath,
+                        const CFGAS_GEPath& fillPath,
                         const CFX_RectF& rtFill,
                         const CFX_Matrix& matrix) {
   int32_t iRate = GetRate();
diff --git a/xfa/fxfa/parser/cxfa_stipple.h b/xfa/fxfa/parser/cxfa_stipple.h
index ac6195a..2bf6938 100644
--- a/xfa/fxfa/parser/cxfa_stipple.h
+++ b/xfa/fxfa/parser/cxfa_stipple.h
@@ -22,7 +22,7 @@
   ~CXFA_Stipple() override;
 
   void Draw(CFGAS_GEGraphics* pGS,
-            CFGAS_GEPath* fillPath,
+            const CFGAS_GEPath& fillPath,
             const CFX_RectF& rtFill,
             const CFX_Matrix& matrix);
 
diff --git a/xfa/fxfa/parser/cxfa_stroke.cpp b/xfa/fxfa/parser/cxfa_stroke.cpp
index 1296c7c..0a3dd5c 100644
--- a/xfa/fxfa/parser/cxfa_stroke.cpp
+++ b/xfa/fxfa/parser/cxfa_stroke.cpp
@@ -167,8 +167,8 @@
   return true;
 }
 
-void CXFA_Stroke::Stroke(CFGAS_GEPath* pPath,
-                         CFGAS_GEGraphics* pGS,
+void CXFA_Stroke::Stroke(CFGAS_GEGraphics* pGS,
+                         const CFGAS_GEPath& pPath,
                          const CFX_Matrix& matrix) {
   if (!IsVisible())
     return;
diff --git a/xfa/fxfa/parser/cxfa_stroke.h b/xfa/fxfa/parser/cxfa_stroke.h
index a261849..8c1cc08 100644
--- a/xfa/fxfa/parser/cxfa_stroke.h
+++ b/xfa/fxfa/parser/cxfa_stroke.h
@@ -47,8 +47,8 @@
 
   bool SameStyles(CXFA_Stroke* stroke, uint32_t dwFlags);
 
-  void Stroke(CFGAS_GEPath* pPath,
-              CFGAS_GEGraphics* pGS,
+  void Stroke(CFGAS_GEGraphics* pGS,
+              const CFGAS_GEPath& pPath,
               const CFX_Matrix& matrix);
 
  protected: