From 893822aa5b6254591f8e80fbffcbb4fa6ad849aa Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 13 Mar 2017 15:32:07 -0400 Subject: Merge text breaking helper classes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Cl merges the CFX_TxtPiece and CFX_RTFPiece classes into CFX_BreakPiece. CFX_TxtLine and CFX_RTFLine into CFX_BreakLine and CFX_TxtChar and CFX_RTFChar into CFX_Char. Change-Id: I95421bdf4cafd5e394db9238dea3603ccb8349c3 Reviewed-on: https://pdfium-review.googlesource.com/2966 Reviewed-by: Nicolás Peña Commit-Queue: dsinclair --- xfa/fde/cfde_txtedtpage.cpp | 4 ++-- xfa/fde/cfde_txtedtparag.cpp | 2 +- xfa/fde/tto/fde_textout.cpp | 13 +++++++------ xfa/fde/tto/fde_textout.h | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) (limited to 'xfa/fde') diff --git a/xfa/fde/cfde_txtedtpage.cpp b/xfa/fde/cfde_txtedtpage.cpp index fd44b28ef2..f0a33d0516 100644 --- a/xfa/fde/cfde_txtedtpage.cpp +++ b/xfa/fde/cfde_txtedtpage.cpp @@ -296,7 +296,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus)) { int32_t nPieceCount = pBreak->CountBreakPieces(); for (int32_t j = 0; j < nPieceCount; j++) { - const CFX_TxtPiece* pPiece = pBreak->GetBreakPiece(j); + const CFX_BreakPiece* pPiece = pBreak->GetBreakPiece(j); FDE_TEXTEDITPIECE TxtEdtPiece; FXSYS_memset(&TxtEdtPiece, 0, sizeof(FDE_TEXTEDITPIECE)); TxtEdtPiece.nBidiLevel = pPiece->m_iBidiLevel; @@ -345,7 +345,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, m_Pieces.push_back(TxtEdtPiece); for (int32_t k = 0; k < TxtEdtPiece.nCount; k++) { m_CharWidths[TxtEdtPiece.nStart + k] = - pPiece->GetChar(k).m_iCharWidth; + pPiece->GetChar(k)->m_iCharWidth; } } fLinePos += fLineStep; diff --git a/xfa/fde/cfde_txtedtparag.cpp b/xfa/fde/cfde_txtedtparag.cpp index f7ba6d9631..79dcc2fbac 100644 --- a/xfa/fde/cfde_txtedtparag.cpp +++ b/xfa/fde/cfde_txtedtparag.cpp @@ -63,7 +63,7 @@ void CFDE_TxtEdtParag::LoadParag() { int32_t nCount = pTxtBreak->CountBreakPieces(); int32_t nTotal = 0; for (int32_t j = 0; j < nCount; j++) { - const CFX_TxtPiece* Piece = pTxtBreak->GetBreakPiece(j); + const CFX_BreakPiece* Piece = pTxtBreak->GetBreakPiece(j); nTotal += Piece->GetLength(); } LineBaseArr.Add(nTotal); diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp index 0e8e91e8b1..02b1522823 100644 --- a/xfa/fde/tto/fde_textout.cpp +++ b/xfa/fde/tto/fde_textout.cpp @@ -245,7 +245,7 @@ bool CFDE_TextOut::RetrieveLineWidth(CFX_BreakType dwBreakStatus, FX_FLOAT fLineWidth = 0.0f; int32_t iCount = m_pTxtBreak->CountBreakPieces(); for (int32_t i = 0; i < iCount; i++) { - const CFX_TxtPiece* pPiece = m_pTxtBreak->GetBreakPiece(i); + const CFX_BreakPiece* pPiece = m_pTxtBreak->GetBreakPiece(i); fLineWidth += static_cast(pPiece->m_iWidth) / 20000.0f; fStartPos = std::min(fStartPos, static_cast(pPiece->m_iStartPos) / 20000.0f); @@ -387,10 +387,11 @@ void CFDE_TextOut::RetrieveEllPieces(std::vector* pCharWidths) { int32_t iCount = m_pTxtBreak->CountBreakPieces(); int32_t iCharIndex = 0; for (int32_t i = 0; i < iCount; i++) { - const CFX_TxtPiece* pPiece = m_pTxtBreak->GetBreakPiece(i); + const CFX_BreakPiece* pPiece = m_pTxtBreak->GetBreakPiece(i); int32_t iPieceChars = pPiece->GetLength(); for (int32_t j = 0; j < iPieceChars; j++) { - (*pCharWidths)[iCharIndex] = std::max(pPiece->GetChar(j).m_iCharWidth, 0); + (*pCharWidths)[iCharIndex] = + std::max(pPiece->GetChar(j)->m_iCharWidth, 0); m_iEllipsisWidth += (*pCharWidths)[iCharIndex]; iCharIndex++; } @@ -468,14 +469,14 @@ bool CFDE_TextOut::RetrievePieces(CFX_BreakType dwBreakStatus, int32_t iLineWidth = FXSYS_round(fLineWidth * 20000.0f); int32_t iCount = m_pTxtBreak->CountBreakPieces(); for (int32_t i = 0; i < iCount; i++) { - const CFX_TxtPiece* pPiece = m_pTxtBreak->GetBreakPiece(i); + const CFX_BreakPiece* pPiece = m_pTxtBreak->GetBreakPiece(i); int32_t iPieceChars = pPiece->GetLength(); int32_t iChar = iStartChar; int32_t iWidth = 0; int32_t j = 0; for (; j < iPieceChars; j++) { - const CFX_Char& pTC = pPiece->GetChar(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; diff --git a/xfa/fde/tto/fde_textout.h b/xfa/fde/tto/fde_textout.h index fa4444822d..1519a81e8f 100644 --- a/xfa/fde/tto/fde_textout.h +++ b/xfa/fde/tto/fde_textout.h @@ -11,7 +11,7 @@ #include #include -#include "core/fxcrt/fx_ucd.h" +#include "core/fxcrt/cfx_char.h" #include "core/fxge/cfx_fxgedevice.h" #include "core/fxge/cfx_renderdevice.h" #include "core/fxge/fx_dib.h" -- cgit v1.2.3