• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 PDFium Authors. All rights reserved.
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 "core/fxcrt/fx_system.h"
11 
12 class PauseIndicatorIface;
13 
14 namespace fxcodec {
15 
16 class ScanlineDecoder {
17  public:
18   ScanlineDecoder();
19   ScanlineDecoder(int nOrigWidth,
20                   int nOrigHeight,
21                   int nOutputWidth,
22                   int nOutputHeight,
23                   int nComps,
24                   int nBpc,
25                   uint32_t nPitch);
26   virtual ~ScanlineDecoder();
27 
28   const uint8_t* GetScanline(int line);
29   bool SkipToScanline(int line, PauseIndicatorIface* pPause);
30 
GetWidth()31   int GetWidth() const { return m_OutputWidth; }
GetHeight()32   int GetHeight() const { return m_OutputHeight; }
CountComps()33   int CountComps() const { return m_nComps; }
GetBPC()34   int GetBPC() const { return m_bpc; }
35 
36   virtual uint32_t GetSrcOffset() = 0;
37 
38  protected:
39   virtual bool v_Rewind() = 0;
40   virtual uint8_t* v_GetNextLine() = 0;
41 
42   uint8_t* ReadNextLine();
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   uint8_t* m_pLastScanline = nullptr;
53 };
54 
55 }  // namespace fxcodec
56 
57 using ScanlineDecoder = fxcodec::ScanlineDecoder;
58 
59 #endif  // CORE_FXCODEC_SCANLINEDECODER_H_
60