From b97f8d578f6a11962f36d522bd1dbf33064e7461 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 21 Feb 2017 12:56:43 -0500 Subject: Cleanup StreamContentParser transform methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ConvertTextSpace method was called once, and it was the only caller of ConvertUserSpace. Fold both methods back into the callsite and convert the use of TransformPoint to Transform. Change-Id: Ia09ec8846c28603df0616135ba1519dbbba219c3 Reviewed-on: https://pdfium-review.googlesource.com/2810 Commit-Queue: dsinclair Reviewed-by: Nicolás Peña --- core/fpdfapi/page/cpdf_streamcontentparser.cpp | 18 +++++------------- core/fpdfapi/page/cpdf_streamcontentparser.h | 2 -- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp index e991e456b7..8015a8df45 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp +++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp @@ -1229,16 +1229,6 @@ CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const CFX_ByteString& name, m_pCurStates->m_ParentMatrix); } -void CPDF_StreamContentParser::ConvertTextSpace(FX_FLOAT& x, FX_FLOAT& y) { - m_pCurStates->m_TextMatrix.TransformPoint(x, y); - ConvertUserSpace(x, y); -} - -void CPDF_StreamContentParser::ConvertUserSpace(FX_FLOAT& x, FX_FLOAT& y) { - m_pCurStates->m_CTM.TransformPoint(x, y); - m_mtContentToUser.TransformPoint(x, y); -} - void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs, FX_FLOAT fInitKerning, FX_FLOAT* pKerning, @@ -1276,9 +1266,11 @@ void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs, pCTM[3] = m_pCurStates->m_CTM.d; } pText->SetSegments(pStrs, pKerning, nsegs); - pText->m_Pos = CFX_PointF(m_pCurStates->m_TextX, - m_pCurStates->m_TextY + m_pCurStates->m_TextRise); - ConvertTextSpace(pText->m_Pos.x, pText->m_Pos.y); + pText->m_Pos = m_mtContentToUser.Transform( + m_pCurStates->m_CTM.Transform(m_pCurStates->m_TextMatrix.Transform( + CFX_PointF(m_pCurStates->m_TextX, + m_pCurStates->m_TextY + m_pCurStates->m_TextRise)))); + FX_FLOAT x_advance; FX_FLOAT y_advance; pText->CalcPositionData(&x_advance, &y_advance, diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.h b/core/fpdfapi/page/cpdf_streamcontentparser.h index ca7ea7c106..cd41990b0a 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.h +++ b/core/fpdfapi/page/cpdf_streamcontentparser.h @@ -92,8 +92,6 @@ class CPDF_StreamContentParser { FX_FLOAT* pKerning, int count); - void ConvertUserSpace(FX_FLOAT& x, FX_FLOAT& y); - void ConvertTextSpace(FX_FLOAT& x, FX_FLOAT& y); void OnChangeTextMatrix(); void ParsePathObject(); void AddPathPoint(FX_FLOAT x, FX_FLOAT y, FXPT_TYPE type, bool close); -- cgit v1.2.3