Chromium Code Reviews| Index: xfa/fxfa/parser/cxfa_box.cpp |
| diff --git a/xfa/fxfa/parser/cxfa_box.cpp b/xfa/fxfa/parser/cxfa_box.cpp |
| index 9d9b4b47ad88ac48459999bd9e1b771c64ee3c28..390ff1bd9d5eae269905114095f088f289b06d61 100644 |
| --- a/xfa/fxfa/parser/cxfa_box.cpp |
| +++ b/xfa/fxfa/parser/cxfa_box.cpp |
| @@ -13,53 +13,49 @@ |
| 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); |
| + (*strokes)[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]); |
| + (*strokes)[j] = CXFA_Stroke(nullptr); |
|
npm
2017/01/23 14:49:50
Now this can be CXFA_Stroke(), right?
Tom Sepez
2017/01/23 18:36:51
Actually, now that I added the default ctor, the r
npm
2017/01/23 18:51:51
Acknowledged.
|
| + else if (i == 1 || i == 2) |
| + (*strokes)[j] = (*strokes)[0]; |
| else |
| - strokes.SetAt(j, strokes[2]); |
| + (*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); |
| + (*strokes)[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]); |
| + (*strokes)[j] = CXFA_Stroke(nullptr); |
|
npm
2017/01/23 14:49:50
ditto
Tom Sepez
2017/01/23 18:36:51
ditto
npm
2017/01/23 18:51:51
Acknowledged.
|
| + else if (i == 1 || i == 2) |
| + (*strokes)[j] = (*strokes)[1]; |
| else |
| - strokes.SetAt(j, strokes[3]); |
| + (*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 +101,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 +154,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) { |