• 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_BMPMODULE_H_
8 #define CORE_FXCODEC_CODEC_ICODEC_BMPMODULE_H_
9 
10 #include "core/fxcrt/fx_system.h"
11 
12 struct FXBMP_Context;
13 class CFX_DIBAttribute;
14 
15 // Virtual interface to avoid linking in a concrete implementation
16 // if we do not enable this codec.
17 class ICodec_BmpModule {
18  public:
19   class Delegate {
20    public:
21     virtual bool BmpInputImagePositionBuf(uint32_t rcd_pos) = 0;
22     virtual void BmpReadScanline(int32_t row_num, uint8_t* row_buf) = 0;
23   };
24 
~ICodec_BmpModule()25   virtual ~ICodec_BmpModule() {}
26 
27   virtual FXBMP_Context* Start() = 0;
28   virtual void Finish(FXBMP_Context* pContext) = 0;
29   virtual uint32_t GetAvailInput(FXBMP_Context* pContext,
30                                  uint8_t** avail_buf_ptr) = 0;
31   virtual void Input(FXBMP_Context* pContext,
32                      const uint8_t* src_buf,
33                      uint32_t src_size) = 0;
34   virtual int32_t ReadHeader(FXBMP_Context* pContext,
35                              int32_t* width,
36                              int32_t* height,
37                              bool* tb_flag,
38                              int32_t* components,
39                              int32_t* pal_num,
40                              uint32_t** pal_pp,
41                              CFX_DIBAttribute* pAttribute) = 0;
42   virtual int32_t LoadImage(FXBMP_Context* pContext) = 0;
43 
GetDelegate()44   Delegate* GetDelegate() const { return m_pDelegate; }
SetDelegate(Delegate * pDelegate)45   void SetDelegate(Delegate* pDelegate) { m_pDelegate = pDelegate; }
46 
47  protected:
48   Delegate* m_pDelegate;
49 };
50 
51 #endif  // CORE_FXCODEC_CODEC_ICODEC_BMPMODULE_H_
52