summaryrefslogtreecommitdiff
path: root/xfa/fde/tto/fde_textout.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-03-13 15:32:07 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-14 14:13:24 +0000
commit893822aa5b6254591f8e80fbffcbb4fa6ad849aa (patch)
tree74e20ab6378d515c12a1ec9b9fc70d8e309b361b /xfa/fde/tto/fde_textout.cpp
parent80e370c7d8b6541f59d98b6cbfbaae51f7e139da (diff)
downloadpdfium-893822aa5b6254591f8e80fbffcbb4fa6ad849aa.tar.xz
Merge text breaking helper classes.
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 <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fde/tto/fde_textout.cpp')
-rw-r--r--xfa/fde/tto/fde_textout.cpp13
1 files changed, 7 insertions, 6 deletions
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<FX_FLOAT>(pPiece->m_iWidth) / 20000.0f;
fStartPos = std::min(fStartPos,
static_cast<FX_FLOAT>(pPiece->m_iStartPos) / 20000.0f);
@@ -387,10 +387,11 @@ void CFDE_TextOut::RetrieveEllPieces(std::vector<int32_t>* 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;