• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "core/fxcrt/raw_span.h"
13 #include "core/fxcrt/span.h"
14 
15 class PauseIndicatorIface;
16 
17 namespace fxcodec {
18 
19 class ScanlineDecoder {
20  public:
21   ScanlineDecoder();
22   ScanlineDecoder(int nOrigWidth,
23                   int nOrigHeight,
24                   int nOutputWidth,
25                   int nOutputHeight,
26                   int nComps,
27                   int nBpc,
28                   uint32_t nPitch);
29   virtual ~ScanlineDecoder();
30 
31   pdfium::span<const uint8_t> GetScanline(int line);
32   bool SkipToScanline(int line, PauseIndicatorIface* pPause);
33 
GetWidth()34   int GetWidth() const { return m_OutputWidth; }
GetHeight()35   int GetHeight() const { return m_OutputHeight; }
CountComps()36   int CountComps() const { return m_nComps; }
GetBPC()37   int GetBPC() const { return m_bpc; }
38 
39   virtual uint32_t GetSrcOffset() = 0;
40 
41  protected:
42   virtual bool Rewind() = 0;
43   virtual pdfium::span<uint8_t> GetNextLine() = 0;
44 
45   int m_OrigWidth;
46   int m_OrigHeight;
47   int m_OutputWidth;
48   int m_OutputHeight;
49   int m_nComps;
50   int m_bpc;
51   uint32_t m_Pitch;
52   int m_NextLine = -1;
53   pdfium::raw_span<uint8_t> m_pLastScanline;
54 };
55 
56 }  // namespace fxcodec
57 
58 using ScanlineDecoder = fxcodec::ScanlineDecoder;
59 
60 #endif  // CORE_FXCODEC_SCANLINEDECODER_H_
61