Revert "Replace wrapper methods in CPDF_Path with -> operator."

This reverts commit d09a09751f724ecdb1a0bc307447a3d0c212ebff.

TBR=dsinclair@chromium.org

Review-Url: https://codereview.chromium.org/2291833002
diff --git a/BUILD.gn b/BUILD.gn
index 8d3e242..982c57a 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -447,6 +447,7 @@
     "core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp",
     "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h",
     "core/fpdfapi/fpdf_page/cpdf_textobject.cpp",
+    "core/fpdfapi/fpdf_page/cpdf_textstate.cpp",
     "core/fpdfapi/fpdf_page/cpdf_textstate.h",
     "core/fpdfapi/fpdf_page/cpdf_textstatedata.cpp",
     "core/fpdfapi/fpdf_page/cpdf_tilingpattern.cpp",
diff --git a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp
index eb43bd1..fb0c244 100644
--- a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp
@@ -104,7 +104,7 @@
 
         m_TextState.MakePrivateCopy();
         m_TextState->m_FontSize = pFont->GetNumberAt(1);
-        m_TextState->SetFont(pParser->FindFont(pFont->GetStringAt(0)));
+        m_TextState.SetFont(pParser->FindFont(pFont->GetStringAt(0)));
         break;
       }
       case FXBSTR_ID('T', 'R', 0, 0):
