summaryrefslogtreecommitdiff
path: root/xfa/fwl
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2017-01-24 06:12:34 -0800
committerCommit bot <commit-bot@chromium.org>2017-01-24 06:12:34 -0800
commit3d328767f9c0c04b62173aac03c35aab3fb87ffe (patch)
tree18a1a71ee987831e427b0dd62d26745861258a22 /xfa/fwl
parente73fea598f088151213fb11100798c615543ca2f (diff)
downloadpdfium-3d328767f9c0c04b62173aac03c35aab3fb87ffe.tar.xz
Use std::vector for CFX_RectF arrays
Review-Url: https://codereview.chromium.org/2653743002
Diffstat (limited to 'xfa/fwl')
-rw-r--r--xfa/fwl/cfwl_edit.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index acd5672227..87a49e0f45 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -168,15 +168,14 @@ void CFWL_Edit::AddSpellCheckObj(CFX_Path& PathData,
FX_FLOAT fY = 0.0f;
FX_FLOAT fStep = 0.0f;
IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0);
- CFX_RectFArray rectArray;
- CFX_RectF rectText;
const FDE_TXTEDTPARAMS* txtEdtParams = m_EdtEngine.GetEditParams();
FX_FLOAT fAsent = static_cast<FX_FLOAT>(txtEdtParams->pFont->GetAscent()) *
txtEdtParams->fFontSize / 1000;
- pPage->CalcRangeRectArray(nStart, nCount, rectArray);
- for (int i = 0; i < rectArray.GetSize(); i++) {
- rectText = rectArray.GetAt(i);
+ std::vector<CFX_RectF> rectArray;
+ pPage->CalcRangeRectArray(nStart, nCount, &rectArray);
+
+ for (const auto& rectText : rectArray) {
fY = rectText.top + fAsent + fOffSetY;
fStep = txtEdtParams->fFontSize / 16.0f;
fStartX = rectText.left + fOffSetX;
@@ -541,9 +540,8 @@ void CFWL_Edit::DrawContent(CFX_Graphics* pGraphics,
int32_t nPageCharEnd = nPageCharStart + nPageCharCount - 1;
int32_t nCharCount;
int32_t nCharStart;
- CFX_RectFArray rectArr;
- int32_t i = 0;
- for (i = 0; i < nSelCount; i++) {
+ std::vector<CFX_RectF> rectArr;
+ for (int32_t i = 0; i < nSelCount; i++) {
nCharCount = m_EdtEngine.GetSelRange(i, &nCharStart);
int32_t nCharEnd = nCharStart + nCharCount - 1;
if (nCharEnd < nPageCharStart || nCharStart > nPageCharEnd)
@@ -552,17 +550,15 @@ void CFWL_Edit::DrawContent(CFX_Graphics* pGraphics,
int32_t nBgn = std::max(nCharStart, nPageCharStart);
int32_t nEnd = std::min(nCharEnd, nPageCharEnd);
pPage->CalcRangeRectArray(nBgn - nPageCharStart, nEnd - nBgn + 1,
- rectArr);
+ &rectArr);
}
- int32_t nCount = rectArr.GetSize();
CFX_Path path;
path.Create();
- for (i = 0; i < nCount; i++) {
- rectArr[i].left += fOffSetX;
- rectArr[i].top += fOffSetY;
- path.AddRectangle(rectArr[i].left, rectArr[i].top, rectArr[i].width,
- rectArr[i].height);
+ for (auto& rect : rectArr) {
+ rect.left += fOffSetX;
+ rect.top += fOffSetY;
+ path.AddRectangle(rect.left, rect.top, rect.width, rect.height);
}
pGraphics->SetClipRect(rtClip);