From 596014357f7cd9ee3245ba8ed52cbc5761151727 Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 29 Aug 2016 14:26:57 -0700 Subject: Revert "Replace wrapper methods in CPDF_Path with -> operator." This reverts commit d09a09751f724ecdb1a0bc307447a3d0c212ebff. TBR=dsinclair@chromium.org Review-Url: https://codereview.chromium.org/2291833002 --- BUILD.gn | 1 + core/fpdfapi/fpdf_page/cpdf_allstates.cpp | 2 +- core/fpdfapi/fpdf_page/cpdf_clippath.cpp | 12 +++--- core/fpdfapi/fpdf_page/cpdf_pathobject.cpp | 4 +- core/fpdfapi/fpdf_page/cpdf_textobject.cpp | 22 +++++----- core/fpdfapi/fpdf_page/cpdf_textstate.cpp | 47 ++++++++++++++++++++++ core/fpdfapi/fpdf_page/cpdf_textstate.h | 14 +++++++ core/fpdfapi/fpdf_page/cpdf_textstatedata.cpp | 35 ---------------- core/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 14 +++---- core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp | 10 ++--- core/fpdfapi/fpdf_page/include/cpdf_path.h | 19 +++++++++ .../fpdfapi/fpdf_page/include/cpdf_textstatedata.h | 12 ------ core/fpdfapi/fpdf_render/fpdf_render.cpp | 4 +- core/fpdfapi/fpdf_render/fpdf_render_text.cpp | 8 ++-- core/fpdftext/cpdf_textpage.cpp | 6 +-- fpdfsdk/fpdf_transformpage.cpp | 6 +-- 16 files changed, 125 insertions(+), 91 deletions(-) create mode 100644 core/fpdfapi/fpdf_page/cpdf_textstate.cpp diff --git a/BUILD.gn b/BUILD.gn index 8d3e2424f4..982c57a179 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -447,6 +447,7 @@ static_library("fpdfapi") { "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 eb43bd10c4..fb0c2445e7 100644 --- a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp @@ -104,7 +104,7 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, 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 51f3086c12..2c05df0d19 100644 --- a/core/fpdfapi/fpdf_page/cpdf_clippath.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_clippath.cpp @@ -38,9 +38,9 @@ CFX_FloatRect CPDF_ClipPath::GetClipBox() const { 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 @@ void CPDF_ClipPath::AppendPath(CPDF_Path path, uint8_t type, bool bAutoMerge) { 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 d48c84bf4a..ceb3dd43cc 100644 --- a/core/fpdfapi/fpdf_page/cpdf_pathobject.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_pathobject.cpp @@ -48,9 +48,9 @@ void CPDF_PathObject::CalcBoundingBox() { 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 7b39dff924..a3653359de 100644 --- a/core/fpdfapi/fpdf_page/cpdf_textobject.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_textobject.cpp @@ -35,7 +35,7 @@ void CPDF_TextObject::GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const { 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 @@ void CPDF_TextObject::GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const { 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 @@ void CPDF_TextObject::Transform(const CFX_Matrix& matrix) { 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 @@ const CPDF_TextObject* CPDF_TextObject::AsText() const { } 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 @@ void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs, } 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 @@ void CPDF_TextObject::SetText(const CFX_ByteString& str) { } 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 @@ FX_FLOAT CPDF_TextObject::GetPosY() const { } 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 @@ void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX, 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 0000000000..47e2116836 --- /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 744739a6ac..59c988de06 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 { + 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 9ae99a1cdb..e60af0076e 100644 --- a/core/fpdfapi/fpdf_page/cpdf_textstatedata.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_textstatedata.cpp @@ -72,38 +72,3 @@ CPDF_TextStateData::~CPDF_TextStateData() { 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 5d5b75b60e..3afcf4b7d1 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -1144,7 +1144,7 @@ void CPDF_StreamContentParser::Handle_SetFont() { 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 @@ void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs, 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 @@ void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs, 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 @@ void CPDF_StreamContentParser::Handle_ShowText_Positioning() { 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 e19c9a4a61..1b37862e99 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 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm, 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 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) { 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 adc7d86f44..33db4d755a 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 { 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 @@ class CPDF_Path : public CFX_CountRef { 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 40fa1ea8d3..4e33d5f170 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_textstatedata.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_textstatedata.h @@ -34,18 +34,6 @@ class CPDF_TextStateData { 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 447cc04f06..f5ab9696c7 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp @@ -809,8 +809,8 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, 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 387ecff27c..4b59f1d61a 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -235,7 +235,7 @@ FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj, 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 @@ FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj, 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 @@ class CPDF_RefType3Cache { // 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 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, 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 2ea6509021..ca1cbf1925 100644 --- a/core/fpdftext/cpdf_textpage.cpp +++ b/core/fpdftext/cpdf_textpage.cpp @@ -54,7 +54,7 @@ FX_FLOAT CalculateBaseSpace(const CPDF_TextObject* pTextObj, CPDF_TextObjectItem item; pTextObj->GetItemInfo(i, &item); if (item.m_CharCode == static_cast(-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 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) { 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 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) { 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 7c26c73d87..af8bb7de5b 100644 --- a/fpdfsdk/fpdf_transformpage.cpp +++ b/fpdfsdk/fpdf_transformpage.cpp @@ -223,7 +223,7 @@ DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left, 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 @@ void OutputPath(CFX_ByteTextBuf& buf, CPDF_Path path) { 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 @@ DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page, 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 { -- cgit v1.2.3