OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fxfa/parser/cxfa_box.h" | 7 #include "xfa/fxfa/parser/cxfa_box.h" |
8 | 8 |
9 #include "xfa/fxfa/parser/cxfa_corner.h" | 9 #include "xfa/fxfa/parser/cxfa_corner.h" |
10 #include "xfa/fxfa/parser/xfa_object.h" | 10 #include "xfa/fxfa/parser/xfa_object.h" |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 void GetStrokesInternal(CXFA_Node* pNode, | 14 void GetStrokesInternal(CXFA_Node* pNode, |
15 CXFA_StrokeArray& strokes, | 15 CXFA_StrokeArray& strokes, |
16 FX_BOOL bNULL) { | 16 FX_BOOL bNull) { |
17 strokes.RemoveAll(); | 17 strokes.RemoveAll(); |
18 if (!pNode) | 18 if (!pNode) |
19 return; | 19 return; |
20 | 20 |
21 strokes.SetSize(8); | 21 strokes.SetSize(8); |
22 int32_t i, j; | 22 int32_t i, j; |
23 for (i = 0, j = 0; i < 4; i++) { | 23 for (i = 0, j = 0; i < 4; i++) { |
24 CXFA_Corner corner = | 24 CXFA_Corner corner = |
25 CXFA_Corner(pNode->GetProperty(i, XFA_Element::Corner, i == 0)); | 25 CXFA_Corner(pNode->GetProperty(i, XFA_Element::Corner, i == 0)); |
26 if (corner || i == 0) | 26 if (corner || i == 0) |
27 strokes.SetAt(j, corner); | 27 strokes.SetAt(j, corner); |
28 else if (bNULL) | 28 else if (bNull) |
29 strokes.SetAt(j, CXFA_Stroke(nullptr)); | 29 strokes.SetAt(j, CXFA_Stroke(nullptr)); |
30 else if (i == 1) | 30 else if (i == 1) |
31 strokes.SetAt(j, strokes[0]); | 31 strokes.SetAt(j, strokes[0]); |
32 else if (i == 2) | 32 else if (i == 2) |
33 strokes.SetAt(j, strokes[0]); | 33 strokes.SetAt(j, strokes[0]); |
34 else | 34 else |
35 strokes.SetAt(j, strokes[2]); | 35 strokes.SetAt(j, strokes[2]); |
36 | 36 |
37 j++; | 37 j++; |
38 CXFA_Edge edge = | 38 CXFA_Edge edge = |
39 CXFA_Edge(pNode->GetProperty(i, XFA_Element::Edge, i == 0)); | 39 CXFA_Edge(pNode->GetProperty(i, XFA_Element::Edge, i == 0)); |
40 if (edge || i == 0) | 40 if (edge || i == 0) |
41 strokes.SetAt(j, edge); | 41 strokes.SetAt(j, edge); |
42 else if (bNULL) | 42 else if (bNull) |
43 strokes.SetAt(j, CXFA_Stroke(nullptr)); | 43 strokes.SetAt(j, CXFA_Stroke(nullptr)); |
44 else if (i == 1) | 44 else if (i == 1) |
45 strokes.SetAt(j, strokes[1]); | 45 strokes.SetAt(j, strokes[1]); |
46 else if (i == 2) | 46 else if (i == 2) |
47 strokes.SetAt(j, strokes[1]); | 47 strokes.SetAt(j, strokes[1]); |
48 else | 48 else |
49 strokes.SetAt(j, strokes[3]); | 49 strokes.SetAt(j, strokes[3]); |
50 | 50 |
51 j++; | 51 j++; |
52 } | 52 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 return CXFA_Margin(m_pNode ? m_pNode->GetChild(0, XFA_Element::Margin) | 152 return CXFA_Margin(m_pNode ? m_pNode->GetChild(0, XFA_Element::Margin) |
153 : nullptr); | 153 : nullptr); |
154 } | 154 } |
155 | 155 |
156 int32_t CXFA_Box::Get3DStyle(FX_BOOL& bVisible, FX_FLOAT& fThickness) const { | 156 int32_t CXFA_Box::Get3DStyle(FX_BOOL& bVisible, FX_FLOAT& fThickness) const { |
157 if (IsArc()) | 157 if (IsArc()) |
158 return 0; | 158 return 0; |
159 | 159 |
160 CXFA_StrokeArray strokes; | 160 CXFA_StrokeArray strokes; |
161 GetStrokesInternal(m_pNode, strokes, TRUE); | 161 GetStrokesInternal(m_pNode, strokes, TRUE); |
162 CXFA_Stroke stroke(NULL); | 162 CXFA_Stroke stroke(nullptr); |
163 int32_t iType = Style3D(strokes, stroke); | 163 int32_t iType = Style3D(strokes, stroke); |
164 if (iType) { | 164 if (iType) { |
165 bVisible = stroke.IsVisible(); | 165 bVisible = stroke.IsVisible(); |
166 fThickness = stroke.GetThickness(); | 166 fThickness = stroke.GetThickness(); |
167 } | 167 } |
168 return iType; | 168 return iType; |
169 } | 169 } |
OLD | NEW |