summaryrefslogtreecommitdiff
path: root/xfa/fgas/layout
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/fgas/layout
parente73fea598f088151213fb11100798c615543ca2f (diff)
downloadpdfium-3d328767f9c0c04b62173aac03c35aab3fb87ffe.tar.xz
Use std::vector for CFX_RectF arrays
Review-Url: https://codereview.chromium.org/2653743002
Diffstat (limited to 'xfa/fgas/layout')
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.cpp10
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.h2
-rw-r--r--xfa/fgas/layout/fgas_textbreak.cpp10
-rw-r--r--xfa/fgas/layout/fgas_textbreak.h3
4 files changed, 13 insertions, 12 deletions
diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp
index f7ba0e72b9..52e6267ded 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.cpp
+++ b/xfa/fgas/layout/fgas_rtfbreak.cpp
@@ -1415,7 +1415,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText,
return iCount;
}
int32_t CFX_RTFBreak::GetCharRects(const FX_RTFTEXTOBJ* pText,
- CFX_RectFArray& rtArray,
+ std::vector<CFX_RectF>* rtArray,
bool bCharBBox) const {
if (!pText || pText->iLength < 1)
return 0;
@@ -1440,8 +1440,8 @@ int32_t CFX_RTFBreak::GetCharRects(const FX_RTFTEXTOBJ* pText,
FX_FLOAT fLeft = std::max(0.0f, bbox.left * fScale);
FX_FLOAT fHeight = FXSYS_fabs(bbox.height * fScale);
- rtArray.RemoveAll();
- rtArray.SetSize(iLength);
+ rtArray->clear();
+ rtArray->resize(iLength);
uint32_t dwStyles = pText->dwLayoutStyles;
bool bVertical = (dwStyles & FX_RTFLAYOUTSTYLE_VerticalLayout) != 0;
bool bSingleLine = (dwStyles & FX_RTFLAYOUTSTYLE_SingleLine) != 0;
@@ -1511,10 +1511,10 @@ int32_t CFX_RTFBreak::GetCharRects(const FX_RTFTEXTOBJ* pText,
rtBBoxF.height = fHeight;
rtBBoxF.top = std::max(rtBBoxF.top, 0.0f);
}
- rtArray.SetAt(i, rtBBoxF);
+ (*rtArray)[i] = rtBBoxF;
continue;
}
- rtArray.SetAt(i, rect);
+ (*rtArray)[i] = rect;
}
return iLength;
}
diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h
index 91862dceeb..f3d2311a2c 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.h
+++ b/xfa/fgas/layout/fgas_rtfbreak.h
@@ -252,7 +252,7 @@ class CFX_RTFBreak {
CFX_WideString* pWSForms = nullptr,
FX_AdjustCharDisplayPos pAdjustPos = nullptr) const;
int32_t GetCharRects(const FX_RTFTEXTOBJ* pText,
- CFX_RectFArray& rtArray,
+ std::vector<CFX_RectF>* rtArray,
bool bCharBBox = false) const;
uint32_t AppendChar_CharCode(FX_WCHAR wch);
uint32_t AppendChar_Combination(CFX_RTFChar* pCurChar, int32_t iRotation);
diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp
index 35984f5017..50e3b063fd 100644
--- a/xfa/fgas/layout/fgas_textbreak.cpp
+++ b/xfa/fgas/layout/fgas_textbreak.cpp
@@ -1588,7 +1588,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
}
int32_t CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
- CFX_RectFArray& rtArray,
+ std::vector<CFX_RectF>* rtArray,
bool bCharBBox) const {
if (!pTxtRun || pTxtRun->iLength < 1)
return 0;
@@ -1614,8 +1614,8 @@ int32_t CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
FX_FLOAT fLeft = std::max(0.0f, bbox.left * fScale);
FX_FLOAT fHeight = FXSYS_fabs(bbox.height * fScale);
- rtArray.RemoveAll();
- rtArray.SetSize(iLength);
+ rtArray->clear();
+ rtArray->resize(iLength);
bool bVertical = (pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_VerticalLayout) != 0;
bool bSingleLine = (pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_SingleLine) != 0;
bool bCombText = (pTxtRun->dwStyles & FX_TXTLAYOUTSTYLE_CombText) != 0;
@@ -1689,10 +1689,10 @@ int32_t CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun,
rtBBoxF.height = fHeight;
rtBBoxF.top = std::max(rtBBoxF.top, 0.0f);
}
- rtArray.SetAt(i, rtBBoxF);
+ (*rtArray)[i] = rtBBoxF;
continue;
}
- rtArray.SetAt(i, rect);
+ (*rtArray)[i] = rect;
}
return iLength;
}
diff --git a/xfa/fgas/layout/fgas_textbreak.h b/xfa/fgas/layout/fgas_textbreak.h
index 7359600c14..ea86079ac3 100644
--- a/xfa/fgas/layout/fgas_textbreak.h
+++ b/xfa/fgas/layout/fgas_textbreak.h
@@ -8,6 +8,7 @@
#define XFA_FGAS_LAYOUT_FGAS_TEXTBREAK_H_
#include <memory>
+#include <vector>
#include "core/fxcrt/fx_ucd.h"
#include "core/fxge/cfx_renderdevice.h"
@@ -234,7 +235,7 @@ class CFX_TxtBreak {
CFX_WideString* pWSForms = nullptr,
FX_AdjustCharDisplayPos pAdjustPos = nullptr) const;
int32_t GetCharRects(const FX_TXTRUN* pTxtRun,
- CFX_RectFArray& rtArray,
+ std::vector<CFX_RectF>* rtArray,
bool bCharBBox = false) const;
void AppendChar_PageLoad(CFX_TxtChar* pCurChar, uint32_t dwProps);
uint32_t AppendChar_Combination(CFX_TxtChar* pCurChar, int32_t iRotation);