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 42 matching lines...) Loading... |
53 } | 53 } |
54 } | 54 } |
55 nearImageRow = imageRowToCodewordIndex(imageRow) + i; | 55 nearImageRow = imageRowToCodewordIndex(imageRow) + i; |
56 if (nearImageRow < m_codewords->GetSize()) { | 56 if (nearImageRow < m_codewords->GetSize()) { |
57 codeword = (CBC_Codeword*)m_codewords->GetAt(nearImageRow); | 57 codeword = (CBC_Codeword*)m_codewords->GetAt(nearImageRow); |
58 if (codeword) { | 58 if (codeword) { |
59 return codeword; | 59 return codeword; |
60 } | 60 } |
61 } | 61 } |
62 } | 62 } |
63 return NULL; | 63 return nullptr; |
64 } | 64 } |
65 int32_t CBC_DetectionResultColumn::imageRowToCodewordIndex(int32_t imageRow) { | 65 int32_t CBC_DetectionResultColumn::imageRowToCodewordIndex(int32_t imageRow) { |
66 return imageRow - m_boundingBox->getMinY(); | 66 return imageRow - m_boundingBox->getMinY(); |
67 } | 67 } |
68 int32_t CBC_DetectionResultColumn::codewordIndexToImageRow( | 68 int32_t CBC_DetectionResultColumn::codewordIndexToImageRow( |
69 int32_t codewordIndex) { | 69 int32_t codewordIndex) { |
70 return m_boundingBox->getMinY() + codewordIndex; | 70 return m_boundingBox->getMinY() + codewordIndex; |
71 } | 71 } |
72 void CBC_DetectionResultColumn::setCodeword(int32_t imageRow, | 72 void CBC_DetectionResultColumn::setCodeword(int32_t imageRow, |
73 CBC_Codeword* codeword) { | 73 CBC_Codeword* codeword) { |
74 m_codewords->SetAt(imageRowToCodewordIndex(imageRow), codeword); | 74 m_codewords->SetAt(imageRowToCodewordIndex(imageRow), codeword); |
75 } | 75 } |
76 CBC_Codeword* CBC_DetectionResultColumn::getCodeword(int32_t imageRow) { | 76 CBC_Codeword* CBC_DetectionResultColumn::getCodeword(int32_t imageRow) { |
77 return (CBC_Codeword*)m_codewords->GetAt(imageRowToCodewordIndex(imageRow)); | 77 return (CBC_Codeword*)m_codewords->GetAt(imageRowToCodewordIndex(imageRow)); |
78 } | 78 } |
79 CBC_BoundingBox* CBC_DetectionResultColumn::getBoundingBox() { | 79 CBC_BoundingBox* CBC_DetectionResultColumn::getBoundingBox() { |
80 return m_boundingBox; | 80 return m_boundingBox; |
81 } | 81 } |
82 CFX_ArrayTemplate<CBC_Codeword*>* CBC_DetectionResultColumn::getCodewords() | 82 CFX_ArrayTemplate<CBC_Codeword*>* CBC_DetectionResultColumn::getCodewords() |
83 const { | 83 const { |
84 return m_codewords; | 84 return m_codewords; |
85 } | 85 } |
86 CFX_ByteString CBC_DetectionResultColumn::toString() { | 86 CFX_ByteString CBC_DetectionResultColumn::toString() { |
87 CFX_ByteString result; | 87 CFX_ByteString result; |
88 int32_t row = 0; | 88 int32_t row = 0; |
89 for (int32_t i = 0; i < m_codewords->GetSize(); i++) { | 89 for (int32_t i = 0; i < m_codewords->GetSize(); i++) { |
90 CBC_Codeword* codeword = (CBC_Codeword*)m_codewords->GetAt(i); | 90 CBC_Codeword* codeword = (CBC_Codeword*)m_codewords->GetAt(i); |
91 if (codeword == NULL) { | 91 if (!codeword) { |
92 result += (FX_CHAR)row; | 92 result += (FX_CHAR)row; |
93 row++; | 93 row++; |
94 continue; | 94 continue; |
95 } | 95 } |
96 result += (FX_CHAR)row; | 96 result += (FX_CHAR)row; |
97 result += codeword->getRowNumber(); | 97 result += codeword->getRowNumber(); |
98 result += codeword->getValue(); | 98 result += codeword->getValue(); |
99 row++; | 99 row++; |
100 } | 100 } |
101 return result; | 101 return result; |
102 } | 102 } |
OLD | NEW |