Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: xfa/fxfa/parser/cxfa_stroke.cpp

Issue 2089443002: Convert XFA_ELEMENT to an enum class (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: More unknown checks Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/parser/cxfa_stroke.h ('k') | xfa/fxfa/parser/cxfa_validate.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/xfa_object.h" 9 #include "xfa/fxfa/parser/xfa_object.h"
10 10
(...skipping 12 matching lines...) Expand all
23 return m_pNode ? m_pNode->GetEnum(XFA_ATTRIBUTE_Stroke) 23 return m_pNode ? m_pNode->GetEnum(XFA_ATTRIBUTE_Stroke)
24 : XFA_ATTRIBUTEENUM_Solid; 24 : XFA_ATTRIBUTEENUM_Solid;
25 } 25 }
26 26
27 FX_FLOAT CXFA_Stroke::GetThickness() const { 27 FX_FLOAT CXFA_Stroke::GetThickness() const {
28 return GetMSThickness().ToUnit(XFA_UNIT_Pt); 28 return GetMSThickness().ToUnit(XFA_UNIT_Pt);
29 } 29 }
30 30
31 CXFA_Measurement CXFA_Stroke::GetMSThickness() const { 31 CXFA_Measurement CXFA_Stroke::GetMSThickness() const {
32 return m_pNode ? m_pNode->GetMeasure(XFA_ATTRIBUTE_Thickness) 32 return m_pNode ? m_pNode->GetMeasure(XFA_ATTRIBUTE_Thickness)
33 : XFA_GetAttributeDefaultValue_Measure(XFA_ELEMENT_Edge, 33 : XFA_GetAttributeDefaultValue_Measure(XFA_Element::Edge,
34 XFA_ATTRIBUTE_Thickness, 34 XFA_ATTRIBUTE_Thickness,
35 XFA_XDPPACKET_Form); 35 XFA_XDPPACKET_Form);
36 } 36 }
37 37
38 void CXFA_Stroke::SetMSThickness(CXFA_Measurement msThinkness) { 38 void CXFA_Stroke::SetMSThickness(CXFA_Measurement msThinkness) {
39 if (!m_pNode) 39 if (!m_pNode)
40 return; 40 return;
41 41
42 m_pNode->SetMeasure(XFA_ATTRIBUTE_Thickness, msThinkness); 42 m_pNode->SetMeasure(XFA_ATTRIBUTE_Thickness, msThinkness);
43 } 43 }
44 44
45 FX_ARGB CXFA_Stroke::GetColor() const { 45 FX_ARGB CXFA_Stroke::GetColor() const {
46 if (!m_pNode) 46 if (!m_pNode)
47 return 0xFF000000; 47 return 0xFF000000;
48 48
49 CXFA_Node* pNode = m_pNode->GetChild(0, XFA_ELEMENT_Color); 49 CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Color);
50 if (!pNode) 50 if (!pNode)
51 return 0xFF000000; 51 return 0xFF000000;
52 52
53 CFX_WideStringC wsColor; 53 CFX_WideStringC wsColor;
54 pNode->TryCData(XFA_ATTRIBUTE_Value, wsColor); 54 pNode->TryCData(XFA_ATTRIBUTE_Value, wsColor);
55 return CXFA_Data::ToColor(wsColor); 55 return CXFA_Data::ToColor(wsColor);
56 } 56 }
57 57
58 void CXFA_Stroke::SetColor(FX_ARGB argb) { 58 void CXFA_Stroke::SetColor(FX_ARGB argb) {
59 if (!m_pNode) 59 if (!m_pNode)
60 return; 60 return;
61 61
62 CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_Color); 62 CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_Element::Color);
63 CFX_WideString wsColor; 63 CFX_WideString wsColor;
64 int a; 64 int a;
65 int r; 65 int r;
66 int g; 66 int g;
67 int b; 67 int b;
68 ArgbDecode(argb, a, r, g, b); 68 ArgbDecode(argb, a, r, g, b);
69 wsColor.Format(L"%d,%d,%d", r, g, b); 69 wsColor.Format(L"%d,%d,%d", r, g, b);
70 pNode->SetCData(XFA_ATTRIBUTE_Value, wsColor); 70 pNode->SetCData(XFA_ATTRIBUTE_Value, wsColor);
71 } 71 }
72 72
(...skipping 23 matching lines...) Expand all
96 if (GetStrokeType() != stroke.GetStrokeType()) 96 if (GetStrokeType() != stroke.GetStrokeType())
97 return FALSE; 97 return FALSE;
98 if (GetColor() != stroke.GetColor()) 98 if (GetColor() != stroke.GetColor())
99 return FALSE; 99 return FALSE;
100 if ((dwFlags & XFA_STROKE_SAMESTYLE_Corner) != 0 && 100 if ((dwFlags & XFA_STROKE_SAMESTYLE_Corner) != 0 &&
101 FXSYS_fabs(GetRadius() - stroke.GetRadius()) >= 0.01f) { 101 FXSYS_fabs(GetRadius() - stroke.GetRadius()) >= 0.01f) {
102 return FALSE; 102 return FALSE;
103 } 103 }
104 return TRUE; 104 return TRUE;
105 } 105 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/cxfa_stroke.h ('k') | xfa/fxfa/parser/cxfa_validate.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698