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

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

Issue 2648773003: Replace CXFA_StrokeArray and CXFA_WidgetArray with std::vector (Closed)
Patch Set: pass by pointer Created 3 years, 11 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
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_widgetdata.h" 7 #include "xfa/fxfa/parser/cxfa_widgetdata.h"
8 8
9 #include "core/fxcrt/fx_ext.h" 9 #include "core/fxcrt/fx_ext.h"
10 #include "third_party/base/stl_util.h" 10 #include "third_party/base/stl_util.h"
11 #include "xfa/fxbarcode/BC_Library.h" 11 #include "xfa/fxbarcode/BC_Library.h"
12 #include "xfa/fxfa/app/xfa_ffnotify.h" 12 #include "xfa/fxfa/app/xfa_ffnotify.h"
13 #include "xfa/fxfa/parser/cxfa_document.h" 13 #include "xfa/fxfa/parser/cxfa_document.h"
14 #include "xfa/fxfa/parser/cxfa_event.h" 14 #include "xfa/fxfa/parser/cxfa_event.h"
15 #include "xfa/fxfa/parser/cxfa_measurement.h" 15 #include "xfa/fxfa/parser/cxfa_measurement.h"
16 #include "xfa/fxfa/parser/xfa_localevalue.h" 16 #include "xfa/fxfa/parser/xfa_localevalue.h"
17 #include "xfa/fxfa/parser/xfa_object.h" 17 #include "xfa/fxfa/parser/xfa_object.h"
18 18
19 namespace { 19 namespace {
20 20
21 FX_FLOAT GetEdgeThickness(const CXFA_StrokeArray& strokes, 21 FX_FLOAT GetEdgeThickness(const std::vector<CXFA_Stroke>& strokes,
22 bool b3DStyle, 22 bool b3DStyle,
23 int32_t nIndex) { 23 int32_t nIndex) {
24 FX_FLOAT fThickness = 0; 24 FX_FLOAT fThickness = 0;
25 25
26 if (strokes[nIndex * 2 + 1].GetPresence() == XFA_ATTRIBUTEENUM_Visible) { 26 if (strokes[nIndex * 2 + 1].GetPresence() == XFA_ATTRIBUTEENUM_Visible) {
27 if (nIndex == 0) 27 if (nIndex == 0)
28 fThickness += 2.5f; 28 fThickness += 2.5f;
29 29
30 fThickness += strokes[nIndex * 2 + 1].GetThickness() * (b3DStyle ? 4 : 2); 30 fThickness += strokes[nIndex * 2 + 1].GetThickness() * (b3DStyle ? 4 : 2);
31 } 31 }
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 FX_FLOAT fLeftInset, fTopInset, fRightInset, fBottomInset; 424 FX_FLOAT fLeftInset, fTopInset, fRightInset, fBottomInset;
425 bool bLeft = mgUI.GetLeftInset(fLeftInset); 425 bool bLeft = mgUI.GetLeftInset(fLeftInset);
426 bool bTop = mgUI.GetTopInset(fTopInset); 426 bool bTop = mgUI.GetTopInset(fTopInset);
427 bool bRight = mgUI.GetRightInset(fRightInset); 427 bool bRight = mgUI.GetRightInset(fRightInset);
428 bool bBottom = mgUI.GetBottomInset(fBottomInset); 428 bool bBottom = mgUI.GetBottomInset(fBottomInset);
429 if (border) { 429 if (border) {
430 bool bVisible = false; 430 bool bVisible = false;
431 FX_FLOAT fThickness = 0; 431 FX_FLOAT fThickness = 0;
432 border.Get3DStyle(bVisible, fThickness); 432 border.Get3DStyle(bVisible, fThickness);
433 if (!bLeft || !bTop || !bRight || !bBottom) { 433 if (!bLeft || !bTop || !bRight || !bBottom) {
434 CXFA_StrokeArray strokes; 434 std::vector<CXFA_Stroke> strokes;
435 border.GetStrokes(strokes); 435 border.GetStrokes(&strokes);
436 if (!bTop) 436 if (!bTop)
437 fTopInset = GetEdgeThickness(strokes, bVisible, 0); 437 fTopInset = GetEdgeThickness(strokes, bVisible, 0);
438 if (!bRight) 438 if (!bRight)
439 fRightInset = GetEdgeThickness(strokes, bVisible, 1); 439 fRightInset = GetEdgeThickness(strokes, bVisible, 1);
440 if (!bBottom) 440 if (!bBottom)
441 fBottomInset = GetEdgeThickness(strokes, bVisible, 2); 441 fBottomInset = GetEdgeThickness(strokes, bVisible, 2);
442 if (!bLeft) 442 if (!bLeft)
443 fLeftInset = GetEdgeThickness(strokes, bVisible, 3); 443 fLeftInset = GetEdgeThickness(strokes, bVisible, 3);
444 } 444 }
445 } 445 }
(...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 } 1941 }
1942 } 1942 }
1943 } else if (wc == L'.') { 1943 } else if (wc == L'.') {
1944 iTread_ = 0; 1944 iTread_ = 0;
1945 iLead = -1; 1945 iLead = -1;
1946 } 1946 }
1947 wsRet += wc; 1947 wsRet += wc;
1948 } 1948 }
1949 return wsRet; 1949 return wsRet;
1950 } 1950 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698