diff --git a/core/fpdfapi/fpdf_page/cpdf_clippath.cpp b/core/fpdfapi/fpdf_page/cpdf_clippath.cpp
index 51f3086..2c05df0 100644
--- a/core/fpdfapi/fpdf_page/cpdf_clippath.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_clippath.cpp
@@ -38,9 +38,9 @@
   FX_BOOL bStarted = FALSE;
   int count = GetPathCount();
   if (count) {
-    rect = GetPath(0)->GetBoundingBox();
+    rect = GetPath(0).GetBoundingBox();
     for (int i = 1; i < count; i++) {
-      CFX_FloatRect path_rect = GetPath(i)->GetBoundingBox();
+      CFX_FloatRect path_rect = GetPath(i).GetBoundingBox();
       rect.Intersect(path_rect);
     }
     bStarted = TRUE;
@@ -77,10 +77,10 @@
   CPDF_ClipPathData* pData = GetObject();
   if (!pData->m_PathAndTypeList.empty() && bAutoMerge) {
     const CPDF_Path& old_path = pData->m_PathAndTypeList.back().first;
-    if (old_path->IsRect()) {
-      CFX_FloatRect old_rect(old_path->GetPointX(0), old_path->GetPointY(0),
-                             old_path->GetPointX(2), old_path->GetPointY(2));
-      CFX_FloatRect new_rect = path->GetBoundingBox();
+    if (old_path.IsRect()) {
+      CFX_FloatRect old_rect(old_path.GetPointX(0), old_path.GetPointY(0),
+                             old_path.GetPointX(2), old_path.GetPointY(2));
+      CFX_FloatRect new_rect = path.GetBoundingBox();
       if (old_rect.Contains(new_rect))
         pData->m_PathAndTypeList.pop_back();
     }
diff --git a/core/fpdfapi/fpdf_page/cpdf_pathobject.cpp b/core/fpdfapi/fpdf_page/cpdf_pathobject.cpp
index d48c84b..ceb3dd4 100644
--- a/core/fpdfapi/fpdf_page/cpdf_pathobject.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_pathobject.cpp
@@ -48,9 +48,9 @@
   CFX_FloatRect rect;
   FX_FLOAT width = m_GraphState->m_LineWidth;
   if (m_bStroke && width != 0) {
-    rect = m_Path->GetBoundingBox(width, m_GraphState->m_MiterLimit);
+    rect = m_Path.GetBoundingBox(width, m_GraphState->m_MiterLimit);
   } else {
-    rect = m_Path->GetBoundingBox();
+    rect = m_Path.GetBoundingBox();
   }
   rect.Transform(&m_Matrix);
   if (width == 0 && m_bStroke) {
diff --git a/core/fpdfapi/fpdf_page/cpdf_textobject.cpp b/core/fpdfapi/fpdf_page/cpdf_textobject.cpp
index 7b39dff..a365335 100644
--- a/core/fpdfapi/fpdf_page/cpdf_textobject.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_textobject.cpp
@@ -35,7 +35,7 @@
   if (pInfo->m_CharCode == CPDF_Font::kInvalidCharCode) {
     return;
   }
-  CPDF_Font* pFont = m_TextState->GetFont();
+  CPDF_Font* pFont = m_TextState.GetFont();
   if (!pFont->IsCIDFont()) {
     return;
   }
@@ -47,7 +47,7 @@
   pInfo->m_OriginX = 0;
   short vx, vy;
   pFont->AsCIDFont()->GetVertOrigin(CID, vx, vy);
-  FX_FLOAT fontsize = m_TextState->GetFontSize();
+  FX_FLOAT fontsize = m_TextState.GetFontSize();
   pInfo->m_OriginX -= fontsize * vx / 1000;
   pInfo->m_OriginY -= fontsize * vy / 1000;
 }
@@ -137,7 +137,7 @@
   CFX_Matrix text_matrix;
   GetTextMatrix(&text_matrix);
   text_matrix.Concat(matrix);
-  FX_FLOAT* pTextMatrix = m_TextState->GetMatrix();
+  FX_FLOAT* pTextMatrix = m_TextState.GetMatrix();
   pTextMatrix[0] = text_matrix.GetA();
   pTextMatrix[1] = text_matrix.GetC();
   pTextMatrix[2] = text_matrix.GetB();
@@ -160,7 +160,7 @@
 }
 
 void CPDF_TextObject::GetTextMatrix(CFX_Matrix* pMatrix) const {
-  const FX_FLOAT* pTextMatrix = m_TextState->GetMatrix();
+  const FX_FLOAT* pTextMatrix = m_TextState.GetMatrix();
   pMatrix->Set(pTextMatrix[0], pTextMatrix[2], pTextMatrix[1], pTextMatrix[3],
                m_PosX, m_PosY);
 }
@@ -174,7 +174,7 @@
   }
   FX_Free(m_pCharPos);
   m_pCharPos = nullptr;
-  CPDF_Font* pFont = m_TextState->GetFont();
+  CPDF_Font* pFont = m_TextState.GetFont();
   m_nChars = 0;
   for (int i = 0; i < nsegs; ++i) {
     m_nChars += pFont->CountChar(pStrs[i].c_str(), pStrs[i].GetLength());
@@ -209,8 +209,8 @@
 }
 
 FX_FLOAT CPDF_TextObject::GetCharWidth(uint32_t charcode) const {
-  FX_FLOAT fontsize = m_TextState->GetFontSize() / 1000;
-  CPDF_Font* pFont = m_TextState->GetFont();
+  FX_FLOAT fontsize = m_TextState.GetFontSize() / 1000;
+  CPDF_Font* pFont = m_TextState.GetFont();
   FX_BOOL bVertWriting = FALSE;
   CPDF_CIDFont* pCIDFont = pFont->AsCIDFont();
   if (pCIDFont) {
@@ -232,11 +232,11 @@
 }
 
 CPDF_Font* CPDF_TextObject::GetFont() const {
-  return m_TextState->GetFont();
+  return m_TextState.GetFont();
 }
 
 FX_FLOAT CPDF_TextObject::GetFontSize() const {
-  return m_TextState->GetFontSize();
+  return m_TextState.GetFontSize();
 }
 
 void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX,
@@ -248,13 +248,13 @@
   FX_FLOAT max_x = -10000 * 1.0f;
   FX_FLOAT min_y = 10000 * 1.0f;
   FX_FLOAT max_y = -10000 * 1.0f;
-  CPDF_Font* pFont = m_TextState->GetFont();
+  CPDF_Font* pFont = m_TextState.GetFont();
   FX_BOOL bVertWriting = FALSE;
   CPDF_CIDFont* pCIDFont = pFont->AsCIDFont();
   if (pCIDFont) {
     bVertWriting = pCIDFont->IsVertWriting();
   }
-  FX_FLOAT fontsize = m_TextState->GetFontSize();
+  FX_FLOAT fontsize = m_TextState.GetFontSize();
   for (int i = 0; i < m_nChars; ++i) {
     uint32_t charcode =
         m_nChars == 1 ? (uint32_t)(uintptr_t)m_pCharCodes : m_pCharCodes[i];
diff --git a/core/fpdfapi/fpdf_page/cpdf_textstate.cpp b/core/fpdfapi/fpdf_page/cpdf_textstate.cpp
new file mode 100644
index 0000000..47e2116
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/cpdf_textstate.cpp
@@ -0,0 +1,47 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fpdfapi/fpdf_font/include/cpdf_font.h"
+#include "core/fpdfapi/fpdf_page/cpdf_textstate.h"
+#include "core/fpdfapi/fpdf_page/pageint.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
+
+void CPDF_TextState::SetFont(CPDF_Font* pFont) {
+  MakePrivateCopy();
+  CPDF_TextStateData* pStateData = GetObject();
+  CPDF_Document* pDoc = pStateData->m_pDocument;
+  CPDF_DocPageData* pPageData = pDoc ? pDoc->GetPageData() : nullptr;
+  if (pPageData && pStateData->m_pFont && !pPageData->IsForceClear())
+    pPageData->ReleaseFont(pStateData->m_pFont->GetFontDict());
+
+  pStateData->m_pDocument = pFont ? pFont->m_pDocument : nullptr;
+  pStateData->m_pFont = pFont;
+}
+
+FX_FLOAT CPDF_TextState::GetFontSizeV() const {
+  const FX_FLOAT* pMatrix = GetMatrix();
+  FX_FLOAT unit = FXSYS_sqrt2(pMatrix[1], pMatrix[3]);
+  FX_FLOAT size = unit * GetFontSize();
+  return (FX_FLOAT)FXSYS_fabs(size);
+}
+
+FX_FLOAT CPDF_TextState::GetFontSizeH() const {
+  const FX_FLOAT* pMatrix = GetMatrix();
+  FX_FLOAT unit = FXSYS_sqrt2(pMatrix[0], pMatrix[2]);
+  FX_FLOAT size = unit * GetFontSize();
+  return (FX_FLOAT)FXSYS_fabs(size);
+}
+
+FX_FLOAT CPDF_TextState::GetBaselineAngle() const {
+  const FX_FLOAT* m_Matrix = GetMatrix();
+  return FXSYS_atan2(m_Matrix[2], m_Matrix[0]);
+}
+
+FX_FLOAT CPDF_TextState::GetShearAngle() const {
+  const FX_FLOAT* m_Matrix = GetMatrix();
+  FX_FLOAT shear_angle = FXSYS_atan2(m_Matrix[1], m_Matrix[3]);
+  return GetBaselineAngle() + shear_angle;
+}
diff --git a/core/fpdfapi/fpdf_page/cpdf_textstate.h b/core/fpdfapi/fpdf_page/cpdf_textstate.h
index 744739a..59c988d 100644
--- a/core/fpdfapi/fpdf_page/cpdf_textstate.h
+++ b/core/fpdfapi/fpdf_page/cpdf_textstate.h
@@ -10,7 +10,21 @@
 #include "core/fpdfapi/fpdf_page/include/cpdf_textstatedata.h"
 #include "core/fxcrt/include/fx_basic.h"
 
+class CPDF_Font;
+
 class CPDF_TextState : public CFX_CountRef<CPDF_TextStateData> {
+ public:
+  CPDF_Font* GetFont() const { return GetObject()->m_pFont; }
+  void SetFont(CPDF_Font* pFont);
+
+  FX_FLOAT GetFontSize() const { return GetObject()->m_FontSize; }
+  FX_FLOAT* GetMatrix() { return GetObject()->m_Matrix; }
+  const FX_FLOAT* GetMatrix() const { return GetObject()->m_Matrix; }
+
+  FX_FLOAT GetFontSizeV() const;
+  FX_FLOAT GetFontSizeH() const;
+  FX_FLOAT GetBaselineAngle() const;
+  FX_FLOAT GetShearAngle() const;
 };
 
 #endif  // CORE_FPDFAPI_FPDF_PAGE_CPDF_TEXTSTATE_H_
diff --git a/core/fpdfapi/fpdf_page/cpdf_textstatedata.cpp b/core/fpdfapi/fpdf_page/cpdf_textstatedata.cpp
index 9ae99a1..e60af00 100644
--- a/core/fpdfapi/fpdf_page/cpdf_textstatedata.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_textstatedata.cpp
@@ -72,38 +72,3 @@
       pPageData->ReleaseFont(m_pFont->GetFontDict());
   }
 }
-
-void CPDF_TextStateData::SetFont(CPDF_Font* pFont) {
-  CPDF_DocPageData* pPageData =
-      m_pDocument ? m_pDocument->GetPageData() : nullptr;
-  if (pPageData && m_pFont && !pPageData->IsForceClear())
-    pPageData->ReleaseFont(m_pFont->GetFontDict());
-
-  m_pDocument = pFont ? pFont->m_pDocument : nullptr;
-  m_pFont = pFont;
-}
-
-FX_FLOAT CPDF_TextStateData::GetFontSizeV() const {
-  const FX_FLOAT* pMatrix = GetMatrix();
-  FX_FLOAT unit = FXSYS_sqrt2(pMatrix[1], pMatrix[3]);
-  FX_FLOAT size = unit * GetFontSize();
-  return (FX_FLOAT)FXSYS_fabs(size);
-}
-
-FX_FLOAT CPDF_TextStateData::GetFontSizeH() const {
-  const FX_FLOAT* pMatrix = GetMatrix();
-  FX_FLOAT unit = FXSYS_sqrt2(pMatrix[0], pMatrix[2]);
-  FX_FLOAT size = unit * GetFontSize();
-  return (FX_FLOAT)FXSYS_fabs(size);
-}
-
-FX_FLOAT CPDF_TextStateData::GetBaselineAngle() const {
-  const FX_FLOAT* pMatrix = GetMatrix();
-  return FXSYS_atan2(pMatrix[2], pMatrix[0]);
-}
-
-FX_FLOAT CPDF_TextStateData::GetShearAngle() const {
-  const FX_FLOAT* pMatrix = GetMatrix();
-  FX_FLOAT shear_angle = FXSYS_atan2(pMatrix[1], pMatrix[3]);
-  return GetBaselineAngle() + shear_angle;
-}
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 5d5b75b..3afcf4b 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -1144,7 +1144,7 @@
   m_pCurStates->m_TextState->m_FontSize = fs;
   CPDF_Font* pFont = FindFont(GetString(1));
   if (pFont)
-    m_pCurStates->m_TextState->SetFont(pFont);
+    m_pCurStates->m_TextState.SetFont(pFont);
 }
 
 CPDF_Object* CPDF_StreamContentParser::FindResourceObj(
@@ -1231,17 +1231,17 @@
                                              FX_FLOAT fInitKerning,
                                              FX_FLOAT* pKerning,
                                              int nsegs) {
-  CPDF_Font* pFont = m_pCurStates->m_TextState->GetFont();
+  CPDF_Font* pFont = m_pCurStates->m_TextState.GetFont();
   if (!pFont) {
     return;
   }
   if (fInitKerning != 0) {
     if (!pFont->IsVertWriting()) {
       m_pCurStates->m_TextX -=
-          (fInitKerning * m_pCurStates->m_TextState->GetFontSize()) / 1000;
+          (fInitKerning * m_pCurStates->m_TextState.GetFontSize()) / 1000;
     } else {
       m_pCurStates->m_TextY -=
-          (fInitKerning * m_pCurStates->m_TextState->GetFontSize()) / 1000;
+          (fInitKerning * m_pCurStates->m_TextState.GetFontSize()) / 1000;
     }
   }
   if (nsegs == 0) {
@@ -1281,11 +1281,11 @@
   if (pKerning && pKerning[nsegs - 1] != 0) {
     if (!pFont->IsVertWriting()) {
       m_pCurStates->m_TextX -=
-          (pKerning[nsegs - 1] * m_pCurStates->m_TextState->GetFontSize()) /
+          (pKerning[nsegs - 1] * m_pCurStates->m_TextState.GetFontSize()) /
           1000;
     } else {
       m_pCurStates->m_TextY -=
-          (pKerning[nsegs - 1] * m_pCurStates->m_TextState->GetFontSize()) /
+          (pKerning[nsegs - 1] * m_pCurStates->m_TextState.GetFontSize()) /
           1000;
     }
   }
@@ -1313,7 +1313,7 @@
   if (nsegs == 0) {
     for (size_t i = 0; i < n; i++) {
       m_pCurStates->m_TextX -=
-          (pArray->GetNumberAt(i) * m_pCurStates->m_TextState->GetFontSize()) /
+          (pArray->GetNumberAt(i) * m_pCurStates->m_TextState.GetFontSize()) /
           1000;
     }
     return;
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index e19c9a4..1b37862 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -689,8 +689,8 @@
   if (pBBox) {
     form_bbox = pBBox->GetRect();
     ClipPath.New();
-    ClipPath->AppendRect(form_bbox.left, form_bbox.bottom, form_bbox.right,
-                         form_bbox.top);
+    ClipPath.AppendRect(form_bbox.left, form_bbox.bottom, form_bbox.right,
+                        form_bbox.top);
     ClipPath.Transform(&form_matrix);
     if (pParentMatrix) {
       ClipPath.Transform(pParentMatrix);
@@ -808,10 +808,10 @@
         if (pObj->m_ClipPath.GetTextCount())
           continue;
         CPDF_Path ClipPath = pObj->m_ClipPath.GetPath(0);
-        if (!ClipPath->IsRect() || pObj->IsShading())
+        if (!ClipPath.IsRect() || pObj->IsShading())
           continue;
-        CFX_FloatRect old_rect(ClipPath->GetPointX(0), ClipPath->GetPointY(0),
-                               ClipPath->GetPointX(2), ClipPath->GetPointY(2));
+        CFX_FloatRect old_rect(ClipPath.GetPointX(0), ClipPath.GetPointY(0),
+                               ClipPath.GetPointX(2), ClipPath.GetPointY(2));
         CFX_FloatRect obj_rect(pObj->m_Left, pObj->m_Bottom, pObj->m_Right,
                                pObj->m_Top);
         if (old_rect.Contains(obj_rect))
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_path.h b/core/fpdfapi/fpdf_page/include/cpdf_path.h
index adc7d86..33db4d7 100644
--- a/core/fpdfapi/fpdf_page/include/cpdf_path.h
+++ b/core/fpdfapi/fpdf_page/include/cpdf_path.h
@@ -14,6 +14,18 @@
 
 class CPDF_Path : public CFX_CountRef<CFX_PathData> {
  public:
+  int GetPointCount() const { return GetObject()->GetPointCount(); }
+  int GetFlag(int index) const { return GetObject()->GetFlag(index); }
+  FX_FLOAT GetPointX(int index) const { return GetObject()->GetPointX(index); }
+  FX_FLOAT GetPointY(int index) const { return GetObject()->GetPointY(index); }
+  FX_PATHPOINT* GetPoints() const { return GetObject()->GetPoints(); }
+  CFX_FloatRect GetBoundingBox() const { return GetObject()->GetBoundingBox(); }
+  CFX_FloatRect GetBoundingBox(FX_FLOAT line_width,
+                               FX_FLOAT miter_limit) const {
+    return GetObject()->GetBoundingBox(line_width, miter_limit);
+  }
+
+  FX_BOOL IsRect() const { return GetObject()->IsRect(); }
   void Transform(const CFX_Matrix* pMatrix) {
     MakePrivateCopy();
     GetObject()->Transform(pMatrix);
@@ -21,6 +33,13 @@
   void Append(const CPDF_Path& other, const CFX_Matrix* pMatrix) {
     GetObject()->Append(other.GetObject(), pMatrix);
   }
+
+  void AppendRect(FX_FLOAT left,
+                  FX_FLOAT bottom,
+                  FX_FLOAT right,
+                  FX_FLOAT top) {
+    GetObject()->AppendRect(left, bottom, right, top);
+  }
 };
 
 #endif  // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PATH_H_
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_textstatedata.h b/core/fpdfapi/fpdf_page/include/cpdf_textstatedata.h
index 40fa1ea..4e33d5f 100644
--- a/core/fpdfapi/fpdf_page/include/cpdf_textstatedata.h
+++ b/core/fpdfapi/fpdf_page/include/cpdf_textstatedata.h
@@ -34,18 +34,6 @@
   CPDF_TextStateData(const CPDF_TextStateData& src);
   ~CPDF_TextStateData();
 
-  void SetFont(CPDF_Font* pFont);
-
-  CPDF_Font* GetFont() const { return m_pFont; }
-  FX_FLOAT GetFontSize() const { return m_FontSize; }
-  FX_FLOAT* GetMatrix() { return m_Matrix; }
-  const FX_FLOAT* GetMatrix() const { return m_Matrix; }
-
-  FX_FLOAT GetFontSizeV() const;
-  FX_FLOAT GetFontSizeH() const;
-  FX_FLOAT GetBaselineAngle() const;
-  FX_FLOAT GetShearAngle() const;
-
   CPDF_Font* m_pFont;
   CPDF_Document* m_pDocument;
   FX_FLOAT m_FontSize;
diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp
index 447cc04..f5ab969 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -809,8 +809,8 @@
       textobj->GetTextMatrix(&text_matrix);
       CPDF_TextRenderer::DrawTextPath(
           &text_device, textobj->m_nChars, textobj->m_pCharCodes,
-          textobj->m_pCharPos, textobj->m_TextState->GetFont(),
-          textobj->m_TextState->GetFontSize(), &text_matrix, &new_matrix,
+          textobj->m_pCharPos, textobj->m_TextState.GetFont(),
+          textobj->m_TextState.GetFontSize(), &text_matrix, &new_matrix,
           textobj->m_GraphState.GetObject(), (FX_ARGB)-1, 0, nullptr, 0);
     }
   }
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
index 387ecff..4b59f1d 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
@@ -235,7 +235,7 @@
   if (text_render_mode == TextRenderingMode::MODE_INVISIBLE)
     return TRUE;
 
-  CPDF_Font* pFont = textobj->m_TextState->GetFont();
+  CPDF_Font* pFont = textobj->m_TextState.GetFont();
   if (pFont->IsType3Font())
     return ProcessType3Text(textobj, pObj2Device);
 
@@ -297,7 +297,7 @@
   if (!IsAvailableMatrix(text_matrix))
     return TRUE;
 
-  FX_FLOAT font_size = textobj->m_TextState->GetFontSize();
+  FX_FLOAT font_size = textobj->m_TextState.GetFontSize();
   if (bPattern) {
     DrawTextPathWithPattern(textobj, pObj2Device, pFont, font_size,
                             &text_matrix, bFill, bStroke);
@@ -373,7 +373,7 @@
 // TODO(npm): Font fallback for type 3 fonts? (Completely separate code!!)
 FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj,
                                             const CFX_Matrix* pObj2Device) {
-  CPDF_Type3Font* pType3Font = textobj->m_TextState->GetFont()->AsType3Font();
+  CPDF_Type3Font* pType3Font = textobj->m_TextState.GetFont()->AsType3Font();
   for (int i = 0; i < m_Type3FontCache.GetSize(); ++i) {
     if (m_Type3FontCache.GetAt(i) == pType3Font)
       return TRUE;
@@ -385,7 +385,7 @@
   CFX_Matrix text_matrix;
   textobj->GetTextMatrix(&text_matrix);
   CFX_Matrix char_matrix = pType3Font->GetFontMatrix();
-  FX_FLOAT font_size = textobj->m_TextState->GetFontSize();
+  FX_FLOAT font_size = textobj->m_TextState.GetFontSize();
   char_matrix.Scale(font_size, font_size);
   FX_ARGB fill_argb = GetFillArgb(textobj, TRUE);
   int fill_alpha = FXARGB_A(fill_argb);
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index 2ea6509..ca1cbf19 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -54,7 +54,7 @@
       CPDF_TextObjectItem item;
       pTextObj->GetItemInfo(i, &item);
       if (item.m_CharCode == static_cast<uint32_t>(-1)) {
-        FX_FLOAT fontsize_h = pTextObj->m_TextState->GetFontSizeH();
+        FX_FLOAT fontsize_h = pTextObj->m_TextState.GetFontSizeH();
         FX_FLOAT kerning = -fontsize_h * item.m_OriginX / 1000;
         baseSpace = std::min(baseSpace, kerning + spacing);
         bAllChar = false;
@@ -1084,7 +1084,7 @@
       if (str.IsEmpty() || str.GetAt(str.GetLength() - 1) == TEXT_SPACE_CHAR)
         continue;
 
-      FX_FLOAT fontsize_h = pTextObj->m_TextState->GetFontSizeH();
+      FX_FLOAT fontsize_h = pTextObj->m_TextState.GetFontSizeH();
       spacing = -fontsize_h * item.m_OriginX / 1000;
       continue;
     }
@@ -1096,7 +1096,7 @@
     spacing -= baseSpace;
     if (spacing && i > 0) {
       int last_width = 0;
-      FX_FLOAT fontsize_h = pTextObj->m_TextState->GetFontSizeH();
+      FX_FLOAT fontsize_h = pTextObj->m_TextState.GetFontSizeH();
       uint32_t space_charcode = pFont->CharCodeFromUnicode(' ');
       FX_FLOAT threshold = 0;
       if (space_charcode != CPDF_Font::kInvalidCharCode)
diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp
index 7c26c73..af8bb7d 100644
--- a/fpdfsdk/fpdf_transformpage.cpp
+++ b/fpdfsdk/fpdf_transformpage.cpp
@@ -223,7 +223,7 @@
   pNewClipPath->MakePrivateCopy();
   CPDF_Path Path;
   Path.MakePrivateCopy();
-  Path->AppendRect(left, bottom, right, top);
+  Path.AppendRect(left, bottom, right, top);
   pNewClipPath->AppendPath(Path, FXFILL_ALTERNATE, FALSE);
   return pNewClipPath;
 }
@@ -239,7 +239,7 @@
 
   FX_PATHPOINT* pPoints = pPathData->GetPoints();
 
-  if (path->IsRect()) {
+  if (path.IsRect()) {
     buf << (pPoints[0].m_PointX) << " " << (pPoints[0].m_PointY) << " "
         << (pPoints[2].m_PointX - pPoints[0].m_PointX) << " "
         << (pPoints[2].m_PointY - pPoints[0].m_PointY) << " re\n";
@@ -290,7 +290,7 @@
   for (i = 0; i < pClipPath->GetPathCount(); i++) {
     CPDF_Path path = pClipPath->GetPath(i);
     int iClipType = pClipPath->GetClipType(i);
-    if (path->GetPointCount() == 0) {
+    if (path.GetPointCount() == 0) {
       // Empty clipping (totally clipped out)
       strClip << "0 0 m W n ";
     } else {