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

Side by Side Diff: xfa/src/fxbarcode/pdf417/BC_PDF417Detector.cpp

Issue 1277043002: XFA: clang-format all pdfium code, again. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 4 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 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 // Original code is licensed as follows: 6 // Original code is licensed as follows:
7 /* 7 /*
8 * Copyright 2009 ZXing authors 8 * Copyright 2009 ZXing authors
9 * 9 *
10 * Licensed under the Apache License, Version 2.0 (the "License"); 10 * Licensed under the Apache License, Version 2.0 (the "License");
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 findGuardPattern(matrix, startColumn, --startRow, width, FALSE, 207 findGuardPattern(matrix, startColumn, --startRow, width, FALSE,
208 pattern, patternLength, counters); 208 pattern, patternLength, counters);
209 if (previousRowLoc != NULL) { 209 if (previousRowLoc != NULL) {
210 delete loc; 210 delete loc;
211 loc = previousRowLoc; 211 loc = previousRowLoc;
212 } else { 212 } else {
213 startRow++; 213 startRow++;
214 break; 214 break;
215 } 215 }
216 } 216 }
217 result->SetAt(0, new CBC_ResultPoint((FX_FLOAT)loc->GetAt(0), 217 result->SetAt(
218 (FX_FLOAT)startRow)); 218 0, new CBC_ResultPoint((FX_FLOAT)loc->GetAt(0), (FX_FLOAT)startRow));
219 result->SetAt(1, new CBC_ResultPoint((FX_FLOAT)loc->GetAt(1), 219 result->SetAt(
220 (FX_FLOAT)startRow)); 220 1, new CBC_ResultPoint((FX_FLOAT)loc->GetAt(1), (FX_FLOAT)startRow));
221 found = TRUE; 221 found = TRUE;
222 delete loc; 222 delete loc;
223 break; 223 break;
224 } 224 }
225 } 225 }
226 int32_t stopRow = startRow + 1; 226 int32_t stopRow = startRow + 1;
227 if (found) { 227 if (found) {
228 int32_t skippedRowCount = 0; 228 int32_t skippedRowCount = 0;
229 CFX_Int32Array previousRowLoc; 229 CFX_Int32Array previousRowLoc;
230 previousRowLoc.Add((int32_t)((CBC_ResultPoint*)result->GetAt(0))->GetX()); 230 previousRowLoc.Add((int32_t)((CBC_ResultPoint*)result->GetAt(0))->GetX());
(...skipping 12 matching lines...) Expand all
243 delete loc; 243 delete loc;
244 break; 244 break;
245 } else { 245 } else {
246 skippedRowCount++; 246 skippedRowCount++;
247 } 247 }
248 } 248 }
249 delete loc; 249 delete loc;
250 } 250 }
251 stopRow -= skippedRowCount + 1; 251 stopRow -= skippedRowCount + 1;
252 result->SetAt(2, new CBC_ResultPoint((FX_FLOAT)previousRowLoc.GetAt(0), 252 result->SetAt(2, new CBC_ResultPoint((FX_FLOAT)previousRowLoc.GetAt(0),
253 (FX_FLOAT)stopRow)); 253 (FX_FLOAT)stopRow));
254 result->SetAt(3, new CBC_ResultPoint((FX_FLOAT)previousRowLoc.GetAt(1), 254 result->SetAt(3, new CBC_ResultPoint((FX_FLOAT)previousRowLoc.GetAt(1),
255 (FX_FLOAT)stopRow)); 255 (FX_FLOAT)stopRow));
256 } 256 }
257 if (stopRow - startRow < BARCODE_MIN_HEIGHT) { 257 if (stopRow - startRow < BARCODE_MIN_HEIGHT) {
258 for (int32_t i = 0; i < result->GetSize(); i++) { 258 for (int32_t i = 0; i < result->GetSize(); i++) {
259 result->SetAt(i, NULL); 259 result->SetAt(i, NULL);
260 } 260 }
261 } 261 }
262 return result; 262 return result;
263 } 263 }
264 CFX_Int32Array* CBC_Detector::findGuardPattern(CBC_CommonBitMatrix* matrix, 264 CFX_Int32Array* CBC_Detector::findGuardPattern(CBC_CommonBitMatrix* matrix,
265 int32_t column, 265 int32_t column,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 int32_t scaledPattern = pattern[x] * unitBarWidth; 341 int32_t scaledPattern = pattern[x] * unitBarWidth;
342 int32_t variance = counter > scaledPattern ? counter - scaledPattern 342 int32_t variance = counter > scaledPattern ? counter - scaledPattern
343 : scaledPattern - counter; 343 : scaledPattern - counter;
344 if (variance > maxIndividualVariance) { 344 if (variance > maxIndividualVariance) {
345 return INTERGER_MAX; 345 return INTERGER_MAX;
346 } 346 }
347 totalVariance += variance; 347 totalVariance += variance;
348 } 348 }
349 return totalVariance / total; 349 return totalVariance / total;
350 } 350 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698