| 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 22 matching lines...) Expand all Loading... |
| 33 } | 33 } |
| 34 CBC_DetectionResultColumn::~CBC_DetectionResultColumn() { | 34 CBC_DetectionResultColumn::~CBC_DetectionResultColumn() { |
| 35 for (int32_t i = 0; i < m_codewords->GetSize(); i++) { | 35 for (int32_t i = 0; i < m_codewords->GetSize(); i++) { |
| 36 delete (CBC_Codeword*)m_codewords->GetAt(i); | 36 delete (CBC_Codeword*)m_codewords->GetAt(i); |
| 37 } | 37 } |
| 38 m_codewords->RemoveAll(); | 38 m_codewords->RemoveAll(); |
| 39 delete m_codewords; | 39 delete m_codewords; |
| 40 } | 40 } |
| 41 CBC_Codeword* CBC_DetectionResultColumn::getCodewordNearby(int32_t imageRow) { | 41 CBC_Codeword* CBC_DetectionResultColumn::getCodewordNearby(int32_t imageRow) { |
| 42 CBC_Codeword* codeword = getCodeword(imageRow); | 42 CBC_Codeword* codeword = getCodeword(imageRow); |
| 43 if (codeword != NULL) { | 43 if (codeword) { |
| 44 return codeword; | 44 return codeword; |
| 45 } | 45 } |
| 46 for (int32_t i = 1; i < MAX_NEARBY_DISTANCE; i++) { | 46 for (int32_t i = 1; i < MAX_NEARBY_DISTANCE; i++) { |
| 47 int32_t nearImageRow = imageRowToCodewordIndex(imageRow) - i; | 47 int32_t nearImageRow = imageRowToCodewordIndex(imageRow) - i; |
| 48 if (nearImageRow >= 0) { | 48 if (nearImageRow >= 0) { |
| 49 codeword = (CBC_Codeword*)m_codewords->GetAt(nearImageRow); | 49 codeword = (CBC_Codeword*)m_codewords->GetAt(nearImageRow); |
| 50 if (codeword != NULL) { | 50 if (codeword) { |
| 51 return codeword; | 51 return codeword; |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 nearImageRow = imageRowToCodewordIndex(imageRow) + i; | 54 nearImageRow = imageRowToCodewordIndex(imageRow) + i; |
| 55 if (nearImageRow < m_codewords->GetSize()) { | 55 if (nearImageRow < m_codewords->GetSize()) { |
| 56 codeword = (CBC_Codeword*)m_codewords->GetAt(nearImageRow); | 56 codeword = (CBC_Codeword*)m_codewords->GetAt(nearImageRow); |
| 57 if (codeword != NULL) { | 57 if (codeword) { |
| 58 return codeword; | 58 return codeword; |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 return NULL; | 62 return NULL; |
| 63 } | 63 } |
| 64 int32_t CBC_DetectionResultColumn::imageRowToCodewordIndex(int32_t imageRow) { | 64 int32_t CBC_DetectionResultColumn::imageRowToCodewordIndex(int32_t imageRow) { |
| 65 return imageRow - m_boundingBox->getMinY(); | 65 return imageRow - m_boundingBox->getMinY(); |
| 66 } | 66 } |
| 67 int32_t CBC_DetectionResultColumn::codewordIndexToImageRow( | 67 int32_t CBC_DetectionResultColumn::codewordIndexToImageRow( |
| (...skipping 23 matching lines...) Expand all Loading... |
| 91 row++; | 91 row++; |
| 92 continue; | 92 continue; |
| 93 } | 93 } |
| 94 result += (FX_CHAR)row; | 94 result += (FX_CHAR)row; |
| 95 result += codeword->getRowNumber(); | 95 result += codeword->getRowNumber(); |
| 96 result += codeword->getValue(); | 96 result += codeword->getValue(); |
| 97 row++; | 97 row++; |
| 98 } | 98 } |
| 99 return result; | 99 return result; |
| 100 } | 100 } |
| OLD | NEW |