diff options
Diffstat (limited to 'xfa/src/fxbarcode/qrcode')
-rw-r--r-- | xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp | 14 | ||||
-rw-r--r-- | xfa/src/fxbarcode/qrcode/BC_QRCodeReader.cpp | 16 | ||||
-rw-r--r-- | xfa/src/fxbarcode/qrcode/BC_QRCodeReader.h | 8 | ||||
-rw-r--r-- | xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.cpp | 8 | ||||
-rw-r--r-- | xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.h | 6 | ||||
-rw-r--r-- | xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp | 26 | ||||
-rw-r--r-- | xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.h | 5 | ||||
-rw-r--r-- | xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp | 10 | ||||
-rw-r--r-- | xfa/src/fxbarcode/qrcode/BC_QRDataBlock.h | 2 | ||||
-rw-r--r-- | xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp | 13 | ||||
-rw-r--r-- | xfa/src/fxbarcode/qrcode/BC_QRDetector.h | 4 | ||||
-rw-r--r-- | xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp | 8 | ||||
-rw-r--r-- | xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.h | 2 | ||||
-rw-r--r-- | xfa/src/fxbarcode/qrcode/BC_QRGridSampler.cpp | 12 | ||||
-rw-r--r-- | xfa/src/fxbarcode/qrcode/BC_QRGridSampler.h | 4 |
15 files changed, 82 insertions, 56 deletions
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp b/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp index d44995385a..7426d95d4c 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp @@ -20,8 +20,11 @@ * limitations under the License. */ -#include "xfa/src/fxbarcode/common/BC_CommonBitMatrix.h" #include "xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.h" + +#include <memory> + +#include "xfa/src/fxbarcode/common/BC_CommonBitMatrix.h" #include "xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.h" #include "xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.h" #include "xfa/src/fxbarcode/qrcode/BC_QRDataMask.h" @@ -140,13 +143,12 @@ CFX_ByteArray* CBC_QRBitMatrixParser::ReadCodewords(int32_t& e) { int32_t dimension = m_bitMatrix->GetDimension(e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); dataMask->UnmaskBitMatirx(m_bitMatrix, dimension); - CBC_CommonBitMatrix* cbm = version->BuildFunctionPattern(e); + std::unique_ptr<CBC_CommonBitMatrix> functionPattern( + version->BuildFunctionPattern(e)); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); - CBC_AutoPtr<CBC_CommonBitMatrix> functionPattern(cbm); FX_BOOL readingUp = TRUE; - CFX_ByteArray* temp = new CFX_ByteArray; - temp->SetSize(version->GetTotalCodeWords()); - CBC_AutoPtr<CFX_ByteArray> result(temp); + std::unique_ptr<CFX_ByteArray> result(new CFX_ByteArray); + result->SetSize(version->GetTotalCodeWords()); int32_t resultOffset = 0; int32_t currentByte = 0; int32_t bitsRead = 0; diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.cpp index c594230428..896a3a107b 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.cpp @@ -20,6 +20,10 @@ * limitations under the License. */ +#include "xfa/src/fxbarcode/qrcode/BC_QRCodeReader.h" + +#include <memory> + #include "xfa/src/fxbarcode/BC_Binarizer.h" #include "xfa/src/fxbarcode/BC_BinaryBitmap.h" #include "xfa/src/fxbarcode/BC_BufferedImageLuminanceSource.h" @@ -29,9 +33,6 @@ #include "xfa/src/fxbarcode/common/BC_CommonDecoderResult.h" #include "xfa/src/fxbarcode/common/BC_GlobalHistogramBinarizer.h" #include "xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h" -#include "xfa/src/fxbarcode/qrcode/BC_QRCodeReader.h" -#include "xfa/src/fxbarcode/qrcode/BC_QRCodeReader.h" -#include "xfa/src/fxbarcode/qrcode/BC_QRCodeReader.h" #include "xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.h" #include "xfa/src/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h" #include "xfa/src/fxbarcode/qrcode/BC_QRCoderMode.h" @@ -54,13 +55,12 @@ CFX_ByteString CBC_QRCodeReader::Decode(CBC_BinaryBitmap* image, CBC_CommonBitMatrix* matrix = image->GetMatrix(e); BC_EXCEPTION_CHECK_ReturnValue(e, ""); CBC_QRDetector detector(matrix); - CBC_QRDetectorResult* qdr = detector.Detect(hints, e); + std::unique_ptr<CBC_QRDetectorResult> detectorResult( + detector.Detect(hints, e)); BC_EXCEPTION_CHECK_ReturnValue(e, ""); - CBC_AutoPtr<CBC_QRDetectorResult> detectorResult(qdr); - CBC_CommonDecoderResult* qdr2 = - m_decoder->Decode(detectorResult->GetBits(), 0, e); + std::unique_ptr<CBC_CommonDecoderResult> decodeResult( + m_decoder->Decode(detectorResult->GetBits(), 0, e)); BC_EXCEPTION_CHECK_ReturnValue(e, ""); - CBC_AutoPtr<CBC_CommonDecoderResult> decodeResult(qdr2); return (decodeResult->GetText()); } CFX_ByteString CBC_QRCodeReader::Decode(const CFX_WideString& filename, diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.h b/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.h index 98bf976e06..bcb08fa21e 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.h @@ -7,6 +7,11 @@ #ifndef XFA_SRC_FXBARCODE_QRCODE_BC_QRCODEREADER_H_ #define XFA_SRC_FXBARCODE_QRCODE_BC_QRCODEREADER_H_ +#include <stdint.h> + +#include "core/include/fxcrt/fx_string.h" +#include "xfa/src/fxbarcode/BC_Reader.h" + class CBC_QRDetector; class CBC_BinaryBitmap; class CBC_QRCoderDecoder; @@ -18,7 +23,8 @@ class CBC_QRDetectorResult; class CBC_QRCoderErrorCorrectionLevel; class CBC_QRCoderMode; class CBC_QRDataMask; -class CBC_QRCodeReader; +class CFX_DIBitmap; + class CBC_QRCodeReader : public CBC_Reader { private: CBC_QRCoderDecoder* m_decoder; diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.cpp index ebaa40fd12..dd310217d4 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.cpp @@ -20,12 +20,15 @@ * limitations under the License. */ +#include "xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.h" + +#include <memory> + #include "xfa/src/fxbarcode/common/BC_CommonBitMatrix.h" #include "xfa/src/fxbarcode/common/BC_CommonDecoderResult.h" #include "xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.h" #include "xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h" #include "xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.h" -#include "xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.h" #include "xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.h" #include "xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.h" #include "xfa/src/fxbarcode/qrcode/BC_QRDataBlock.h" @@ -69,9 +72,8 @@ CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(CBC_CommonBitMatrix* bits, CBC_QRCoderFormatInformation* temp = parser.ReadFormatInformation(e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_QRCoderErrorCorrectionLevel* ecLevel = temp->GetErrorCorrectionLevel(); - CFX_ByteArray* ba = parser.ReadCodewords(e); + std::unique_ptr<CFX_ByteArray> codewords(parser.ReadCodewords(e)); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); - CBC_AutoPtr<CFX_ByteArray> codewords(ba); CFX_PtrArray* dataBlocks = CBC_QRDataBlock::GetDataBlocks(codewords.get(), version, ecLevel, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.h index 26952ee9e0..e2e53a796c 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.h @@ -7,12 +7,12 @@ #ifndef XFA_SRC_FXBARCODE_QRCODE_BC_QRCODERDECODER_H_ #define XFA_SRC_FXBARCODE_QRCODE_BC_QRCODERDECODER_H_ +#include "core/include/fxcrt/fx_basic.h" + class CBC_CommonBitMatrix; class CBC_ReedSolomonDecoder; class CBC_CommonDecoderResult; -class CBC_QRBitMatrixParser; -class CBC_QRCoderVersion; -class CBC_QRDataBlock; + class CBC_QRCoderDecoder { private: CBC_ReedSolomonDecoder* m_rsDecoder; diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp index a451ab50b8..eb31ddc301 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp @@ -20,7 +20,10 @@ * limitations under the License. */ +#include "xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.h" + #include <algorithm> +#include <memory> #include "xfa/src/fxbarcode/BC_UtilCodingConvert.h" #include "xfa/src/fxbarcode/common/BC_CommonByteArray.h" @@ -31,8 +34,6 @@ #include "xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.h" #include "xfa/src/fxbarcode/qrcode/BC_QRCoderBlockPair.h" #include "xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.h" -#include "xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.h" -#include "xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.h" #include "xfa/src/fxbarcode/qrcode/BC_QRCoderMaskUtil.h" #include "xfa/src/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h" #include "xfa/src/fxbarcode/qrcode/BC_QRCoderMode.h" @@ -408,10 +409,9 @@ void CBC_QRCoderEncoder::EncodeWithSpecifyVersion( qrCode->GetNumDataBytes(), qrCode->GetNumRSBlocks(), &finalBits, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - CBC_CommonByteMatrix* pDecoder = new CBC_CommonByteMatrix( - qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth()); - pDecoder->Init(); - CBC_AutoPtr<CBC_CommonByteMatrix> matrix(pDecoder); + std::unique_ptr<CBC_CommonByteMatrix> matrix(new CBC_CommonByteMatrix( + qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth())); + matrix->Init(); int32_t maskPattern = ChooseMaskPattern( &finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e); BC_EXCEPTION_CHECK_ReturnVoid(e); @@ -499,10 +499,9 @@ catchException: qrCode->GetNumDataBytes(), qrCode->GetNumRSBlocks(), &finalBits, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - CBC_CommonByteMatrix* pDecoder = new CBC_CommonByteMatrix( - qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth()); - pDecoder->Init(); - CBC_AutoPtr<CBC_CommonByteMatrix> matrix(pDecoder); + std::unique_ptr<CBC_CommonByteMatrix> matrix(new CBC_CommonByteMatrix( + qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth())); + matrix->Init(); int32_t maskPattern = ChooseMaskPattern( &finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e); BC_EXCEPTION_CHECK_ReturnVoid(e); @@ -550,10 +549,9 @@ void CBC_QRCoderEncoder::Encode(const CFX_WideString& content, qrCode->GetNumDataBytes(), qrCode->GetNumRSBlocks(), &finalBits, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - CBC_CommonByteMatrix* pDecoder = new CBC_CommonByteMatrix( - qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth()); - pDecoder->Init(); - CBC_AutoPtr<CBC_CommonByteMatrix> matrix(pDecoder); + std::unique_ptr<CBC_CommonByteMatrix> matrix(new CBC_CommonByteMatrix( + qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth())); + matrix->Init(); int32_t maskPattern = ChooseMaskPattern( &finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e); BC_EXCEPTION_CHECK_ReturnVoid(e); diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.h index 05fc2f8551..27e5b65494 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.h @@ -7,6 +7,9 @@ #ifndef XFA_SRC_FXBARCODE_QRCODE_BC_QRCODERENCODER_H_ #define XFA_SRC_FXBARCODE_QRCODE_BC_QRCODERENCODER_H_ +#include "core/include/fxcrt/fx_basic.h" +#include "core/include/fxcrt/fx_string.h" + class Make_Pair; class CBC_QRCoder; class CBC_QRCoderErrorCorrectionLevel; @@ -14,7 +17,7 @@ class CBC_QRCoderMode; class CBC_QRCoderBitVector; class CBC_CommonByteArray; class CBC_CommonByteMatrix; -class CBC_QRCoderEncoder; + class CBC_QRCoderEncoder { private: const static int32_t m_alphaNumbericTable[96]; diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp b/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp index 75ad077521..185e16c5b7 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp @@ -20,10 +20,13 @@ * limitations under the License. */ +#include "xfa/src/fxbarcode/qrcode/BC_QRDataBlock.h" + +#include <memory> + #include "xfa/src/fxbarcode/qrcode/BC_QRCoderECB.h" #include "xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.h" #include "xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.h" -#include "xfa/src/fxbarcode/qrcode/BC_QRDataBlock.h" #include "xfa/src/fxbarcode/utils.h" CBC_QRDataBlock::CBC_QRDataBlock(int32_t numDataCodewords, @@ -54,9 +57,8 @@ CFX_PtrArray* CBC_QRDataBlock::GetDataBlocks( for (i = 0; i < ecBlockArray->GetSize(); i++) { totalBlocks += ((CBC_QRCoderECB*)(*ecBlockArray)[i])->GetCount(); } - CFX_PtrArray* datablock = new CFX_PtrArray(); - datablock->SetSize(totalBlocks); - CBC_AutoPtr<CFX_PtrArray> result(datablock); + std::unique_ptr<CFX_PtrArray> result(new CFX_PtrArray()); + result->SetSize(totalBlocks); int32_t numResultBlocks = 0; for (int32_t j = 0; j < ecBlockArray->GetSize(); j++) { CBC_QRCoderECB* ecBlock = (CBC_QRCoderECB*)(*ecBlockArray)[j]; diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.h b/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.h index 63ee10ef06..6146c41465 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.h @@ -7,6 +7,8 @@ #ifndef XFA_SRC_FXBARCODE_QRCODE_BC_QRDATABLOCK_H_ #define XFA_SRC_FXBARCODE_QRCODE_BC_QRDATABLOCK_H_ +#include "core/include/fxcrt/fx_basic.h" + class CBC_QRCoderVersion; class CBC_QRCoderECBlocks; class CBC_QRCoderECB; diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp b/xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp index 1fd8742690..72ce42fc4c 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp @@ -20,14 +20,16 @@ * limitations under the License. */ +#include "xfa/src/fxbarcode/qrcode/BC_QRDetector.h" + #include <algorithm> +#include <memory> #include "xfa/src/fxbarcode/BC_ResultPoint.h" #include "xfa/src/fxbarcode/common/BC_CommonBitMatrix.h" #include "xfa/src/fxbarcode/qrcode/BC_FinderPatternInfo.h" #include "xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.h" #include "xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.h" -#include "xfa/src/fxbarcode/qrcode/BC_QRDetector.h" #include "xfa/src/fxbarcode/qrcode/BC_QRDetectorResult.h" #include "xfa/src/fxbarcode/qrcode/BC_QRFinderPattern.h" #include "xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.h" @@ -37,9 +39,8 @@ CBC_QRDetector::CBC_QRDetector(CBC_CommonBitMatrix* image) : m_image(image) {} CBC_QRDetector::~CBC_QRDetector() {} CBC_QRDetectorResult* CBC_QRDetector::Detect(int32_t hints, int32_t& e) { CBC_QRFinderPatternFinder finder(m_image); - CBC_QRFinderPatternInfo* qpi = finder.Find(hints, e); + std::unique_ptr<CBC_QRFinderPatternInfo> info(finder.Find(hints, e)); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); - CBC_AutoPtr<CBC_QRFinderPatternInfo> info(qpi); CBC_QRDetectorResult* qdr = ProcessFinderPatternInfo(info.get(), e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return qdr; @@ -47,9 +48,9 @@ CBC_QRDetectorResult* CBC_QRDetector::Detect(int32_t hints, int32_t& e) { CBC_QRDetectorResult* CBC_QRDetector::ProcessFinderPatternInfo( CBC_QRFinderPatternInfo* info, int32_t& e) { - CBC_AutoPtr<CBC_QRFinderPattern> topLeft(info->GetTopLeft()); - CBC_AutoPtr<CBC_QRFinderPattern> topRight(info->GetTopRight()); - CBC_AutoPtr<CBC_QRFinderPattern> bottomLeft(info->GetBottomLeft()); + std::unique_ptr<CBC_QRFinderPattern> topLeft(info->GetTopLeft()); + std::unique_ptr<CBC_QRFinderPattern> topRight(info->GetTopRight()); + std::unique_ptr<CBC_QRFinderPattern> bottomLeft(info->GetBottomLeft()); FX_FLOAT moduleSize = CalculateModuleSize(topLeft.get(), topRight.get(), bottomLeft.get()); if (moduleSize < 1.0f) { diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDetector.h b/xfa/src/fxbarcode/qrcode/BC_QRDetector.h index 45d2f5345f..b76a656f07 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDetector.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRDetector.h @@ -7,6 +7,8 @@ #ifndef XFA_SRC_FXBARCODE_QRCODE_BC_QRDETECTOR_H_ #define XFA_SRC_FXBARCODE_QRCODE_BC_QRDETECTOR_H_ +#include "core/include/fxcrt/fx_basic.h" + class CBC_ResultPoint; class CBC_CommonBitMatrix; class CBC_QRDetectorResult; @@ -17,7 +19,7 @@ class CBC_QRCoderVersion; class CBC_QRGridSampler; class CBC_QRAlignmentPatternFinder; class CBC_QRAlignmentPattern; -class CBC_QRDetector; + class CBC_QRDetector { private: CBC_CommonBitMatrix* m_image; diff --git a/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp b/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp index d143e276bb..f5a3c7aead 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp @@ -20,12 +20,15 @@ * limitations under the License. */ +#include "xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.h" + +#include <memory> + #include "core/include/fxcrt/fx_basic.h" #include "xfa/src/fxbarcode/BC_ResultPoint.h" #include "xfa/src/fxbarcode/common/BC_CommonBitMatrix.h" #include "xfa/src/fxbarcode/qrcode/BC_FinderPatternInfo.h" #include "xfa/src/fxbarcode/qrcode/BC_QRFinderPattern.h" -#include "xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.h" #include "xfa/src/fxbarcode/utils.h" const int32_t CBC_QRFinderPatternFinder::CENTER_QUORUM = 2; @@ -158,9 +161,8 @@ CBC_QRFinderPatternInfo* CBC_QRFinderPatternFinder::Find(int32_t hint, } } } - CFX_PtrArray* ptr = SelectBestpatterns(e); + std::unique_ptr<CFX_PtrArray> patternInfo(SelectBestpatterns(e)); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); - CBC_AutoPtr<CFX_PtrArray> patternInfo(ptr); OrderBestPatterns(patternInfo.get()); return new CBC_QRFinderPatternInfo(patternInfo.get()); } diff --git a/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.h b/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.h index 7f9209d214..aa731b6cdb 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.h @@ -7,6 +7,8 @@ #ifndef XFA_SRC_FXBARCODE_QRCODE_BC_QRFINDERPATTERNFINDER_H_ #define XFA_SRC_FXBARCODE_QRCODE_BC_QRFINDERPATTERNFINDER_H_ +#include "core/include/fxcrt/fx_basic.h" + class CBC_CommonBitMatrix; class CBC_QRFinderPattern; class CBC_ResultPoint; diff --git a/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.cpp b/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.cpp index 7b9fe7b4f3..87f0fd072e 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.cpp @@ -20,9 +20,12 @@ * limitations under the License. */ +#include "xfa/src/fxbarcode/qrcode/BC_QRGridSampler.h" + +#include <memory> + #include "xfa/src/fxbarcode/common/BC_CommonBitMatrix.h" #include "xfa/src/fxbarcode/common/BC_CommonPerspectiveTransform.h" -#include "xfa/src/fxbarcode/qrcode/BC_QRGridSampler.h" #include "xfa/src/fxbarcode/utils.h" CBC_QRGridSampler CBC_QRGridSampler::m_gridSampler; @@ -107,13 +110,12 @@ CBC_CommonBitMatrix* CBC_QRGridSampler::SampleGrid(CBC_CommonBitMatrix* image, FX_FLOAT p4FromX, FX_FLOAT p4FromY, int32_t& e) { - CBC_AutoPtr<CBC_CommonPerspectiveTransform> transform( + std::unique_ptr<CBC_CommonPerspectiveTransform> transform( CBC_CommonPerspectiveTransform::QuadrilateralToQuadrilateral( p1ToX, p1ToY, p2ToX, p2ToY, p3ToX, p3ToY, p4ToX, p4ToY, p1FromX, p1FromY, p2FromX, p2FromY, p3FromX, p3FromY, p4FromX, p4FromY)); - CBC_CommonBitMatrix* tempBitM = new CBC_CommonBitMatrix(); - tempBitM->Init(dimensionX, dimensionY); - CBC_AutoPtr<CBC_CommonBitMatrix> bits(tempBitM); + std::unique_ptr<CBC_CommonBitMatrix> bits(new CBC_CommonBitMatrix()); + bits->Init(dimensionX, dimensionY); CFX_FloatArray points; points.SetSize(dimensionX << 1); for (int32_t y = 0; y < dimensionY; y++) { diff --git a/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.h b/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.h index a3f412435d..8d6b96a2b2 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.h @@ -7,10 +7,12 @@ #ifndef XFA_SRC_FXBARCODE_QRCODE_BC_QRGRIDSAMPLER_H_ #define XFA_SRC_FXBARCODE_QRCODE_BC_QRGRIDSAMPLER_H_ +#include "core/include/fxcrt/fx_basic.h" + class CBC_CommonBitMatrix; class CBC_CommonPerspectiveTransform; class CBC_CommonDefaultGridSampler; -class CBC_QRGridSampler; + class CBC_QRGridSampler { private: static CBC_QRGridSampler m_gridSampler; |