summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-05-02 18:48:46 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-02 18:48:46 +0000
commit6efab39bf6cbad3fb1b07718ab87fbb84fc4bf61 (patch)
tree200e7545e678d0c62e1a3c3334ac05c13217181f
parent303f9a3afc4a86147213d4ac57894480485090a2 (diff)
downloadpdfium-6efab39bf6cbad3fb1b07718ab87fbb84fc4bf61.tar.xz
Transform in/out params from reference to pointer in CFDE_TextOut.
Change-Id: I192f2d0f5e0d61ff09d2e32bafa4e7518573e14e Reviewed-on: https://pdfium-review.googlesource.com/31951 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
-rw-r--r--xfa/fde/cfde_textout.cpp44
-rw-r--r--xfa/fde/cfde_textout.h12
2 files changed, 28 insertions, 28 deletions
diff --git a/xfa/fde/cfde_textout.cpp b/xfa/fde/cfde_textout.cpp
index b8049fbe82..07a0962cf8 100644
--- a/xfa/fde/cfde_textout.cpp
+++ b/xfa/fde/cfde_textout.cpp
@@ -229,12 +229,12 @@ void CFDE_TextOut::CalcLogicSize(const WideString& str, CFX_RectF* pRect) {
}
dwBreakStatus = m_pTxtBreak->AppendChar(wch);
if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus))
- RetrieveLineWidth(dwBreakStatus, fStartPos, fWidth, fHeight);
+ RetrieveLineWidth(dwBreakStatus, &fStartPos, &fWidth, &fHeight);
}
dwBreakStatus = m_pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus))
- RetrieveLineWidth(dwBreakStatus, fStartPos, fWidth, fHeight);
+ RetrieveLineWidth(dwBreakStatus, &fStartPos, &fWidth, &fHeight);
m_pTxtBreak->Reset();
float fInc = pRect->Height() - fHeight;
@@ -252,9 +252,9 @@ void CFDE_TextOut::CalcLogicSize(const WideString& str, CFX_RectF* pRect) {
}
bool CFDE_TextOut::RetrieveLineWidth(CFX_BreakType dwBreakStatus,
- float& fStartPos,
- float& fWidth,
- float& fHeight) {
+ float* pStartPos,
+ float* pWidth,
+ float* pHeight) {
if (CFX_BreakTypeNoneOrPiece(dwBreakStatus))
return false;
@@ -263,18 +263,18 @@ bool CFDE_TextOut::RetrieveLineWidth(CFX_BreakType dwBreakStatus,
for (int32_t i = 0; i < m_pTxtBreak->CountBreakPieces(); i++) {
const CFX_BreakPiece* pPiece = m_pTxtBreak->GetBreakPieceUnstable(i);
fLineWidth += static_cast<float>(pPiece->m_iWidth) / 20000.0f;
- fStartPos =
- std::min(fStartPos, static_cast<float>(pPiece->m_iStartPos) / 20000.0f);
+ *pStartPos = std::min(*pStartPos,
+ static_cast<float>(pPiece->m_iStartPos) / 20000.0f);
}
m_pTxtBreak->ClearBreakPieces();
if (dwBreakStatus == CFX_BreakType::Paragraph)
m_pTxtBreak->Reset();
if (!m_Styles.line_wrap_ && dwBreakStatus == CFX_BreakType::Line) {
- fWidth += fLineWidth;
+ *pWidth += fLineWidth;
} else {
- fWidth = std::max(fWidth, fLineWidth);
- fHeight += fLineStep;
+ *pWidth = std::max(*pWidth, fLineWidth);
+ *pHeight += fLineStep;
}
++m_iTotalLines;
return true;
@@ -345,7 +345,7 @@ void CFDE_TextOut::LoadText(const WideString& str, const CFX_RectF& rect) {
continue;
bool bEndofLine =
- RetrievePieces(dwBreakStatus, iStartChar, iPieceWidths, false, rect);
+ RetrievePieces(dwBreakStatus, false, rect, &iStartChar, &iPieceWidths);
if (bEndofLine &&
(m_Styles.line_wrap_ || dwBreakStatus == CFX_BreakType::Paragraph ||
dwBreakStatus == CFX_BreakType::Page)) {
@@ -363,17 +363,17 @@ void CFDE_TextOut::LoadText(const WideString& str, const CFX_RectF& rect) {
dwBreakStatus = m_pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus) && !bRet)
- RetrievePieces(dwBreakStatus, iStartChar, iPieceWidths, false, rect);
+ RetrievePieces(dwBreakStatus, false, rect, &iStartChar, &iPieceWidths);
m_pTxtBreak->ClearBreakPieces();
m_pTxtBreak->Reset();
}
bool CFDE_TextOut::RetrievePieces(CFX_BreakType dwBreakStatus,
- int32_t& iStartChar,
- int32_t& iPieceWidths,
bool bReload,
- const CFX_RectF& rect) {
+ const CFX_RectF& rect,
+ int32_t* pStartChar,
+ int32_t* pPieceWidths) {
float fLineStep = (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize;
bool bNeedReload = false;
int32_t iLineWidth = FXSYS_round(rect.Width() * 20000.0f);
@@ -381,14 +381,14 @@ bool CFDE_TextOut::RetrievePieces(CFX_BreakType dwBreakStatus,
for (int32_t i = 0; i < iCount; i++) {
const CFX_BreakPiece* pPiece = m_pTxtBreak->GetBreakPieceUnstable(i);
int32_t iPieceChars = pPiece->GetLength();
- int32_t iChar = iStartChar;
+ int32_t iChar = *pStartChar;
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;
if (m_Styles.single_line_ || !m_Styles.line_wrap_) {
- if (iLineWidth - iPieceWidths - iWidth < iCurCharWidth) {
+ if (iLineWidth - *pPieceWidths - iWidth < iCurCharWidth) {
bNeedReload = true;
break;
}
@@ -401,7 +401,7 @@ bool CFDE_TextOut::RetrievePieces(CFX_BreakType dwBreakStatus,
m_ttoLines[m_iCurLine].SetNewReload(true);
} else if (j > 0) {
FDE_TTOPIECE ttoPiece;
- ttoPiece.iStartChar = iStartChar;
+ ttoPiece.iStartChar = *pStartChar;
ttoPiece.iChars = j;
ttoPiece.dwCharStyles = pPiece->m_dwCharStyles;
ttoPiece.rtPiece = CFX_RectF(
@@ -413,8 +413,8 @@ bool CFDE_TextOut::RetrievePieces(CFX_BreakType dwBreakStatus,
AppendPiece(ttoPiece, bNeedReload, (bReload && i == iCount - 1));
}
- iStartChar += iPieceChars;
- iPieceWidths += iWidth;
+ *pStartChar += iPieceChars;
+ *pPieceWidths += iWidth;
}
m_pTxtBreak->ClearBreakPieces();
@@ -475,7 +475,7 @@ void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) {
while (iStar < iEnd) {
dwBreakStatus = m_pTxtBreak->AppendChar(*(pwsStr + iStar));
if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus))
- RetrievePieces(dwBreakStatus, iStartChar, iPieceWidths, true, rect);
+ RetrievePieces(dwBreakStatus, true, rect, &iStartChar, &iPieceWidths);
++iStar;
}
@@ -485,7 +485,7 @@ void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) {
dwBreakStatus = m_pTxtBreak->EndBreak(CFX_BreakType::Paragraph);
if (!CFX_BreakTypeNoneOrPiece(dwBreakStatus))
- RetrievePieces(dwBreakStatus, iStartChar, iPieceWidths, true, rect);
+ RetrievePieces(dwBreakStatus, true, rect, &iStartChar, &iPieceWidths);
m_pTxtBreak->Reset();
}
diff --git a/xfa/fde/cfde_textout.h b/xfa/fde/cfde_textout.h
index 5014d9517c..e3799a3469 100644
--- a/xfa/fde/cfde_textout.h
+++ b/xfa/fde/cfde_textout.h
@@ -82,18 +82,18 @@ class CFDE_TextOut {
};
bool RetrieveLineWidth(CFX_BreakType dwBreakStatus,
- float& fStartPos,
- float& fWidth,
- float& fHeight);
+ float* pStartPos,
+ float* pWidth,
+ float* pHeight);
void LoadText(const WideString& str, const CFX_RectF& rect);
void Reload(const CFX_RectF& rect);
void ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect);
bool RetrievePieces(CFX_BreakType dwBreakStatus,
- int32_t& iStartChar,
- int32_t& iPieceWidths,
bool bReload,
- const CFX_RectF& rect);
+ const CFX_RectF& rect,
+ int32_t* pStartChar,
+ int32_t* pPieceWidths);
void AppendPiece(const FDE_TTOPIECE& ttoPiece, bool bNeedReload, bool bEnd);
void DoAlignment(const CFX_RectF& rect);
int32_t GetDisplayPos(FDE_TTOPIECE* pPiece);