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