• 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_CODEC_CCODEC_BMPMODULE_H_
8 #define CORE_FXCODEC_CODEC_CCODEC_BMPMODULE_H_
9 
10 #include <memory>
11 #include <vector>
12 
13 #include "core/fxcrt/fx_system.h"
14 #include "core/fxcrt/unowned_ptr.h"
15 
16 class CFX_DIBAttribute;
17 
18 class CCodec_BmpModule {
19  public:
20   class Context {
21    public:
~Context()22     virtual ~Context() {}
23   };
24 
25   class Delegate {
26    public:
27     virtual bool BmpInputImagePositionBuf(uint32_t rcd_pos) = 0;
28     virtual void BmpReadScanline(uint32_t row_num,
29                                  const std::vector<uint8_t>& row_buf) = 0;
30   };
31 
32   CCodec_BmpModule();
33   ~CCodec_BmpModule();
34 
35   std::unique_ptr<Context> Start(Delegate* pDelegate);
36   uint32_t GetAvailInput(Context* pContext, uint8_t** avail_buf_ptr);
37   void Input(Context* pContext, const uint8_t* src_buf, uint32_t src_size);
38   int32_t ReadHeader(Context* pContext,
39                      int32_t* width,
40                      int32_t* height,
41                      bool* tb_flag,
42                      int32_t* components,
43                      int32_t* pal_num,
44                      std::vector<uint32_t>* palette,
45                      CFX_DIBAttribute* pAttribute);
46   int32_t LoadImage(Context* pContext);
47 };
48 
49 #endif  // CORE_FXCODEC_CODEC_CCODEC_BMPMODULE_H_
50