From 8da79203b32d1a0df05a23da83044bdaf71c320d Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Mon, 13 Mar 2017 12:08:31 -0400 Subject: Simplify the CFX_TxtPiece class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Cl removes unused methods and makes GetString return a CFX_WideString instead of taking an out parameter. Change-Id: I3d2fcbdf51e7619f4fa42e46a0c83fbfa1132a84 Reviewed-on: https://pdfium-review.googlesource.com/2950 Commit-Queue: dsinclair Reviewed-by: Nicolás Peña --- xfa/fde/tto/fde_textout.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'xfa/fde/tto/fde_textout.cpp') diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp index 55b1272e11..5c59b2c8d6 100644 --- a/xfa/fde/tto/fde_textout.cpp +++ b/xfa/fde/tto/fde_textout.cpp @@ -391,8 +391,7 @@ void CFDE_TextOut::RetrieveEllPieces(std::vector* pCharWidths) { const CFX_TxtPiece* pPiece = m_pTxtBreak->GetBreakPiece(i); int32_t iPieceChars = pPiece->GetLength(); for (int32_t j = 0; j < iPieceChars; j++) { - CFX_Char* pTC = pPiece->GetCharPtr(j); - (*pCharWidths)[iCharIndex] = std::max(pTC->m_iCharWidth, 0); + (*pCharWidths)[iCharIndex] = std::max(pPiece->GetChar(j).m_iCharWidth, 0); m_iEllipsisWidth += (*pCharWidths)[iCharIndex]; iCharIndex++; } @@ -465,7 +464,6 @@ bool CFDE_TextOut::RetrievePieces(CFX_BreakType dwBreakStatus, bool bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap); FX_FLOAT fLineStep = (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize; - CFX_Char* pTC = nullptr; bool bNeedReload = false; FX_FLOAT fLineWidth = rect.Width(); int32_t iLineWidth = FXSYS_round(fLineWidth * 20000.0f); @@ -477,8 +475,8 @@ bool CFDE_TextOut::RetrievePieces(CFX_BreakType dwBreakStatus, int32_t iWidth = 0; int32_t j = 0; for (; j < iPieceChars; j++) { - pTC = pPiece->GetCharPtr(j); - int32_t iCurCharWidth = pTC->m_iCharWidth > 0 ? pTC->m_iCharWidth : 0; + const CFX_Char& pTC = pPiece->GetChar(j); + int32_t iCurCharWidth = pTC.m_iCharWidth > 0 ? pTC.m_iCharWidth : 0; if (bSingleLine || !bLineWrap) { if (iLineWidth - iPieceWidths - iWidth < iCurCharWidth) { bNeedReload = true; -- cgit v1.2.3