diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-03-02 12:21:15 -0800 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-02 21:01:30 +0000 |
commit | c803cbcad51355ffa38dce0851a51dfdcf279645 (patch) | |
tree | 82fa82015ec801285231cf507ed97bdea5fc7e08 /xfa/fde/cfde_txtedttextset.cpp | |
parent | c3f74e91b2f019c3035395f5605cb98409502385 (diff) | |
download | pdfium-c803cbcad51355ffa38dce0851a51dfdcf279645.tar.xz |
Use std::deque for CFX_MassArrayTemplate<FDE_TEXTEDITPIECE>
Change-Id: I1080eefb4e47d7bc86fb3384fd7479a1fd49b203
Reviewed-on: https://pdfium-review.googlesource.com/2898
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fde/cfde_txtedttextset.cpp')
-rw-r--r-- | xfa/fde/cfde_txtedttextset.cpp | 40 |
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); } |