From 36f4841d67037ce640273ce357d2d33f3e8567c3 Mon Sep 17 00:00:00 2001 From: Nicolas Pena Date: Fri, 21 Sep 2018 21:09:32 +0000 Subject: Cleanup in CCodec_FaxModule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL moves FaxG4Decode to the class where it's implemented. It should remain there because it calls FaxG4GetRow, declared and used in the cpp file. Do some ++ cleanup while at it. This CL also makes CCodec_FaxModule own some methods that were namespaced since doing so allows removing a bunch of parameters. Change-Id: I24787f5668c7273b9bdb4009c3d0b29590c5552f Reviewed-on: https://pdfium-review.googlesource.com/42950 Commit-Queue: Nicolás Peña Moreno Reviewed-by: Tom Sepez --- core/fxcodec/jbig2/JBig2_GrdProc.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'core/fxcodec/jbig2') diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrdProc.cpp index d0fe440b2d..278b5c065d 100644 --- a/core/fxcodec/jbig2/JBig2_GrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_GrdProc.cpp @@ -10,6 +10,7 @@ #include #include +#include "core/fxcodec/codec/ccodec_faxmodule.h" #include "core/fxcodec/fx_codec.h" #include "core/fxcodec/jbig2/JBig2_ArithDecoder.h" #include "core/fxcodec/jbig2/JBig2_BitStream.h" @@ -451,18 +452,18 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArith( FXCODEC_STATUS CJBig2_GRDProc::StartDecodeMMR( std::unique_ptr* pImage, CJBig2_BitStream* pStream) { - int bitpos, i; auto image = pdfium::MakeUnique(GBW, GBH); if (!image->data()) { *pImage = nullptr; m_ProssiveStatus = FXCODEC_STATUS_ERROR; return m_ProssiveStatus; } - bitpos = static_cast(pStream->getBitPos()); - FaxG4Decode(pStream->getBuf(), pStream->getLength(), &bitpos, image->data(), - GBW, GBH, image->stride()); + int bitpos = static_cast(pStream->getBitPos()); + bitpos = CCodec_FaxModule::FaxG4Decode(pStream->getBuf(), + pStream->getLength(), bitpos, GBW, GBH, + image->stride(), image->data()); pStream->setBitPos(bitpos); - for (i = 0; (uint32_t)i < image->stride() * GBH; ++i) + for (uint32_t i = 0; i < image->stride() * GBH; ++i) image->data()[i] = ~image->data()[i]; m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; *pImage = std::move(image); -- cgit v1.2.3