summaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2/JBig2_GrdProc.cpp
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-11-07 19:16:35 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-07 19:16:35 +0000
commit826f2223fb0414144d7a627d5d0264da1a5ce82e (patch)
tree14c41a5d1c9ad0262a189f03c80745bb5e0356af /core/fxcodec/jbig2/JBig2_GrdProc.cpp
parentc9653fb272dd2d006a2725c42b5a36ffafb099a7 (diff)
downloadpdfium-826f2223fb0414144d7a627d5d0264da1a5ce82e.tar.xz
Use MaybeOwned in CJBig2_Image
Change-Id: Id53cbb8c95f6eb929f6e4eb57333daa24f1b776f Reviewed-on: https://pdfium-review.googlesource.com/18010 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_GrdProc.cpp')
-rw-r--r--core/fxcodec/jbig2/JBig2_GrdProc.cpp42
1 files changed, 19 insertions, 23 deletions
diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrdProc.cpp
index 7612114117..e308ae35ee 100644
--- a/core/fxcodec/jbig2/JBig2_GrdProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_GrdProc.cpp
@@ -74,11 +74,11 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template0_opt3(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext) {
auto GBREG = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
- if (!GBREG->m_pData)
+ if (!GBREG->data())
return nullptr;
int LTP = 0;
- uint8_t* pLine = GBREG->m_pData;
+ uint8_t* pLine = GBREG->data();
int32_t nStride = GBREG->stride();
int32_t nStride2 = nStride << 1;
int32_t nLineBytes = ((GBW + 7) >> 3) - 1;
@@ -223,11 +223,11 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template1_opt3(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext) {
auto GBREG = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
- if (!GBREG->m_pData)
+ if (!GBREG->data())
return nullptr;
int LTP = 0;
- uint8_t* pLine = GBREG->m_pData;
+ uint8_t* pLine = GBREG->data();
int32_t nStride = GBREG->stride();
int32_t nStride2 = nStride << 1;
int32_t nLineBytes = ((GBW + 7) >> 3) - 1;
@@ -369,11 +369,11 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template2_opt3(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext) {
auto GBREG = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
- if (!GBREG->m_pData)
+ if (!GBREG->data())
return nullptr;
int LTP = 0;
- uint8_t* pLine = GBREG->m_pData;
+ uint8_t* pLine = GBREG->data();
int32_t nStride = GBREG->stride();
int32_t nStride2 = nStride << 1;
int32_t nLineBytes = ((GBW + 7) >> 3) - 1;
@@ -513,11 +513,11 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template3_opt3(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext) {
auto GBREG = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
- if (!GBREG->m_pData)
+ if (!GBREG->data())
return nullptr;
int LTP = 0;
- uint8_t* pLine = GBREG->m_pData;
+ uint8_t* pLine = GBREG->data();
int32_t nStride = GBREG->stride();
int32_t nLineBytes = ((GBW + 7) >> 3) - 1;
int32_t nBitsLeft = GBW - (nLineBytes << 3);
@@ -650,7 +650,7 @@ FXCODEC_STATUS CJBig2_GRDProc::Start_decode_Arith(
m_ProssiveStatus = FXCODEC_STATUS_DECODE_READY;
if (!*pImage)
*pImage = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
- if (!(*pImage)->m_pData) {
+ if (!(*pImage)->data()) {
*pImage = nullptr;
m_ProssiveStatus = FXCODEC_STATUS_ERROR;
return FXCODEC_STATUS_ERROR;
@@ -717,17 +717,17 @@ FXCODEC_STATUS CJBig2_GRDProc::Start_decode_MMR(
CJBig2_BitStream* pStream) {
int bitpos, i;
auto image = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
- if (!image->m_pData) {
+ if (!image->data()) {
*pImage = nullptr;
m_ProssiveStatus = FXCODEC_STATUS_ERROR;
return m_ProssiveStatus;
}
bitpos = static_cast<int>(pStream->getBitPos());
- FaxG4Decode(pStream->getBuf(), pStream->getLength(), &bitpos, image->m_pData,
+ FaxG4Decode(pStream->getBuf(), pStream->getLength(), &bitpos, image->data(),
GBW, GBH, image->stride());
pStream->setBitPos(bitpos);
for (i = 0; (uint32_t)i < image->stride() * GBH; ++i)
- image->m_pData[i] = ~image->m_pData[i];
+ image->data()[i] = ~image->data()[i];
m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
*pImage = std::move(image);
return m_ProssiveStatus;
@@ -751,9 +751,8 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext,
IFX_PauseIndicator* pPause) {
- if (!m_pLine) {
- m_pLine = pImage->m_pData;
- }
+ if (!m_pLine)
+ m_pLine = pImage->data();
int32_t nStride = pImage->stride();
int32_t nStride2 = nStride << 1;
int32_t nLineBytes = ((GBW + 7) >> 3) - 1;
@@ -913,9 +912,8 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext,
IFX_PauseIndicator* pPause) {
- if (!m_pLine) {
- m_pLine = pImage->m_pData;
- }
+ if (!m_pLine)
+ m_pLine = pImage->data();
int32_t nStride = pImage->stride();
int32_t nStride2 = nStride << 1;
int32_t nLineBytes = ((GBW + 7) >> 3) - 1;
@@ -1069,9 +1067,8 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext,
IFX_PauseIndicator* pPause) {
- if (!m_pLine) {
- m_pLine = pImage->m_pData;
- }
+ if (!m_pLine)
+ m_pLine = pImage->data();
int32_t nStride = pImage->stride();
int32_t nStride2 = nStride << 1;
int32_t nLineBytes = ((GBW + 7) >> 3) - 1;
@@ -1226,8 +1223,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3(
JBig2ArithCtx* gbContext,
IFX_PauseIndicator* pPause) {
if (!m_pLine)
- m_pLine = pImage->m_pData;
-
+ m_pLine = pImage->data();
int32_t nStride = pImage->stride();
int32_t nLineBytes = ((GBW + 7) >> 3) - 1;
int32_t nBitsLeft = GBW - (nLineBytes << 3);