diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/fpdfapi/page/cpdf_streamparser.cpp | 1 | ||||
-rw-r--r-- | core/fpdfapi/parser/fpdf_parser_decode.cpp | 1 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_dibsource.cpp | 1 | ||||
-rw-r--r-- | core/fxcodec/codec/ccodec_scanlinedecoder.cpp | 73 | ||||
-rw-r--r-- | core/fxcodec/codec/fx_codec.cpp | 66 | ||||
-rw-r--r-- | core/fxcodec/codec/fx_codec_fax.cpp | 1 | ||||
-rw-r--r-- | core/fxcodec/codec/fx_codec_flate.cpp | 1 | ||||
-rw-r--r-- | core/fxcodec/codec/fx_codec_jpeg.cpp | 1 | ||||
-rw-r--r-- | core/fxcodec/fx_codec.h | 1 |
9 files changed, 80 insertions, 66 deletions
diff --git a/core/fpdfapi/page/cpdf_streamparser.cpp b/core/fpdfapi/page/cpdf_streamparser.cpp index 46cbfeb1fe..526f09757d 100644 --- a/core/fpdfapi/page/cpdf_streamparser.cpp +++ b/core/fpdfapi/page/cpdf_streamparser.cpp @@ -26,6 +26,7 @@ #include "core/fpdfapi/parser/cpdf_string.h" #include "core/fpdfapi/parser/fpdf_parser_decode.h" #include "core/fpdfapi/parser/fpdf_parser_utility.h" +#include "core/fxcodec/codec/ccodec_scanlinedecoder.h" #include "core/fxcodec/fx_codec.h" #include "core/fxcrt/fx_extension.h" diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp index 0180aaf749..2c5cb78f43 100644 --- a/core/fpdfapi/parser/fpdf_parser_decode.cpp +++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp @@ -17,6 +17,7 @@ #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fpdfapi/parser/fpdf_parser_utility.h" +#include "core/fxcodec/codec/ccodec_scanlinedecoder.h" #include "core/fxcodec/fx_codec.h" #include "core/fxcrt/fx_extension.h" #include "third_party/base/numerics/safe_math.h" diff --git a/core/fpdfapi/render/cpdf_dibsource.cpp b/core/fpdfapi/render/cpdf_dibsource.cpp index 86a01c596c..9764d51b65 100644 --- a/core/fpdfapi/render/cpdf_dibsource.cpp +++ b/core/fpdfapi/render/cpdf_dibsource.cpp @@ -21,6 +21,7 @@ #include "core/fpdfapi/parser/fpdf_parser_decode.h" #include "core/fpdfapi/render/cpdf_pagerendercache.h" #include "core/fpdfapi/render/cpdf_renderstatus.h" +#include "core/fxcodec/codec/ccodec_scanlinedecoder.h" #include "core/fxcodec/codec/cjpx_decoder.h" #include "core/fxcodec/fx_codec.h" #include "core/fxcrt/cfx_fixedbufgrow.h" diff --git a/core/fxcodec/codec/ccodec_scanlinedecoder.cpp b/core/fxcodec/codec/ccodec_scanlinedecoder.cpp new file mode 100644 index 0000000000..55b9a2a87d --- /dev/null +++ b/core/fxcodec/codec/ccodec_scanlinedecoder.cpp @@ -0,0 +1,73 @@ +// Copyright 2017 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "core/fxcodec/codec/ccodec_scanlinedecoder.h" + +#include "core/fxcrt/ifx_pauseindicator.h" + +CCodec_ScanlineDecoder::CCodec_ScanlineDecoder() + : CCodec_ScanlineDecoder(0, 0, 0, 0, 0, 0, 0) {} + +CCodec_ScanlineDecoder::CCodec_ScanlineDecoder(int nOrigWidth, + int nOrigHeight, + int nOutputWidth, + int nOutputHeight, + int nComps, + int nBpc, + uint32_t nPitch) + : m_OrigWidth(nOrigWidth), + m_OrigHeight(nOrigHeight), + m_OutputWidth(nOutputWidth), + m_OutputHeight(nOutputHeight), + m_nComps(nComps), + m_bpc(nBpc), + m_Pitch(nPitch), + m_NextLine(-1), + m_pLastScanline(nullptr) {} + +CCodec_ScanlineDecoder::~CCodec_ScanlineDecoder() {} + +const uint8_t* CCodec_ScanlineDecoder::GetScanline(int line) { + if (m_NextLine == line + 1) + return m_pLastScanline; + + if (m_NextLine < 0 || m_NextLine > line) { + if (!v_Rewind()) + return nullptr; + m_NextLine = 0; + } + while (m_NextLine < line) { + ReadNextLine(); + m_NextLine++; + } + m_pLastScanline = ReadNextLine(); + m_NextLine++; + return m_pLastScanline; +} + +bool CCodec_ScanlineDecoder::SkipToScanline(int line, + IFX_PauseIndicator* pPause) { + if (m_NextLine == line || m_NextLine == line + 1) + return false; + + if (m_NextLine < 0 || m_NextLine > line) { + v_Rewind(); + m_NextLine = 0; + } + m_pLastScanline = nullptr; + while (m_NextLine < line) { + m_pLastScanline = ReadNextLine(); + m_NextLine++; + if (pPause && pPause->NeedToPauseNow()) { + return true; + } + } + return false; +} + +uint8_t* CCodec_ScanlineDecoder::ReadNextLine() { + return v_GetNextLine(); +} diff --git a/core/fxcodec/codec/fx_codec.cpp b/core/fxcodec/codec/fx_codec.cpp index 2681f72199..6bcea4b48e 100644 --- a/core/fxcodec/codec/fx_codec.cpp +++ b/core/fxcodec/codec/fx_codec.cpp @@ -12,10 +12,10 @@ #include <tuple> #include <utility> +#include "core/fxcodec/codec/ccodec_scanlinedecoder.h" #include "core/fxcodec/codec/codec_int.h" #include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_safe_types.h" -#include "core/fxcrt/ifx_pauseindicator.h" #include "third_party/base/logging.h" #include "third_party/base/ptr_util.h" @@ -1350,70 +1350,6 @@ CCodec_ModuleMgr::CCodec_ModuleMgr() CCodec_ModuleMgr::~CCodec_ModuleMgr() {} -CCodec_ScanlineDecoder::CCodec_ScanlineDecoder() - : CCodec_ScanlineDecoder(0, 0, 0, 0, 0, 0, 0) {} - -CCodec_ScanlineDecoder::CCodec_ScanlineDecoder(int nOrigWidth, - int nOrigHeight, - int nOutputWidth, - int nOutputHeight, - int nComps, - int nBpc, - uint32_t nPitch) - : m_OrigWidth(nOrigWidth), - m_OrigHeight(nOrigHeight), - m_OutputWidth(nOutputWidth), - m_OutputHeight(nOutputHeight), - m_nComps(nComps), - m_bpc(nBpc), - m_Pitch(nPitch), - m_NextLine(-1), - m_pLastScanline(nullptr) {} - -CCodec_ScanlineDecoder::~CCodec_ScanlineDecoder() {} - -const uint8_t* CCodec_ScanlineDecoder::GetScanline(int line) { - if (m_NextLine == line + 1) - return m_pLastScanline; - - if (m_NextLine < 0 || m_NextLine > line) { - if (!v_Rewind()) - return nullptr; - m_NextLine = 0; - } - while (m_NextLine < line) { - ReadNextLine(); - m_NextLine++; - } - m_pLastScanline = ReadNextLine(); - m_NextLine++; - return m_pLastScanline; -} - -bool CCodec_ScanlineDecoder::SkipToScanline(int line, - IFX_PauseIndicator* pPause) { - if (m_NextLine == line || m_NextLine == line + 1) - return false; - - if (m_NextLine < 0 || m_NextLine > line) { - v_Rewind(); - m_NextLine = 0; - } - m_pLastScanline = nullptr; - while (m_NextLine < line) { - m_pLastScanline = ReadNextLine(); - m_NextLine++; - if (pPause && pPause->NeedToPauseNow()) { - return true; - } - } - return false; -} - -uint8_t* CCodec_ScanlineDecoder::ReadNextLine() { - return v_GetNextLine(); -} - bool CCodec_BasicModule::RunLengthEncode(const uint8_t* src_buf, uint32_t src_size, uint8_t** dest_buf, diff --git a/core/fxcodec/codec/fx_codec_fax.cpp b/core/fxcodec/codec/fx_codec_fax.cpp index 20aada9c12..9cd2cb9a51 100644 --- a/core/fxcodec/codec/fx_codec_fax.cpp +++ b/core/fxcodec/codec/fx_codec_fax.cpp @@ -8,6 +8,7 @@ #include <memory> #include <vector> +#include "core/fxcodec/codec/ccodec_scanlinedecoder.h" #include "core/fxcodec/codec/codec_int.h" #include "core/fxcodec/fx_codec.h" #include "core/fxcrt/cfx_binarybuf.h" diff --git a/core/fxcodec/codec/fx_codec_flate.cpp b/core/fxcodec/codec/fx_codec_flate.cpp index 6482d52ed8..72b20741b5 100644 --- a/core/fxcodec/codec/fx_codec_flate.cpp +++ b/core/fxcodec/codec/fx_codec_flate.cpp @@ -11,6 +11,7 @@ #include <utility> #include <vector> +#include "core/fxcodec/codec/ccodec_scanlinedecoder.h" #include "core/fxcodec/fx_codec.h" #include "core/fxcrt/fx_extension.h" #include "third_party/base/numerics/safe_conversions.h" diff --git a/core/fxcodec/codec/fx_codec_jpeg.cpp b/core/fxcodec/codec/fx_codec_jpeg.cpp index 521053a374..1084529c7d 100644 --- a/core/fxcodec/codec/fx_codec_jpeg.cpp +++ b/core/fxcodec/codec/fx_codec_jpeg.cpp @@ -10,6 +10,7 @@ #include <utility> #include "core/fxcodec/codec/ccodec_jpegmodule.h" +#include "core/fxcodec/codec/ccodec_scanlinedecoder.h" #include "core/fxcodec/fx_codec.h" #include "core/fxcrt/fx_safe_types.h" #include "core/fxge/dib/cfx_dibsource.h" diff --git a/core/fxcodec/fx_codec.h b/core/fxcodec/fx_codec.h index 926a884efe..269cd14253 100644 --- a/core/fxcodec/fx_codec.h +++ b/core/fxcodec/fx_codec.h @@ -20,7 +20,6 @@ #include "core/fxcodec/codec/ccodec_jbig2module.h" #include "core/fxcodec/codec/ccodec_jpegmodule.h" #include "core/fxcodec/codec/ccodec_jpxmodule.h" -#include "core/fxcodec/codec/ccodec_scanlinedecoder.h" #include "core/fxcodec/fx_codec_def.h" #include "core/fxcrt/fx_coordinates.h" |