• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 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_CODEC_ICODEC_PNGMODULE_H_
8 #define CORE_FXCODEC_CODEC_ICODEC_PNGMODULE_H_
9 
10 #include "core/fxcrt/fx_system.h"
11 
12 class CFX_DIBAttribute;
13 struct FXPNG_Context;
14 
15 // Virtual interface to avoid linking in a concrete implementation
16 // if we do not enable this codec.
17 class ICodec_PngModule {
18  public:
19   class Delegate {
20    public:
21     virtual bool PngReadHeader(int width,
22                                int height,
23                                int bpc,
24                                int pass,
25                                int* color_type,
26                                double* gamma) = 0;
27     virtual bool PngAskScanlineBuf(int line, uint8_t*& src_buf) = 0;
28     virtual void PngFillScanlineBufCompleted(int pass, int line) = 0;
29   };
30 
~ICodec_PngModule()31   virtual ~ICodec_PngModule() {}
32 
33   virtual FXPNG_Context* Start() = 0;
34   virtual void Finish(FXPNG_Context* pContext) = 0;
35   virtual bool Input(FXPNG_Context* pContext,
36                      const uint8_t* src_buf,
37                      uint32_t src_size,
38                      CFX_DIBAttribute* pAttribute) = 0;
39 
GetDelegate()40   Delegate* GetDelegate() const { return m_pDelegate; }
SetDelegate(Delegate * delegate)41   void SetDelegate(Delegate* delegate) { m_pDelegate = delegate; }
42 
43  protected:
44   Delegate* m_pDelegate;
45 };
46 
47 #endif  // CORE_FXCODEC_CODEC_ICODEC_PNGMODULE_H_
48