| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 for (int32_t i = rowOffset; i < width; i++) { | 141 for (int32_t i = rowOffset; i < width; i++) { |
| 142 FX_BOOL pixel = row->Get(i); | 142 FX_BOOL pixel = row->Get(i); |
| 143 if (pixel ^ isWhite) { | 143 if (pixel ^ isWhite) { |
| 144 counters[counterPosition]++; | 144 counters[counterPosition]++; |
| 145 } else { | 145 } else { |
| 146 if (counterPosition == patternLength - 1) { | 146 if (counterPosition == patternLength - 1) { |
| 147 if (ArrayContains(STARTEND_ENCODING, ToNarrowWidePattern(&counters))) { | 147 if (ArrayContains(STARTEND_ENCODING, ToNarrowWidePattern(&counters))) { |
| 148 FX_BOOL btemp3 = | 148 FX_BOOL btemp3 = |
| 149 row->IsRange(std::max(0, patternStart - (i - patternStart) / 2), | 149 row->IsRange(std::max(0, patternStart - (i - patternStart) / 2), |
| 150 patternStart, FALSE, e); | 150 patternStart, FALSE, e); |
| 151 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 151 BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); |
| 152 if (btemp3) { | 152 if (btemp3) { |
| 153 CFX_Int32Array* result = new CFX_Int32Array(); | 153 CFX_Int32Array* result = new CFX_Int32Array(); |
| 154 result->SetSize(2); | 154 result->SetSize(2); |
| 155 (*result)[0] = patternStart; | 155 (*result)[0] = patternStart; |
| 156 (*result)[1] = i; | 156 (*result)[1] = i; |
| 157 return result; | 157 return result; |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 patternStart += counters[0] + counters[1]; | 160 patternStart += counters[0] + counters[1]; |
| 161 for (int32_t y = 2; y < patternLength; y++) { | 161 for (int32_t y = 2; y < patternLength; y++) { |
| 162 counters[y - 2] = counters[y]; | 162 counters[y - 2] = counters[y]; |
| 163 } | 163 } |
| 164 counters[patternLength - 2] = 0; | 164 counters[patternLength - 2] = 0; |
| 165 counters[patternLength - 1] = 0; | 165 counters[patternLength - 1] = 0; |
| 166 counterPosition--; | 166 counterPosition--; |
| 167 } else { | 167 } else { |
| 168 counterPosition++; | 168 counterPosition++; |
| 169 } | 169 } |
| 170 counters[counterPosition] = 1; | 170 counters[counterPosition] = 1; |
| 171 isWhite = !isWhite; | 171 isWhite = !isWhite; |
| 172 } | 172 } |
| 173 } | 173 } |
| 174 e = BCExceptionNotFound; | 174 e = BCExceptionNotFound; |
| 175 return NULL; | 175 return nullptr; |
| 176 } | 176 } |
| 177 FX_BOOL CBC_OnedCodaBarReader::ArrayContains(const FX_CHAR array[], | 177 FX_BOOL CBC_OnedCodaBarReader::ArrayContains(const FX_CHAR array[], |
| 178 FX_CHAR key) { | 178 FX_CHAR key) { |
| 179 for (int32_t i = 0; i < 8; i++) { | 179 for (int32_t i = 0; i < 8; i++) { |
| 180 if (array[i] == key) { | 180 if (array[i] == key) { |
| 181 return TRUE; | 181 return TRUE; |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 return FALSE; | 184 return FALSE; |
| 185 } | 185 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 204 } | 204 } |
| 205 if ((wideCounters == 2) || (wideCounters == 3)) { | 205 if ((wideCounters == 2) || (wideCounters == 3)) { |
| 206 for (int32_t k = 0; k < 22; k++) { | 206 for (int32_t k = 0; k < 22; k++) { |
| 207 if (CHARACTER_ENCODINGS[k] == pattern) { | 207 if (CHARACTER_ENCODINGS[k] == pattern) { |
| 208 return (ALPHABET_STRING)[k]; | 208 return (ALPHABET_STRING)[k]; |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 } | 211 } |
| 212 return '!'; | 212 return '!'; |
| 213 } | 213 } |
| OLD | NEW |