summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_box.cpp58
-rw-r--r--xfa/fxfa/parser/cxfa_box.h4
-rw-r--r--xfa/fxfa/parser/cxfa_stroke.h3
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp6
4 files changed, 33 insertions, 38 deletions
diff --git a/xfa/fxfa/parser/cxfa_box.cpp b/xfa/fxfa/parser/cxfa_box.cpp
index 9d9b4b47ad..552c98031a 100644
--- a/xfa/fxfa/parser/cxfa_box.cpp
+++ b/xfa/fxfa/parser/cxfa_box.cpp
@@ -13,53 +13,47 @@
namespace {
void GetStrokesInternal(CXFA_Node* pNode,
- CXFA_StrokeArray& strokes,
+ std::vector<CXFA_Stroke>* strokes,
bool bNull) {
- strokes.RemoveAll();
+ strokes->clear();
if (!pNode)
return;
- strokes.SetSize(8);
+ strokes->resize(8);
int32_t i, j;
for (i = 0, j = 0; i < 4; i++) {
CXFA_Corner corner =
CXFA_Corner(pNode->GetProperty(i, XFA_Element::Corner, i == 0));
- if (corner || i == 0)
- strokes.SetAt(j, corner);
- else if (bNull)
- strokes.SetAt(j, CXFA_Stroke(nullptr));
- else if (i == 1)
- strokes.SetAt(j, strokes[0]);
- else if (i == 2)
- strokes.SetAt(j, strokes[0]);
- else
- strokes.SetAt(j, strokes[2]);
-
+ if (corner || i == 0) {
+ (*strokes)[j] = corner;
+ } else if (!bNull) {
+ if (i == 1 || i == 2)
+ (*strokes)[j] = (*strokes)[0];
+ else
+ (*strokes)[j] = (*strokes)[2];
+ }
j++;
CXFA_Edge edge =
CXFA_Edge(pNode->GetProperty(i, XFA_Element::Edge, i == 0));
- if (edge || i == 0)
- strokes.SetAt(j, edge);
- else if (bNull)
- strokes.SetAt(j, CXFA_Stroke(nullptr));
- else if (i == 1)
- strokes.SetAt(j, strokes[1]);
- else if (i == 2)
- strokes.SetAt(j, strokes[1]);
- else
- strokes.SetAt(j, strokes[3]);
-
+ if (edge || i == 0) {
+ (*strokes)[j] = edge;
+ } else if (!bNull) {
+ if (i == 1 || i == 2)
+ (*strokes)[j] = (*strokes)[1];
+ else
+ (*strokes)[j] = (*strokes)[3];
+ }
j++;
}
}
-static int32_t Style3D(const CXFA_StrokeArray& strokes, CXFA_Stroke& stroke) {
- int32_t iCount = strokes.GetSize();
- if (iCount < 1)
+static int32_t Style3D(const std::vector<CXFA_Stroke>& strokes,
+ CXFA_Stroke& stroke) {
+ if (strokes.empty())
return 0;
stroke = strokes[0];
- for (int32_t i = 1; i < iCount; i++) {
+ for (size_t i = 1; i < strokes.size(); i++) {
CXFA_Stroke find = strokes[i];
if (!find)
continue;
@@ -105,7 +99,7 @@ CXFA_Edge CXFA_Box::GetEdge(int32_t nIndex) const {
: nullptr);
}
-void CXFA_Box::GetStrokes(CXFA_StrokeArray& strokes) const {
+void CXFA_Box::GetStrokes(std::vector<CXFA_Stroke>* strokes) const {
GetStrokesInternal(m_pNode, strokes, false);
}
@@ -158,8 +152,8 @@ int32_t CXFA_Box::Get3DStyle(bool& bVisible, FX_FLOAT& fThickness) const {
if (IsArc())
return 0;
- CXFA_StrokeArray strokes;
- GetStrokesInternal(m_pNode, strokes, true);
+ std::vector<CXFA_Stroke> strokes;
+ GetStrokesInternal(m_pNode, &strokes, true);
CXFA_Stroke stroke(nullptr);
int32_t iType = Style3D(strokes, stroke);
if (iType) {
diff --git a/xfa/fxfa/parser/cxfa_box.h b/xfa/fxfa/parser/cxfa_box.h
index 014155ceb7..a0af2f449b 100644
--- a/xfa/fxfa/parser/cxfa_box.h
+++ b/xfa/fxfa/parser/cxfa_box.h
@@ -7,6 +7,8 @@
#ifndef XFA_FXFA_PARSER_CXFA_BOX_H_
#define XFA_FXFA_PARSER_CXFA_BOX_H_
+#include <vector>
+
#include "core/fxcrt/fx_system.h"
#include "xfa/fxfa/parser/cxfa_data.h"
#include "xfa/fxfa/parser/cxfa_edge.h"
@@ -28,7 +30,7 @@ class CXFA_Box : public CXFA_Data {
int32_t GetPresence() const;
int32_t CountEdges() const;
CXFA_Edge GetEdge(int32_t nIndex = 0) const;
- void GetStrokes(CXFA_StrokeArray& strokes) const;
+ void GetStrokes(std::vector<CXFA_Stroke>* strokes) const;
bool IsCircular() const;
bool GetStartAngle(FX_FLOAT& fStartAngle) const;
FX_FLOAT GetStartAngle() const {
diff --git a/xfa/fxfa/parser/cxfa_stroke.h b/xfa/fxfa/parser/cxfa_stroke.h
index a3287d2855..cf941c8f0f 100644
--- a/xfa/fxfa/parser/cxfa_stroke.h
+++ b/xfa/fxfa/parser/cxfa_stroke.h
@@ -21,6 +21,7 @@ class CXFA_Node;
class CXFA_Stroke : public CXFA_Data {
public:
+ CXFA_Stroke() : CXFA_Stroke(nullptr) {}
explicit CXFA_Stroke(CXFA_Node* pNode) : CXFA_Data(pNode) {}
bool IsCorner() const { return GetElementType() == XFA_Element::Corner; }
@@ -40,6 +41,4 @@ class CXFA_Stroke : public CXFA_Data {
bool SameStyles(CXFA_Stroke stroke, uint32_t dwFlags = 0) const;
};
-typedef CFX_ArrayTemplate<CXFA_Stroke> CXFA_StrokeArray;
-
#endif // XFA_FXFA_PARSER_CXFA_STROKE_H_
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index 31c5cf48e6..e77fa55d50 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -18,7 +18,7 @@
namespace {
-FX_FLOAT GetEdgeThickness(const CXFA_StrokeArray& strokes,
+FX_FLOAT GetEdgeThickness(const std::vector<CXFA_Stroke>& strokes,
bool b3DStyle,
int32_t nIndex) {
FX_FLOAT fThickness = 0;
@@ -431,8 +431,8 @@ CFX_RectF CXFA_WidgetData::GetUIMargin() {
FX_FLOAT fThickness = 0;
border.Get3DStyle(bVisible, fThickness);
if (!bLeft || !bTop || !bRight || !bBottom) {
- CXFA_StrokeArray strokes;
- border.GetStrokes(strokes);
+ std::vector<CXFA_Stroke> strokes;
+ border.GetStrokes(&strokes);
if (!bTop)
fTopInset = GetEdgeThickness(strokes, bVisible, 0);
if (!bRight)