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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 } | 204 } |
205 int32_t bit; | 205 int32_t bit; |
206 if (bitIndex < dataBits->Size()) { | 206 if (bitIndex < dataBits->Size()) { |
207 bit = dataBits->At(bitIndex, e); | 207 bit = dataBits->At(bitIndex, e); |
208 BC_EXCEPTION_CHECK_ReturnVoid(e); | 208 BC_EXCEPTION_CHECK_ReturnVoid(e); |
209 bitIndex++; | 209 bitIndex++; |
210 } else { | 210 } else { |
211 bit = 0; | 211 bit = 0; |
212 } | 212 } |
213 if (maskPattern != -1) { | 213 if (maskPattern != -1) { |
214 FX_BOOL bol = | 214 bool bol = CBC_QRCoderMaskUtil::GetDataMaskBit(maskPattern, xx, y, e); |
215 CBC_QRCoderMaskUtil::GetDataMaskBit(maskPattern, xx, y, e); | |
216 BC_EXCEPTION_CHECK_ReturnVoid(e); | 215 BC_EXCEPTION_CHECK_ReturnVoid(e); |
217 if (bol) { | 216 if (bol) { |
218 bit ^= 0x01; | 217 bit ^= 0x01; |
219 } | 218 } |
220 } | 219 } |
221 matrix->Set(xx, y, bit); | 220 matrix->Set(xx, y, bit); |
222 } | 221 } |
223 y += direction; | 222 y += direction; |
224 } | 223 } |
225 direction = -direction; | 224 direction = -direction; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 bits->AppendBits(version, 6, e); | 277 bits->AppendBits(version, 6, e); |
279 BC_EXCEPTION_CHECK_ReturnVoid(e); | 278 BC_EXCEPTION_CHECK_ReturnVoid(e); |
280 int32_t bchCode = CalculateBCHCode(version, VERSION_INFO_POLY); | 279 int32_t bchCode = CalculateBCHCode(version, VERSION_INFO_POLY); |
281 bits->AppendBits(bchCode, 12, e); | 280 bits->AppendBits(bchCode, 12, e); |
282 BC_EXCEPTION_CHECK_ReturnVoid(e); | 281 BC_EXCEPTION_CHECK_ReturnVoid(e); |
283 if (bits->Size() != 18) { | 282 if (bits->Size() != 18) { |
284 e = BCExceptionBitSizeNot18; | 283 e = BCExceptionBitSizeNot18; |
285 BC_EXCEPTION_CHECK_ReturnVoid(e); | 284 BC_EXCEPTION_CHECK_ReturnVoid(e); |
286 } | 285 } |
287 } | 286 } |
288 FX_BOOL CBC_QRCoderMatrixUtil::IsEmpty(int32_t value) { | 287 bool CBC_QRCoderMatrixUtil::IsEmpty(int32_t value) { |
289 return (uint8_t)value == 0xff; | 288 return (uint8_t)value == 0xff; |
290 } | 289 } |
291 FX_BOOL CBC_QRCoderMatrixUtil::IsValidValue(int32_t value) { | 290 bool CBC_QRCoderMatrixUtil::IsValidValue(int32_t value) { |
292 return ((uint8_t)value == 0xff || (uint8_t)value == 0x00 || | 291 return ((uint8_t)value == 0xff || (uint8_t)value == 0x00 || |
293 (uint8_t)value == 0x01); | 292 (uint8_t)value == 0x01); |
294 } | 293 } |
295 void CBC_QRCoderMatrixUtil::EmbedTimingPatterns(CBC_CommonByteMatrix* matrix, | 294 void CBC_QRCoderMatrixUtil::EmbedTimingPatterns(CBC_CommonByteMatrix* matrix, |
296 int32_t& e) { | 295 int32_t& e) { |
297 if (!matrix) { | 296 if (!matrix) { |
298 e = BCExceptionNullPointer; | 297 e = BCExceptionNullPointer; |
299 BC_EXCEPTION_CHECK_ReturnVoid(e); | 298 BC_EXCEPTION_CHECK_ReturnVoid(e); |
300 } | 299 } |
301 for (int32_t i = 8; i < matrix->GetWidth() - 8; i++) { | 300 for (int32_t i = 8; i < matrix->GetWidth() - 8; i++) { |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 int32_t CBC_QRCoderMatrixUtil::FindMSBSet(int32_t value) { | 464 int32_t CBC_QRCoderMatrixUtil::FindMSBSet(int32_t value) { |
466 int32_t numDigits = 0; | 465 int32_t numDigits = 0; |
467 while (value != 0) { | 466 while (value != 0) { |
468 value >>= 1; | 467 value >>= 1; |
469 ++numDigits; | 468 ++numDigits; |
470 } | 469 } |
471 return numDigits; | 470 return numDigits; |
472 } | 471 } |
473 CBC_QRCoderMatrixUtil::CBC_QRCoderMatrixUtil() {} | 472 CBC_QRCoderMatrixUtil::CBC_QRCoderMatrixUtil() {} |
474 CBC_QRCoderMatrixUtil::~CBC_QRCoderMatrixUtil() {} | 473 CBC_QRCoderMatrixUtil::~CBC_QRCoderMatrixUtil() {} |
OLD | NEW |