summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-09-19 14:18:48 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-09-20 01:28:25 +0000
commit4b8d363ceed5437ee6a23563f69ba0a73d90413c (patch)
treef46c67c8a23318ea2d71035ca60355998e9daf20
parent89bf9ce294d83669922443dd17391e8c38e720a8 (diff)
downloadpdfium-4b8d363ceed5437ee6a23563f69ba0a73d90413c.tar.xz
Move CCodec_ScanlineDecoder to its own file.
Change-Id: Icacf877e2b66ca7d49637dcf9eaec0f99bcdd8bb Reviewed-on: https://pdfium-review.googlesource.com/14390 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
-rw-r--r--BUILD.gn1
-rw-r--r--core/fpdfapi/page/cpdf_streamparser.cpp1
-rw-r--r--core/fpdfapi/parser/fpdf_parser_decode.cpp1
-rw-r--r--core/fpdfapi/render/cpdf_dibsource.cpp1
-rw-r--r--core/fxcodec/codec/ccodec_scanlinedecoder.cpp73
-rw-r--r--core/fxcodec/codec/fx_codec.cpp66
-rw-r--r--core/fxcodec/codec/fx_codec_fax.cpp1
-rw-r--r--core/fxcodec/codec/fx_codec_flate.cpp1
-rw-r--r--core/fxcodec/codec/fx_codec_jpeg.cpp1
-rw-r--r--core/fxcodec/fx_codec.h1
10 files changed, 81 insertions, 66 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 8606748926..0d3e67bffa 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -702,6 +702,7 @@ static_library("fxcodec") {
"core/fxcodec/codec/ccodec_jbig2module.h",
"core/fxcodec/codec/ccodec_jpegmodule.h",
"core/fxcodec/codec/ccodec_jpxmodule.h",
+ "core/fxcodec/codec/ccodec_scanlinedecoder.cpp",
"core/fxcodec/codec/ccodec_scanlinedecoder.h",
"core/fxcodec/codec/cjpx_decoder.h",
"core/fxcodec/codec/codec_int.h",
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"