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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 int32_t CBC_QRCoder::At(int32_t x, int32_t y, int32_t& e) { | 84 int32_t CBC_QRCoder::At(int32_t x, int32_t y, int32_t& e) { |
85 int32_t value = m_matrix->Get(x, y); | 85 int32_t value = m_matrix->Get(x, y); |
86 if (!(value == 0 || value == 1)) { | 86 if (!(value == 0 || value == 1)) { |
87 e = BCExceptionValueMustBeEither0or1; | 87 e = BCExceptionValueMustBeEither0or1; |
88 BC_EXCEPTION_CHECK_ReturnValue(e, 0); | 88 BC_EXCEPTION_CHECK_ReturnValue(e, 0); |
89 } | 89 } |
90 return value; | 90 return value; |
91 } | 91 } |
92 | 92 |
93 FX_BOOL CBC_QRCoder::IsValid() { | 93 bool CBC_QRCoder::IsValid() { |
94 return m_mode && m_ecLevel && m_version != -1 && m_matrixWidth != -1 && | 94 return m_mode && m_ecLevel && m_version != -1 && m_matrixWidth != -1 && |
95 m_maskPattern != -1 && m_numTotalBytes != -1 && m_numDataBytes != -1 && | 95 m_maskPattern != -1 && m_numTotalBytes != -1 && m_numDataBytes != -1 && |
96 m_numECBytes != -1 && m_numRSBlocks != -1 && | 96 m_numECBytes != -1 && m_numRSBlocks != -1 && |
97 IsValidMaskPattern(m_maskPattern) && | 97 IsValidMaskPattern(m_maskPattern) && |
98 m_numTotalBytes == m_numDataBytes + m_numECBytes && m_matrix && | 98 m_numTotalBytes == m_numDataBytes + m_numECBytes && m_matrix && |
99 m_matrixWidth == m_matrix->GetWidth() && | 99 m_matrixWidth == m_matrix->GetWidth() && |
100 m_matrix->GetWidth() == m_matrix->GetHeight(); | 100 m_matrix->GetWidth() == m_matrix->GetHeight(); |
101 } | 101 } |
102 | 102 |
103 void CBC_QRCoder::SetMode(CBC_QRCoderMode* value) { | 103 void CBC_QRCoder::SetMode(CBC_QRCoderMode* value) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 m_numECBytes = value; | 136 m_numECBytes = value; |
137 } | 137 } |
138 | 138 |
139 bool CBC_QRCoder::IsValidMaskPattern(int32_t maskPattern) { | 139 bool CBC_QRCoder::IsValidMaskPattern(int32_t maskPattern) { |
140 return maskPattern >= 0 && maskPattern < kNumMaskPatterns; | 140 return maskPattern >= 0 && maskPattern < kNumMaskPatterns; |
141 } | 141 } |
142 | 142 |
143 void CBC_QRCoder::SetMatrix(std::unique_ptr<CBC_CommonByteMatrix> pMatrix) { | 143 void CBC_QRCoder::SetMatrix(std::unique_ptr<CBC_CommonByteMatrix> pMatrix) { |
144 m_matrix = std::move(pMatrix); | 144 m_matrix = std::move(pMatrix); |
145 } | 145 } |
OLD | NEW |