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

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

Issue 2031873003: Get rid of NULLs in xfa/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@nullptr_fpdfsdk
Patch Set: 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/include/xfa_rendercontext.h ('k') | xfa/fxfa/parser/cxfa_caption.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_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 bnullptr) {
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 (bnullptr)
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 = CXFA_Edge(pNode->GetProperty(i, XFA_ELEMENT_Edge, i == 0)); 38 CXFA_Edge edge = CXFA_Edge(pNode->GetProperty(i, XFA_ELEMENT_Edge, i == 0));
39 if (edge || i == 0) 39 if (edge || i == 0)
40 strokes.SetAt(j, edge); 40 strokes.SetAt(j, edge);
41 else if (bNULL) 41 else if (bnullptr)
42 strokes.SetAt(j, CXFA_Stroke(nullptr)); 42 strokes.SetAt(j, CXFA_Stroke(nullptr));
43 else if (i == 1) 43 else if (i == 1)
44 strokes.SetAt(j, strokes[1]); 44 strokes.SetAt(j, strokes[1]);
45 else if (i == 2) 45 else if (i == 2)
46 strokes.SetAt(j, strokes[1]); 46 strokes.SetAt(j, strokes[1]);
47 else 47 else
48 strokes.SetAt(j, strokes[3]); 48 strokes.SetAt(j, strokes[3]);
49 49
50 j++; 50 j++;
51 } 51 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 return CXFA_Margin(m_pNode ? m_pNode->GetChild(0, XFA_ELEMENT_Margin) 151 return CXFA_Margin(m_pNode ? m_pNode->GetChild(0, XFA_ELEMENT_Margin)
152 : nullptr); 152 : nullptr);
153 } 153 }
154 154
155 int32_t CXFA_Box::Get3DStyle(FX_BOOL& bVisible, FX_FLOAT& fThickness) const { 155 int32_t CXFA_Box::Get3DStyle(FX_BOOL& bVisible, FX_FLOAT& fThickness) const {
156 if (IsArc()) 156 if (IsArc())
157 return 0; 157 return 0;
158 158
159 CXFA_StrokeArray strokes; 159 CXFA_StrokeArray strokes;
160 GetStrokesInternal(m_pNode, strokes, TRUE); 160 GetStrokesInternal(m_pNode, strokes, TRUE);
161 CXFA_Stroke stroke(NULL); 161 CXFA_Stroke stroke(nullptr);
162 int32_t iType = Style3D(strokes, stroke); 162 int32_t iType = Style3D(strokes, stroke);
163 if (iType) { 163 if (iType) {
164 bVisible = stroke.IsVisible(); 164 bVisible = stroke.IsVisible();
165 fThickness = stroke.GetThickness(); 165 fThickness = stroke.GetThickness();
166 } 166 }
167 return iType; 167 return iType;
168 } 168 }
OLDNEW
« no previous file with comments | « xfa/fxfa/include/xfa_rendercontext.h ('k') | xfa/fxfa/parser/cxfa_caption.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698