summaryrefslogtreecommitdiff
path: root/xfa/src/fxbarcode/common/BC_GlobalHistogramBinarizer.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2016-02-24 18:20:51 -0800
committerLei Zhang <thestig@chromium.org>2016-02-24 18:20:51 -0800
commit2e6864282e65c55ff6809f5aaae011b31c3a361a (patch)
tree98daecaf078529986a4efc2c43a3f43c0dcc01dd /xfa/src/fxbarcode/common/BC_GlobalHistogramBinarizer.cpp
parent969ea09df096b987662b9658e3ffa023ca4ebf70 (diff)
downloadpdfium-2e6864282e65c55ff6809f5aaae011b31c3a361a.tar.xz
Get rid of CBC_AutoPtr and use std::unique_ptr instead.
Also fix IWYU in various fxbarcode headers. R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1734823002 .
Diffstat (limited to 'xfa/src/fxbarcode/common/BC_GlobalHistogramBinarizer.cpp')
-rw-r--r--xfa/src/fxbarcode/common/BC_GlobalHistogramBinarizer.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/xfa/src/fxbarcode/common/BC_GlobalHistogramBinarizer.cpp b/xfa/src/fxbarcode/common/BC_GlobalHistogramBinarizer.cpp
index 6c3920483c..8babc9c78f 100644
--- a/xfa/src/fxbarcode/common/BC_GlobalHistogramBinarizer.cpp
+++ b/xfa/src/fxbarcode/common/BC_GlobalHistogramBinarizer.cpp
@@ -20,11 +20,14 @@
* limitations under the License.
*/
+#include "xfa/src/fxbarcode/common/BC_GlobalHistogramBinarizer.h"
+
+#include <memory>
+
#include "xfa/src/fxbarcode/BC_Binarizer.h"
#include "xfa/src/fxbarcode/BC_LuminanceSource.h"
#include "xfa/src/fxbarcode/common/BC_CommonBitArray.h"
#include "xfa/src/fxbarcode/common/BC_CommonBitMatrix.h"
-#include "xfa/src/fxbarcode/common/BC_GlobalHistogramBinarizer.h"
#include "xfa/src/fxbarcode/utils.h"
const int32_t LUMINANCE_BITS = 5;
@@ -41,7 +44,7 @@ CBC_CommonBitArray* CBC_GlobalHistogramBinarizer::GetBlackRow(
int32_t& e) {
CBC_LuminanceSource* source = GetLuminanceSource();
int32_t width = source->GetWidth();
- CBC_AutoPtr<CBC_CommonBitArray> result(new CBC_CommonBitArray(width));
+ std::unique_ptr<CBC_CommonBitArray> result(new CBC_CommonBitArray(width));
InitArrays(width);
CFX_ByteArray* localLuminances = source->GetRow(y, m_luminance, e);
if (e != BCExceptionNO) {
@@ -75,9 +78,8 @@ CBC_CommonBitMatrix* CBC_GlobalHistogramBinarizer::GetBlackMatrix(int32_t& e) {
CBC_LuminanceSource* source = GetLuminanceSource();
int32_t width = source->GetWidth();
int32_t height = source->GetHeight();
- CBC_CommonBitMatrix* BitMatrixTemp = new CBC_CommonBitMatrix();
- BitMatrixTemp->Init(width, height);
- CBC_AutoPtr<CBC_CommonBitMatrix> matrix(BitMatrixTemp);
+ std::unique_ptr<CBC_CommonBitMatrix> matrix(new CBC_CommonBitMatrix());
+ matrix->Init(width, height);
InitArrays(width);
CFX_Int32Array localBuckets;
localBuckets.Copy(m_buckets);
@@ -95,7 +97,7 @@ CBC_CommonBitMatrix* CBC_GlobalHistogramBinarizer::GetBlackMatrix(int32_t& e) {
}
int32_t blackPoint = EstimateBlackPoint(localBuckets, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- CBC_AutoPtr<CFX_ByteArray> localLuminances(source->GetMatrix());
+ std::unique_ptr<CFX_ByteArray> localLuminances(source->GetMatrix());
for (y = 0; y < height; y++) {
int32_t offset = y * width;
for (int32_t x = 0; x < width; x++) {