summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec
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 /core/fxcodec/codec
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>
Diffstat (limited to 'core/fxcodec/codec')
-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
5 files changed, 77 insertions, 65 deletions
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"