| 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 21 matching lines...) Expand all Loading... |
| 32 #include "xfa/src/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.h" | 32 #include "xfa/src/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.h" |
| 33 | 33 |
| 34 CBC_QRCoderDecoder::CBC_QRCoderDecoder() { | 34 CBC_QRCoderDecoder::CBC_QRCoderDecoder() { |
| 35 m_rsDecoder = NULL; | 35 m_rsDecoder = NULL; |
| 36 } | 36 } |
| 37 | 37 |
| 38 void CBC_QRCoderDecoder::Init() { | 38 void CBC_QRCoderDecoder::Init() { |
| 39 m_rsDecoder = new CBC_ReedSolomonDecoder(CBC_ReedSolomonGF256::QRCodeFild); | 39 m_rsDecoder = new CBC_ReedSolomonDecoder(CBC_ReedSolomonGF256::QRCodeFild); |
| 40 } | 40 } |
| 41 CBC_QRCoderDecoder::~CBC_QRCoderDecoder() { | 41 CBC_QRCoderDecoder::~CBC_QRCoderDecoder() { |
| 42 if (m_rsDecoder != NULL) { | 42 delete m_rsDecoder; |
| 43 delete m_rsDecoder; | |
| 44 } | |
| 45 m_rsDecoder = NULL; | |
| 46 } | 43 } |
| 47 CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(FX_BOOL* image, | 44 CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(FX_BOOL* image, |
| 48 int32_t width, | 45 int32_t width, |
| 49 int32_t height, | 46 int32_t height, |
| 50 int32_t& e) { | 47 int32_t& e) { |
| 51 CBC_CommonBitMatrix bits; | 48 CBC_CommonBitMatrix bits; |
| 52 bits.Init(width); | 49 bits.Init(width); |
| 53 for (int32_t i = 0; i < width; i++) { | 50 for (int32_t i = 0; i < width; i++) { |
| 54 for (int32_t j = 0; j < height; j++) { | 51 for (int32_t j = 0; j < height; j++) { |
| 55 if (image[i * width + j]) { | 52 if (image[i * width + j]) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 for (int32_t i = 0; i < numCodewords; i++) { | 118 for (int32_t i = 0; i < numCodewords; i++) { |
| 122 codewordsInts[i] = (int32_t)((*codewordBytes)[i] & 0xff); | 119 codewordsInts[i] = (int32_t)((*codewordBytes)[i] & 0xff); |
| 123 } | 120 } |
| 124 int32_t numECCodewords = codewordBytes->GetSize() - numDataCodewords; | 121 int32_t numECCodewords = codewordBytes->GetSize() - numDataCodewords; |
| 125 m_rsDecoder->Decode(&codewordsInts, numECCodewords, e); | 122 m_rsDecoder->Decode(&codewordsInts, numECCodewords, e); |
| 126 BC_EXCEPTION_CHECK_ReturnVoid(e); | 123 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 127 for (int32_t k = 0; k < numDataCodewords; k++) { | 124 for (int32_t k = 0; k < numDataCodewords; k++) { |
| 128 (*codewordBytes)[k] = (uint8_t)codewordsInts[k]; | 125 (*codewordBytes)[k] = (uint8_t)codewordsInts[k]; |
| 129 } | 126 } |
| 130 } | 127 } |
| OLD | NEW |