summaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-07-13 10:06:15 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-13 14:29:34 +0000
commit17453d03c3bdd18a893ae86058a6184939aee026 (patch)
tree2a87278c98e851744f20cd9aaa1460f849ef097e /core/fxcodec/jbig2/JBig2_GrrdProc.cpp
parent360d1fce569b57aa2c487f6e171ba19b9dc8885e (diff)
downloadpdfium-17453d03c3bdd18a893ae86058a6184939aee026.tar.xz
More unique_ptrs in JBig2 code
This CL makes CJBig2_Segment own the results: symbol, pattern, huffman, and huffman. This causes a lot more unique_ptr usage in JBig2 code. Change-Id: I1f0a5bfaaf85053658b467bef5325c72d1f496c7 Reviewed-on: https://pdfium-review.googlesource.com/7690 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_GrrdProc.cpp')
-rw-r--r--core/fxcodec/jbig2/JBig2_GrrdProc.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
index 936b851d37..11fa39945d 100644
--- a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
@@ -13,10 +13,11 @@
#include "core/fxcodec/jbig2/JBig2_Image.h"
#include "third_party/base/ptr_util.h"
-CJBig2_Image* CJBig2_GRRDProc::decode(CJBig2_ArithDecoder* pArithDecoder,
- JBig2ArithCtx* grContext) {
+std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode(
+ CJBig2_ArithDecoder* pArithDecoder,
+ JBig2ArithCtx* grContext) {
if (GRW == 0 || GRH == 0)
- return new CJBig2_Image(GRW, GRH);
+ return pdfium::MakeUnique<CJBig2_Image>(GRW, GRH);
if (!GRTEMPLATE) {
if ((GRAT[0] == -1) && (GRAT[1] == -1) && (GRAT[2] == -1) &&
@@ -29,10 +30,11 @@ CJBig2_Image* CJBig2_GRRDProc::decode(CJBig2_ArithDecoder* pArithDecoder,
if ((GRREFERENCEDX == 0) && (GRW == (uint32_t)GRREFERENCE->width()))
return decode_Template1_opt(pArithDecoder, grContext);
+
return decode_Template1_unopt(pArithDecoder, grContext);
}
-CJBig2_Image* CJBig2_GRRDProc::decode_Template0_unopt(
+std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template0_unopt(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* grContext) {
int LTP = 0;
@@ -145,10 +147,10 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_unopt(
}
}
}
- return GRREG.release();
+ return GRREG;
}
-CJBig2_Image* CJBig2_GRRDProc::decode_Template0_opt(
+std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template0_opt(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* grContext) {
if (!GRREFERENCE->m_pData)
@@ -273,14 +275,13 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_opt(
}
}
pLine += nStride;
- if (h < GRHR + GRREFERENCEDY) {
+ if (h < GRHR + GRREFERENCEDY)
pLineR += nStrideR;
- }
}
- return GRREG.release();
+ return GRREG;
}
-CJBig2_Image* CJBig2_GRRDProc::decode_Template1_unopt(
+std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template1_unopt(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* grContext) {
int LTP = 0;
@@ -379,10 +380,10 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_unopt(
}
}
}
- return GRREG.release();
+ return GRREG;
}
-CJBig2_Image* CJBig2_GRRDProc::decode_Template1_opt(
+std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template1_opt(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* grContext) {
if (!GRREFERENCE->m_pData)
@@ -496,9 +497,8 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_opt(
}
}
pLine += nStride;
- if (h < GRHR + GRREFERENCEDY) {
+ if (h < GRHR + GRREFERENCEDY)
pLineR += nStrideR;
- }
}
- return GRREG.release();
+ return GRREG;
}