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_stroke.h" | 7 #include "xfa/fxfa/parser/cxfa_stroke.h" |
8 | 8 |
9 #include "xfa/fxfa/parser/cxfa_measurement.h" | 9 #include "xfa/fxfa/parser/cxfa_measurement.h" |
10 #include "xfa/fxfa/parser/xfa_object.h" | 10 #include "xfa/fxfa/parser/xfa_object.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 ArgbDecode(argb, a, r, g, b); | 69 ArgbDecode(argb, a, r, g, b); |
70 wsColor.Format(L"%d,%d,%d", r, g, b); | 70 wsColor.Format(L"%d,%d,%d", r, g, b); |
71 pNode->SetCData(XFA_ATTRIBUTE_Value, wsColor); | 71 pNode->SetCData(XFA_ATTRIBUTE_Value, wsColor); |
72 } | 72 } |
73 | 73 |
74 int32_t CXFA_Stroke::GetJoinType() const { | 74 int32_t CXFA_Stroke::GetJoinType() const { |
75 return m_pNode ? m_pNode->GetEnum(XFA_ATTRIBUTE_Join) | 75 return m_pNode ? m_pNode->GetEnum(XFA_ATTRIBUTE_Join) |
76 : XFA_ATTRIBUTEENUM_Square; | 76 : XFA_ATTRIBUTEENUM_Square; |
77 } | 77 } |
78 | 78 |
79 FX_BOOL CXFA_Stroke::IsInverted() const { | 79 bool CXFA_Stroke::IsInverted() const { |
80 return m_pNode ? m_pNode->GetBoolean(XFA_ATTRIBUTE_Inverted) : FALSE; | 80 return m_pNode ? m_pNode->GetBoolean(XFA_ATTRIBUTE_Inverted) : false; |
81 } | 81 } |
82 | 82 |
83 FX_FLOAT CXFA_Stroke::GetRadius() const { | 83 FX_FLOAT CXFA_Stroke::GetRadius() const { |
84 return m_pNode ? m_pNode->GetMeasure(XFA_ATTRIBUTE_Radius).ToUnit(XFA_UNIT_Pt) | 84 return m_pNode ? m_pNode->GetMeasure(XFA_ATTRIBUTE_Radius).ToUnit(XFA_UNIT_Pt) |
85 : 0; | 85 : 0; |
86 } | 86 } |
87 | 87 |
88 FX_BOOL CXFA_Stroke::SameStyles(CXFA_Stroke stroke, uint32_t dwFlags) const { | 88 bool CXFA_Stroke::SameStyles(CXFA_Stroke stroke, uint32_t dwFlags) const { |
89 if (m_pNode == stroke.GetNode()) | 89 if (m_pNode == stroke.GetNode()) |
90 return TRUE; | 90 return true; |
91 if (FXSYS_fabs(GetThickness() - stroke.GetThickness()) >= 0.01f) | 91 if (FXSYS_fabs(GetThickness() - stroke.GetThickness()) >= 0.01f) |
92 return FALSE; | 92 return false; |
93 if ((dwFlags & XFA_STROKE_SAMESTYLE_NoPresence) == 0 && | 93 if ((dwFlags & XFA_STROKE_SAMESTYLE_NoPresence) == 0 && |
94 IsVisible() != stroke.IsVisible()) { | 94 IsVisible() != stroke.IsVisible()) { |
95 return FALSE; | 95 return false; |
96 } | 96 } |
97 if (GetStrokeType() != stroke.GetStrokeType()) | 97 if (GetStrokeType() != stroke.GetStrokeType()) |
98 return FALSE; | 98 return false; |
99 if (GetColor() != stroke.GetColor()) | 99 if (GetColor() != stroke.GetColor()) |
100 return FALSE; | 100 return false; |
101 if ((dwFlags & XFA_STROKE_SAMESTYLE_Corner) != 0 && | 101 if ((dwFlags & XFA_STROKE_SAMESTYLE_Corner) != 0 && |
102 FXSYS_fabs(GetRadius() - stroke.GetRadius()) >= 0.01f) { | 102 FXSYS_fabs(GetRadius() - stroke.GetRadius()) >= 0.01f) { |
103 return FALSE; | 103 return false; |
104 } | 104 } |
105 return TRUE; | 105 return true; |
106 } | 106 } |
OLD | NEW |