summaryrefslogtreecommitdiff
path: root/xfa/fde/cfde_txtedttextset.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fde/cfde_txtedttextset.cpp')
-rw-r--r--xfa/fde/cfde_txtedttextset.cpp40
1 files changed, 16 insertions, 24 deletions
diff --git a/xfa/fde/cfde_txtedttextset.cpp b/xfa/fde/cfde_txtedttextset.cpp
index a885ad4508..8d32f75ff3 100644
--- a/xfa/fde/cfde_txtedttextset.cpp
+++ b/xfa/fde/cfde_txtedttextset.cpp
@@ -19,8 +19,8 @@ FDE_VISUALOBJTYPE CFDE_TxtEdtTextSet::GetType() {
return FDE_VISUALOBJ_Text;
}
-void CFDE_TxtEdtTextSet::GetRect(FDE_TEXTEDITPIECE* pPiece, CFX_RectF& rt) {
- rt = pPiece->rtPiece;
+CFX_RectF CFDE_TxtEdtTextSet::GetRect(const FDE_TEXTEDITPIECE& pPiece) {
+ return pPiece.rtPiece;
}
int32_t CFDE_TxtEdtTextSet::GetString(FDE_TEXTEDITPIECE* pPiece,
@@ -45,14 +45,11 @@ FX_ARGB CFDE_TxtEdtTextSet::GetFontColor() {
return m_pPage->GetEngine()->GetEditParams()->dwFontColor;
}
-int32_t CFDE_TxtEdtTextSet::GetDisplayPos(FDE_TEXTEDITPIECE* pPiece,
+int32_t CFDE_TxtEdtTextSet::GetDisplayPos(const FDE_TEXTEDITPIECE& piece,
FXTEXT_CHARPOS* pCharPos,
bool bCharCode,
CFX_WideString* pWSForms) {
- if (!pPiece)
- return 0;
-
- int32_t nLength = pPiece->nCount;
+ int32_t nLength = piece.nCount;
if (nLength < 1)
return 0;
@@ -63,42 +60,37 @@ int32_t CFDE_TxtEdtTextSet::GetDisplayPos(FDE_TEXTEDITPIECE* pPiece,
uint32_t dwLayoutStyle = pBreak->GetLayoutStyles();
FX_TXTRUN tr;
tr.pAccess = m_pPage;
- tr.pIdentity = pPiece;
+ tr.pIdentity = &piece;
tr.iLength = nLength;
tr.pFont = pTextParams->pFont;
tr.fFontSize = pTextParams->fFontSize;
tr.dwStyles = dwLayoutStyle;
tr.iCharRotation = pTextParams->nCharRotation;
- tr.dwCharStyles = pPiece->dwCharStyles;
- tr.pRect = &(pPiece->rtPiece);
+ tr.dwCharStyles = piece.dwCharStyles;
+ tr.pRect = &piece.rtPiece;
tr.wLineBreakChar = pTextParams->wLineBreakChar;
return pBreak->GetDisplayPos(&tr, pCharPos, bCharCode, pWSForms);
}
-int32_t CFDE_TxtEdtTextSet::GetCharRects(const FDE_TEXTEDITPIECE* pPiece,
- std::vector<CFX_RectF>* rtArray,
- bool bBBox) {
- if (!pPiece)
- return 0;
-
- CFDE_TxtEdtEngine* pEngine =
- static_cast<CFDE_TxtEdtEngine*>(m_pPage->GetEngine());
- int32_t nLength = pPiece->nCount;
- if (nLength < 1)
- return 0;
+std::vector<CFX_RectF> CFDE_TxtEdtTextSet::GetCharRects(
+ const FDE_TEXTEDITPIECE* pPiece,
+ bool bBBox) {
+ if (!pPiece || pPiece->nCount < 1)
+ return std::vector<CFX_RectF>();
+ auto pEngine = static_cast<CFDE_TxtEdtEngine*>(m_pPage->GetEngine());
const FDE_TXTEDTPARAMS* pTextParams = pEngine->GetEditParams();
uint32_t dwLayoutStyle = pEngine->GetTextBreak()->GetLayoutStyles();
FX_TXTRUN tr;
tr.pAccess = m_pPage;
tr.pIdentity = pPiece;
- tr.iLength = nLength;
+ tr.iLength = pPiece->nCount;
tr.pFont = pTextParams->pFont;
tr.fFontSize = pTextParams->fFontSize;
tr.dwStyles = dwLayoutStyle;
tr.iCharRotation = pTextParams->nCharRotation;
tr.dwCharStyles = pPiece->dwCharStyles;
- tr.pRect = &(pPiece->rtPiece);
+ tr.pRect = &pPiece->rtPiece;
tr.wLineBreakChar = pTextParams->wLineBreakChar;
- return pEngine->GetTextBreak()->GetCharRects(&tr, rtArray, bBBox);
+ return pEngine->GetTextBreak()->GetCharRects(&tr, bBBox);
}