| 1 |
// Copyright 2016 The PDFium Authors |
| 2 |
// Use of this source code is governed by a BSD-style license that can be |
| 3 |
// found in the LICENSE file. |
| 4 |
|
| 5 |
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 |
|
| 7 |
#ifndef CORE_FXCODEC_SCANLINEDECODER_H_ |
| 8 |
#define CORE_FXCODEC_SCANLINEDECODER_H_ |
| 9 |
|
| 10 |
#include <stdint.h> |
| 11 |
|
| 12 |
#include <pdfium/third_party/base/span.h> |
| 13 |
|
| 14 |
namespace chromium { |
| 15 |
|
| 16 |
class PauseIndicatorIface; |
| 17 |
|
| 18 |
class ScanlineDecoder { |
| 19 |
public: |
| 20 |
ScanlineDecoder(); |
| 21 |
ScanlineDecoder(int nOrigWidth, |
| 22 |
int nOrigHeight, |
| 23 |
int nOutputWidth, |
| 24 |
int nOutputHeight, |
| 25 |
int nComps, |
| 26 |
int nBpc, |
| 27 |
uint32_t nPitch); |
| 28 |
virtual ~ScanlineDecoder(); |
| 29 |
|
| 30 |
pdfium::span<const uint8_t> GetScanline(int line); |
| 31 |
bool SkipToScanline(int line, PauseIndicatorIface* pPause); |
| 32 |
|
| 33 |
int GetWidth() const { return m_OutputWidth; } |
| 34 |
int GetHeight() const { return m_OutputHeight; } |
| 35 |
int CountComps() const { return m_nComps; } |
| 36 |
int GetBPC() const { return m_bpc; } |
| 37 |
|
| 38 |
virtual uint32_t GetSrcOffset() = 0; |
| 39 |
|
| 40 |
protected: |
| 41 |
virtual bool Rewind() = 0; |
| 42 |
virtual pdfium::span<uint8_t> GetNextLine() = 0; |
| 43 |
|
| 44 |
int m_OrigWidth; |
| 45 |
int m_OrigHeight; |
| 46 |
int m_OutputWidth; |
| 47 |
int m_OutputHeight; |
| 48 |
int m_nComps; |
| 49 |
int m_bpc; |
| 50 |
uint32_t m_Pitch; |
| 51 |
int m_NextLine = -1; |
| 52 |
pdfium::span<uint8_t> m_pLastScanline; |
| 53 |
}; |
| 54 |
|
| 55 |
} // namespace chromium |
| 56 |
|
| 57 |
using ScanlineDecoder = chromium::ScanlineDecoder; |
| 58 |
|
| 59 |
#endif // CORE_FXCODEC_SCANLINEDECODER_H_ |