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

Side by Side Diff: xfa/fgas/layout/fgas_rtfbreak.cpp

Issue 2567503002: Replace CFX_FloatArray with std::vector (Closed)
Patch Set: One less pointer Created 4 years 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/fgas/layout/fgas_rtfbreak.h ('k') | xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h » ('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 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 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/fgas/layout/fgas_rtfbreak.h" 7 #include "xfa/fgas/layout/fgas_rtfbreak.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "core/fxcrt/fx_arabic.h" 11 #include "core/fxcrt/fx_arabic.h"
12 #include "core/fxcrt/fx_arb.h" 12 #include "core/fxcrt/fx_arb.h"
13 #include "third_party/base/stl_util.h"
13 #include "xfa/fgas/font/cfgas_gefont.h" 14 #include "xfa/fgas/font/cfgas_gefont.h"
14 #include "xfa/fgas/layout/fgas_linebreak.h" 15 #include "xfa/fgas/layout/fgas_linebreak.h"
15 #include "xfa/fgas/layout/fgas_unicode.h" 16 #include "xfa/fgas/layout/fgas_unicode.h"
16 17
17 CFX_RTFBreak::CFX_RTFBreak(uint32_t dwPolicies) 18 CFX_RTFBreak::CFX_RTFBreak(uint32_t dwPolicies)
18 : m_dwPolicies(dwPolicies), 19 : m_dwPolicies(dwPolicies),
19 m_iBoundaryStart(0), 20 m_iBoundaryStart(0),
20 m_iBoundaryEnd(2000000), 21 m_iBoundaryEnd(2000000),
21 m_dwLayoutStyles(0), 22 m_dwLayoutStyles(0),
22 m_bPagination(false), 23 m_bPagination(false),
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 break; 146 break;
146 } 147 }
147 } 148 }
148 m_PositionedTabs.InsertAt(iFind, iTabPos); 149 m_PositionedTabs.InsertAt(iFind, iTabPos);
149 if (m_dwPolicies & FX_RTFBREAKPOLICY_OrphanPositionedTab) { 150 if (m_dwPolicies & FX_RTFBREAKPOLICY_OrphanPositionedTab) {
150 m_bOrphanLine = GetLastPositionedTab() >= iLineEnd; 151 m_bOrphanLine = GetLastPositionedTab() >= iLineEnd;
151 } else { 152 } else {
152 m_bOrphanLine = false; 153 m_bOrphanLine = false;
153 } 154 }
154 } 155 }
155 void CFX_RTFBreak::SetPositionedTabs(const CFX_FloatArray& tabs) { 156 void CFX_RTFBreak::SetPositionedTabs(const std::vector<FX_FLOAT>& tabs) {
156 m_PositionedTabs.RemoveAll(); 157 m_PositionedTabs.RemoveAll();
157 int32_t iCount = tabs.GetSize(); 158 int32_t iCount = pdfium::CollectionSize<int32_t>(tabs);
158 m_PositionedTabs.SetSize(iCount); 159 m_PositionedTabs.SetSize(iCount);
159 int32_t iLineEnd = m_iBoundaryEnd; 160 int32_t iLineEnd = m_iBoundaryEnd;
160 int32_t iTabPos; 161 int32_t iTabPos;
161 for (int32_t i = 0; i < iCount; i++) { 162 for (int32_t i = 0; i < iCount; i++) {
162 iTabPos = FXSYS_round(tabs[i] * 20000.0f) + m_iBoundaryStart; 163 iTabPos = FXSYS_round(tabs[i] * 20000.0f) + m_iBoundaryStart;
163 if (iTabPos > iLineEnd) { 164 if (iTabPos > iLineEnd) {
164 iTabPos = iLineEnd; 165 iTabPos = iLineEnd;
165 } 166 }
166 m_PositionedTabs[i] = iTabPos; 167 m_PositionedTabs[i] = iTabPos;
167 } 168 }
(...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 iLength(0), 1559 iLength(0),
1559 pFont(nullptr), 1560 pFont(nullptr),
1560 fFontSize(12.0f), 1561 fFontSize(12.0f),
1561 dwLayoutStyles(0), 1562 dwLayoutStyles(0),
1562 iCharRotation(0), 1563 iCharRotation(0),
1563 iBidiLevel(0), 1564 iBidiLevel(0),
1564 pRect(nullptr), 1565 pRect(nullptr),
1565 wLineBreakChar(L'\n'), 1566 wLineBreakChar(L'\n'),
1566 iHorizontalScale(100), 1567 iHorizontalScale(100),
1567 iVerticalScale(100) {} 1568 iVerticalScale(100) {}
OLDNEW
« no previous file with comments | « xfa/fgas/layout/fgas_rtfbreak.h ('k') | xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698