| OLD | NEW |
| 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 2008 ZXing authors | 8 * Copyright 2008 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 {2, 4, 1, 1, 1, 2, 0}, {1, 3, 4, 1, 1, 1, 0}, {1, 1, 1, 2, 4, 2, 0}, | 58 {2, 4, 1, 1, 1, 2, 0}, {1, 3, 4, 1, 1, 1, 0}, {1, 1, 1, 2, 4, 2, 0}, |
| 59 {1, 2, 1, 1, 4, 2, 0}, {1, 2, 1, 2, 4, 1, 0}, {1, 1, 4, 2, 1, 2, 0}, | 59 {1, 2, 1, 1, 4, 2, 0}, {1, 2, 1, 2, 4, 1, 0}, {1, 1, 4, 2, 1, 2, 0}, |
| 60 {1, 2, 4, 1, 1, 2, 0}, {1, 2, 4, 2, 1, 1, 0}, {4, 1, 1, 2, 1, 2, 0}, | 60 {1, 2, 4, 1, 1, 2, 0}, {1, 2, 4, 2, 1, 1, 0}, {4, 1, 1, 2, 1, 2, 0}, |
| 61 {4, 2, 1, 1, 1, 2, 0}, {4, 2, 1, 2, 1, 1, 0}, {2, 1, 2, 1, 4, 1, 0}, | 61 {4, 2, 1, 1, 1, 2, 0}, {4, 2, 1, 2, 1, 1, 0}, {2, 1, 2, 1, 4, 1, 0}, |
| 62 {2, 1, 4, 1, 2, 1, 0}, {4, 1, 2, 1, 2, 1, 0}, {1, 1, 1, 1, 4, 3, 0}, | 62 {2, 1, 4, 1, 2, 1, 0}, {4, 1, 2, 1, 2, 1, 0}, {1, 1, 1, 1, 4, 3, 0}, |
| 63 {1, 1, 1, 3, 4, 1, 0}, {1, 3, 1, 1, 4, 1, 0}, {1, 1, 4, 1, 1, 3, 0}, | 63 {1, 1, 1, 3, 4, 1, 0}, {1, 3, 1, 1, 4, 1, 0}, {1, 1, 4, 1, 1, 3, 0}, |
| 64 {1, 1, 4, 3, 1, 1, 0}, {4, 1, 1, 1, 1, 3, 0}, {4, 1, 1, 3, 1, 1, 0}, | 64 {1, 1, 4, 3, 1, 1, 0}, {4, 1, 1, 1, 1, 3, 0}, {4, 1, 1, 3, 1, 1, 0}, |
| 65 {1, 1, 3, 1, 4, 1, 0}, {1, 1, 4, 1, 3, 1, 0}, {3, 1, 1, 1, 4, 1, 0}, | 65 {1, 1, 3, 1, 4, 1, 0}, {1, 1, 4, 1, 3, 1, 0}, {3, 1, 1, 1, 4, 1, 0}, |
| 66 {4, 1, 1, 1, 3, 1, 0}, {2, 1, 1, 4, 1, 2, 0}, {2, 1, 1, 2, 1, 4, 0}, | 66 {4, 1, 1, 1, 3, 1, 0}, {2, 1, 1, 4, 1, 2, 0}, {2, 1, 1, 2, 1, 4, 0}, |
| 67 {2, 1, 1, 2, 3, 2, 0}, {2, 3, 3, 1, 1, 1, 2}}; | 67 {2, 1, 1, 2, 3, 2, 0}, {2, 3, 3, 1, 1, 1, 2}}; |
| 68 const int32_t CBC_OnedCode128Reader::MAX_AVG_VARIANCE = (int32_t)(256 * 0.25f); | 68 |
| 69 const int32_t CBC_OnedCode128Reader::MAX_INDIVIDUAL_VARIANCE = | |
| 70 (int32_t)(256 * 0.7f); | |
| 71 const int32_t CBC_OnedCode128Reader::CODE_SHIFT = 98; | |
| 72 const int32_t CBC_OnedCode128Reader::CODE_CODE_C = 99; | |
| 73 const int32_t CBC_OnedCode128Reader::CODE_CODE_B = 100; | |
| 74 const int32_t CBC_OnedCode128Reader::CODE_CODE_A = 101; | |
| 75 const int32_t CBC_OnedCode128Reader::CODE_FNC_1 = 102; | |
| 76 const int32_t CBC_OnedCode128Reader::CODE_FNC_2 = 97; | |
| 77 const int32_t CBC_OnedCode128Reader::CODE_FNC_3 = 96; | |
| 78 const int32_t CBC_OnedCode128Reader::CODE_FNC_4_A = 101; | |
| 79 const int32_t CBC_OnedCode128Reader::CODE_FNC_4_B = 100; | |
| 80 const int32_t CBC_OnedCode128Reader::CODE_START_A = 103; | |
| 81 const int32_t CBC_OnedCode128Reader::CODE_START_B = 104; | |
| 82 const int32_t CBC_OnedCode128Reader::CODE_START_C = 105; | |
| 83 const int32_t CBC_OnedCode128Reader::CODE_STOP = 106; | |
| 84 CBC_OnedCode128Reader::CBC_OnedCode128Reader() {} | 69 CBC_OnedCode128Reader::CBC_OnedCode128Reader() {} |
| 85 CBC_OnedCode128Reader::~CBC_OnedCode128Reader() {} | 70 CBC_OnedCode128Reader::~CBC_OnedCode128Reader() {} |
| 86 CFX_Int32Array* CBC_OnedCode128Reader::FindStartPattern(CBC_CommonBitArray* row, | 71 CFX_Int32Array* CBC_OnedCode128Reader::FindStartPattern(CBC_CommonBitArray* row, |
| 87 int32_t& e) { | 72 int32_t& e) { |
| 88 int32_t width = row->GetSize(); | 73 int32_t width = row->GetSize(); |
| 89 int32_t rowOffset = 0; | 74 int32_t rowOffset = 0; |
| 90 while (rowOffset < width) { | 75 while (rowOffset < width) { |
| 91 if (row->Get(rowOffset)) { | 76 if (row->Get(rowOffset)) { |
| 92 break; | 77 break; |
| 93 } | 78 } |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 break; | 284 break; |
| 300 } | 285 } |
| 301 } | 286 } |
| 302 break; | 287 break; |
| 303 case 99: | 288 case 99: |
| 304 if (code < 100) { | 289 if (code < 100) { |
| 305 if (code < 10) { | 290 if (code < 10) { |
| 306 result += '0'; | 291 result += '0'; |
| 307 } | 292 } |
| 308 FX_CHAR temp[128]; | 293 FX_CHAR temp[128]; |
| 294 // TODO(dsinclair): Should this be snprintf? |
| 309 sprintf(temp, "%d", code); | 295 sprintf(temp, "%d", code); |
| 310 result += temp; | 296 result += temp; |
| 311 } else { | 297 } else { |
| 312 if (code != CODE_STOP) { | 298 if (code != CODE_STOP) { |
| 313 lastCharacterWasPrintable = FALSE; | 299 lastCharacterWasPrintable = FALSE; |
| 314 } | 300 } |
| 315 switch (code) { | 301 switch (code) { |
| 316 case 102: | 302 case 102: |
| 317 break; | 303 break; |
| 318 case 101: | 304 case 101: |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 } else { | 342 } else { |
| 357 result = result.Mid(0, result.GetLength() - 1); | 343 result = result.Mid(0, result.GetLength() - 1); |
| 358 } | 344 } |
| 359 } | 345 } |
| 360 if (result.GetLength() == 0) { | 346 if (result.GetLength() == 0) { |
| 361 e = BCExceptionFormatException; | 347 e = BCExceptionFormatException; |
| 362 return ""; | 348 return ""; |
| 363 } | 349 } |
| 364 return result; | 350 return result; |
| 365 } | 351 } |
| OLD | NEW |