| 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 2013 ZXing authors | 8 * Copyright 2013 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 continue; | 103 continue; |
| 104 } | 104 } |
| 105 result += codeword->getRowNumber(); | 105 result += codeword->getRowNumber(); |
| 106 result += codeword->getValue(); | 106 result += codeword->getValue(); |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 return result; | 109 return result; |
| 110 } | 110 } |
| 111 void CBC_DetectionResult::adjustIndicatorColumnRowNumbers( | 111 void CBC_DetectionResult::adjustIndicatorColumnRowNumbers( |
| 112 CBC_DetectionResultColumn* detectionResultColumn) { | 112 CBC_DetectionResultColumn* detectionResultColumn) { |
| 113 if (detectionResultColumn != NULL) { | 113 if (detectionResultColumn) { |
| 114 ((CBC_DetectionResultRowIndicatorColumn*)detectionResultColumn) | 114 ((CBC_DetectionResultRowIndicatorColumn*)detectionResultColumn) |
| 115 ->adjustCompleteIndicatorColumnRowNumbers(*m_barcodeMetadata); | 115 ->adjustCompleteIndicatorColumnRowNumbers(*m_barcodeMetadata); |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 int32_t CBC_DetectionResult::adjustRowNumbers() { | 118 int32_t CBC_DetectionResult::adjustRowNumbers() { |
| 119 int32_t unadjustedCount = adjustRowNumbersByRow(); | 119 int32_t unadjustedCount = adjustRowNumbersByRow(); |
| 120 if (unadjustedCount == 0) { | 120 if (unadjustedCount == 0) { |
| 121 return 0; | 121 return 0; |
| 122 } | 122 } |
| 123 for (int32_t barcodeColumn = 1; barcodeColumn < m_barcodeColumnCount + 1; | 123 for (int32_t barcodeColumn = 1; barcodeColumn < m_barcodeColumnCount + 1; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 149 return 0; | 149 return 0; |
| 150 } | 150 } |
| 151 CFX_PtrArray* LRIcodewords = | 151 CFX_PtrArray* LRIcodewords = |
| 152 ((CBC_DetectionResultColumn*)m_detectionResultColumns[0])->getCodewords(); | 152 ((CBC_DetectionResultColumn*)m_detectionResultColumns[0])->getCodewords(); |
| 153 CFX_PtrArray* RRIcodewords = | 153 CFX_PtrArray* RRIcodewords = |
| 154 ((CBC_DetectionResultColumn*) | 154 ((CBC_DetectionResultColumn*) |
| 155 m_detectionResultColumns[m_barcodeColumnCount + 1]) | 155 m_detectionResultColumns[m_barcodeColumnCount + 1]) |
| 156 ->getCodewords(); | 156 ->getCodewords(); |
| 157 for (int32_t codewordsRow = 0; codewordsRow < LRIcodewords->GetSize(); | 157 for (int32_t codewordsRow = 0; codewordsRow < LRIcodewords->GetSize(); |
| 158 codewordsRow++) { | 158 codewordsRow++) { |
| 159 if (LRIcodewords->GetAt(codewordsRow) != NULL && | 159 if (LRIcodewords->GetAt(codewordsRow) && |
| 160 RRIcodewords->GetAt(codewordsRow) != NULL && | 160 RRIcodewords->GetAt(codewordsRow) && |
| 161 ((CBC_Codeword*)LRIcodewords->GetAt(codewordsRow))->getRowNumber() == | 161 ((CBC_Codeword*)LRIcodewords->GetAt(codewordsRow))->getRowNumber() == |
| 162 ((CBC_Codeword*)RRIcodewords->GetAt(codewordsRow)) | 162 ((CBC_Codeword*)RRIcodewords->GetAt(codewordsRow)) |
| 163 ->getRowNumber()) { | 163 ->getRowNumber()) { |
| 164 for (int32_t barcodeColumn = 1; barcodeColumn <= m_barcodeColumnCount; | 164 for (int32_t barcodeColumn = 1; barcodeColumn <= m_barcodeColumnCount; |
| 165 barcodeColumn++) { | 165 barcodeColumn++) { |
| 166 CBC_Codeword* codeword = | 166 CBC_Codeword* codeword = |
| 167 (CBC_Codeword*)((CBC_DetectionResultColumn*) | 167 (CBC_Codeword*)((CBC_DetectionResultColumn*) |
| 168 m_detectionResultColumns[barcodeColumn]) | 168 m_detectionResultColumns[barcodeColumn]) |
| 169 ->getCodewords() | 169 ->getCodewords() |
| 170 ->GetAt(codewordsRow); | 170 ->GetAt(codewordsRow); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 201 ((CBC_Codeword*)codewords->GetAt(codewordsRow))->getRowNumber(); | 201 ((CBC_Codeword*)codewords->GetAt(codewordsRow))->getRowNumber(); |
| 202 int32_t invalidRowCounts = 0; | 202 int32_t invalidRowCounts = 0; |
| 203 for (int32_t barcodeColumn = m_barcodeColumnCount + 1; | 203 for (int32_t barcodeColumn = m_barcodeColumnCount + 1; |
| 204 barcodeColumn > 0 && invalidRowCounts < ADJUST_ROW_NUMBER_SKIP; | 204 barcodeColumn > 0 && invalidRowCounts < ADJUST_ROW_NUMBER_SKIP; |
| 205 barcodeColumn--) { | 205 barcodeColumn--) { |
| 206 CBC_Codeword* codeword = | 206 CBC_Codeword* codeword = |
| 207 (CBC_Codeword*)((CBC_DetectionResultColumn*) | 207 (CBC_Codeword*)((CBC_DetectionResultColumn*) |
| 208 m_detectionResultColumns.GetAt(barcodeColumn)) | 208 m_detectionResultColumns.GetAt(barcodeColumn)) |
| 209 ->getCodewords() | 209 ->getCodewords() |
| 210 ->GetAt(codewordsRow); | 210 ->GetAt(codewordsRow); |
| 211 if (codeword != NULL) { | 211 if (codeword) { |
| 212 invalidRowCounts = adjustRowNumberIfValid(rowIndicatorRowNumber, | 212 invalidRowCounts = adjustRowNumberIfValid(rowIndicatorRowNumber, |
| 213 invalidRowCounts, codeword); | 213 invalidRowCounts, codeword); |
| 214 if (!codeword->hasValidRowNumber()) { | 214 if (!codeword->hasValidRowNumber()) { |
| 215 unadjustedCount++; | 215 unadjustedCount++; |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 return unadjustedCount; | 220 return unadjustedCount; |
| 221 } | 221 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 236 ((CBC_Codeword*)codewords->GetAt(codewordsRow))->getRowNumber(); | 236 ((CBC_Codeword*)codewords->GetAt(codewordsRow))->getRowNumber(); |
| 237 int32_t invalidRowCounts = 0; | 237 int32_t invalidRowCounts = 0; |
| 238 for (int32_t barcodeColumn = 1; barcodeColumn < m_barcodeColumnCount + 1 && | 238 for (int32_t barcodeColumn = 1; barcodeColumn < m_barcodeColumnCount + 1 && |
| 239 invalidRowCounts < ADJUST_ROW_NUMBER_SKIP; | 239 invalidRowCounts < ADJUST_ROW_NUMBER_SKIP; |
| 240 barcodeColumn++) { | 240 barcodeColumn++) { |
| 241 CBC_Codeword* codeword = | 241 CBC_Codeword* codeword = |
| 242 (CBC_Codeword*)((CBC_DetectionResultColumn*) | 242 (CBC_Codeword*)((CBC_DetectionResultColumn*) |
| 243 m_detectionResultColumns[barcodeColumn]) | 243 m_detectionResultColumns[barcodeColumn]) |
| 244 ->getCodewords() | 244 ->getCodewords() |
| 245 ->GetAt(codewordsRow); | 245 ->GetAt(codewordsRow); |
| 246 if (codeword != NULL) { | 246 if (codeword) { |
| 247 invalidRowCounts = adjustRowNumberIfValid(rowIndicatorRowNumber, | 247 invalidRowCounts = adjustRowNumberIfValid(rowIndicatorRowNumber, |
| 248 invalidRowCounts, codeword); | 248 invalidRowCounts, codeword); |
| 249 if (!codeword->hasValidRowNumber()) { | 249 if (!codeword->hasValidRowNumber()) { |
| 250 unadjustedCount++; | 250 unadjustedCount++; |
| 251 } | 251 } |
| 252 } | 252 } |
| 253 } | 253 } |
| 254 } | 254 } |
| 255 return unadjustedCount; | 255 return unadjustedCount; |
| 256 } | 256 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 273 } | 273 } |
| 274 void CBC_DetectionResult::adjustRowNumbers(int32_t barcodeColumn, | 274 void CBC_DetectionResult::adjustRowNumbers(int32_t barcodeColumn, |
| 275 int32_t codewordsRow, | 275 int32_t codewordsRow, |
| 276 CFX_PtrArray* codewords) { | 276 CFX_PtrArray* codewords) { |
| 277 CBC_Codeword* codeword = (CBC_Codeword*)codewords->GetAt(codewordsRow); | 277 CBC_Codeword* codeword = (CBC_Codeword*)codewords->GetAt(codewordsRow); |
| 278 CFX_PtrArray* previousColumnCodewords = | 278 CFX_PtrArray* previousColumnCodewords = |
| 279 ((CBC_DetectionResultColumn*)m_detectionResultColumns.GetAt( | 279 ((CBC_DetectionResultColumn*)m_detectionResultColumns.GetAt( |
| 280 barcodeColumn - 1)) | 280 barcodeColumn - 1)) |
| 281 ->getCodewords(); | 281 ->getCodewords(); |
| 282 CFX_PtrArray* nextColumnCodewords = previousColumnCodewords; | 282 CFX_PtrArray* nextColumnCodewords = previousColumnCodewords; |
| 283 if (m_detectionResultColumns[barcodeColumn + 1] != NULL) { | 283 if (m_detectionResultColumns[barcodeColumn + 1]) { |
| 284 nextColumnCodewords = ((CBC_DetectionResultColumn*) | 284 nextColumnCodewords = ((CBC_DetectionResultColumn*) |
| 285 m_detectionResultColumns[barcodeColumn + 1]) | 285 m_detectionResultColumns[barcodeColumn + 1]) |
| 286 ->getCodewords(); | 286 ->getCodewords(); |
| 287 } | 287 } |
| 288 CFX_PtrArray otherCodewords; | 288 CFX_PtrArray otherCodewords; |
| 289 otherCodewords.SetSize(14); | 289 otherCodewords.SetSize(14); |
| 290 otherCodewords[2] = previousColumnCodewords->GetAt(codewordsRow); | 290 otherCodewords[2] = previousColumnCodewords->GetAt(codewordsRow); |
| 291 otherCodewords[3] = nextColumnCodewords->GetAt(codewordsRow); | 291 otherCodewords[3] = nextColumnCodewords->GetAt(codewordsRow); |
| 292 if (codewordsRow > 0) { | 292 if (codewordsRow > 0) { |
| 293 otherCodewords[0] = codewords->GetAt(codewordsRow - 1); | 293 otherCodewords[0] = codewords->GetAt(codewordsRow - 1); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 } | 330 } |
| 331 int32_t CBC_DetectionResult::getBarcodeColumnCount() { | 331 int32_t CBC_DetectionResult::getBarcodeColumnCount() { |
| 332 return m_barcodeColumnCount; | 332 return m_barcodeColumnCount; |
| 333 } | 333 } |
| 334 int32_t CBC_DetectionResult::getBarcodeRowCount() { | 334 int32_t CBC_DetectionResult::getBarcodeRowCount() { |
| 335 return m_barcodeMetadata->getRowCount(); | 335 return m_barcodeMetadata->getRowCount(); |
| 336 } | 336 } |
| 337 int32_t CBC_DetectionResult::getBarcodeECLevel() { | 337 int32_t CBC_DetectionResult::getBarcodeECLevel() { |
| 338 return m_barcodeMetadata->getErrorCorrectionLevel(); | 338 return m_barcodeMetadata->getErrorCorrectionLevel(); |
| 339 } | 339 } |
| OLD | NEW |