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 2007 ZXing authors | 8 * Copyright 2007 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 28 matching lines...) Expand all Loading... |
39 #include "xfa/src/fxbarcode/qrcode/BC_QRDataMask.h" | 39 #include "xfa/src/fxbarcode/qrcode/BC_QRDataMask.h" |
40 #include "xfa/src/fxbarcode/qrcode/BC_QRDetector.h" | 40 #include "xfa/src/fxbarcode/qrcode/BC_QRDetector.h" |
41 #include "xfa/src/fxbarcode/qrcode/BC_QRDetectorResult.h" | 41 #include "xfa/src/fxbarcode/qrcode/BC_QRDetectorResult.h" |
42 | 42 |
43 CBC_QRCodeReader::CBC_QRCodeReader() : m_decoder(NULL) {} | 43 CBC_QRCodeReader::CBC_QRCodeReader() : m_decoder(NULL) {} |
44 void CBC_QRCodeReader::Init() { | 44 void CBC_QRCodeReader::Init() { |
45 m_decoder = new CBC_QRCoderDecoder; | 45 m_decoder = new CBC_QRCoderDecoder; |
46 m_decoder->Init(); | 46 m_decoder->Init(); |
47 } | 47 } |
48 CBC_QRCodeReader::~CBC_QRCodeReader() { | 48 CBC_QRCodeReader::~CBC_QRCodeReader() { |
49 if (m_decoder != NULL) { | 49 delete m_decoder; |
50 delete m_decoder; | |
51 } | |
52 m_decoder = NULL; | |
53 } | 50 } |
54 CFX_ByteString CBC_QRCodeReader::Decode(CBC_BinaryBitmap* image, | 51 CFX_ByteString CBC_QRCodeReader::Decode(CBC_BinaryBitmap* image, |
55 int32_t hints, | 52 int32_t hints, |
56 int32_t& e) { | 53 int32_t& e) { |
57 CBC_CommonBitMatrix* matrix = image->GetMatrix(e); | 54 CBC_CommonBitMatrix* matrix = image->GetMatrix(e); |
58 BC_EXCEPTION_CHECK_ReturnValue(e, ""); | 55 BC_EXCEPTION_CHECK_ReturnValue(e, ""); |
59 CBC_QRDetector detector(matrix); | 56 CBC_QRDetector detector(matrix); |
60 CBC_QRDetectorResult* qdr = detector.Detect(hints, e); | 57 CBC_QRDetectorResult* qdr = detector.Detect(hints, e); |
61 BC_EXCEPTION_CHECK_ReturnValue(e, ""); | 58 BC_EXCEPTION_CHECK_ReturnValue(e, ""); |
62 CBC_AutoPtr<CBC_QRDetectorResult> detectorResult(qdr); | 59 CBC_AutoPtr<CBC_QRDetectorResult> detectorResult(qdr); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 99 } |
103 if (CBC_ReedSolomonGF256::DataMatrixField) { | 100 if (CBC_ReedSolomonGF256::DataMatrixField) { |
104 delete CBC_ReedSolomonGF256::DataMatrixField; | 101 delete CBC_ReedSolomonGF256::DataMatrixField; |
105 CBC_ReedSolomonGF256::DataMatrixField = NULL; | 102 CBC_ReedSolomonGF256::DataMatrixField = NULL; |
106 } | 103 } |
107 CBC_QRCoderMode::Destroy(); | 104 CBC_QRCoderMode::Destroy(); |
108 CBC_QRCoderErrorCorrectionLevel::Destroy(); | 105 CBC_QRCoderErrorCorrectionLevel::Destroy(); |
109 CBC_QRDataMask::Destroy(); | 106 CBC_QRDataMask::Destroy(); |
110 CBC_QRCoderVersion::Destroy(); | 107 CBC_QRCoderVersion::Destroy(); |
111 } | 108 } |
OLD | NEW |