summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/BC_TwoDimWriter.cpp
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-08-09 13:45:03 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-09 13:45:03 -0700
commite76203dbefd1df075a063ee019c3908513f6bee5 (patch)
tree2a763852e1d1de3eee6a67285ea96be2874bfb00 /xfa/fxbarcode/BC_TwoDimWriter.cpp
parentad5ac7584844b03c5ceed082e5f5158a632405cc (diff)
downloadpdfium-e76203dbefd1df075a063ee019c3908513f6bee5.tar.xz
Use smart pointers for class owned pointers in xfa/fxbarcode
For classes under xfa/fxbarcode, use smart pointers instead of raw pointer to make memory management easier. Also fix some styling issues along the changes. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2221023003
Diffstat (limited to 'xfa/fxbarcode/BC_TwoDimWriter.cpp')
-rw-r--r--xfa/fxbarcode/BC_TwoDimWriter.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/xfa/fxbarcode/BC_TwoDimWriter.cpp b/xfa/fxbarcode/BC_TwoDimWriter.cpp
index 91ea57097a..e4cc6e890a 100644
--- a/xfa/fxbarcode/BC_TwoDimWriter.cpp
+++ b/xfa/fxbarcode/BC_TwoDimWriter.cpp
@@ -13,14 +13,10 @@
#include "xfa/fxbarcode/BC_Writer.h"
#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
-CBC_TwoDimWriter::CBC_TwoDimWriter() {
- m_iCorrectLevel = 1;
- m_bFixedSize = TRUE;
- m_output = nullptr;
-}
-CBC_TwoDimWriter::~CBC_TwoDimWriter() {
- delete m_output;
-}
+CBC_TwoDimWriter::CBC_TwoDimWriter() : m_iCorrectLevel(1), m_bFixedSize(TRUE) {}
+
+CBC_TwoDimWriter::~CBC_TwoDimWriter() {}
+
void CBC_TwoDimWriter::RenderDeviceResult(CFX_RenderDevice* device,
const CFX_Matrix* matrix) {
CFX_GraphStateData stateData;
@@ -55,7 +51,7 @@ void CBC_TwoDimWriter::RenderDeviceResult(CFX_RenderDevice* device,
}
}
-int32_t CBC_TwoDimWriter::GetErrorCorrectionLevel() {
+int32_t CBC_TwoDimWriter::GetErrorCorrectionLevel() const {
return m_iCorrectLevel;
}
@@ -136,7 +132,7 @@ void CBC_TwoDimWriter::RenderResult(uint8_t* code,
if (topPadding < 0) {
topPadding = 0;
}
- m_output = new CBC_CommonBitMatrix;
+ m_output.reset(new CBC_CommonBitMatrix);
m_output->Init(outputWidth, outputHeight);
for (int32_t inputY = 0, outputY = topPadding;
(inputY < inputHeight) && (outputY < outputHeight - multiY);