• 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_FXGE_DIB_CFX_BITMAPSTORER_H_
8 #define CORE_FXGE_DIB_CFX_BITMAPSTORER_H_
9 
10 #include <memory>
11 #include <vector>
12 
13 #include "core/fxcrt/fx_coordinates.h"
14 #include "core/fxcrt/retain_ptr.h"
15 #include "core/fxge/dib/cfx_dibitmap.h"
16 #include "core/fxge/dib/ifx_scanlinecomposer.h"
17 #include "third_party/base/stl_util.h"
18 
19 class CFX_BitmapStorer : public IFX_ScanlineComposer {
20  public:
21   CFX_BitmapStorer();
22   ~CFX_BitmapStorer() override;
23 
24   // IFX_ScanlineComposer
25   void ComposeScanline(int line,
26                        const uint8_t* scanline,
27                        const uint8_t* scan_extra_alpha) override;
28   bool SetInfo(int width,
29                int height,
30                FXDIB_Format src_format,
31                uint32_t* pSrcPalette) override;
32 
GetBitmap()33   RetainPtr<CFX_DIBitmap> GetBitmap() { return m_pBitmap; }
34   RetainPtr<CFX_DIBitmap> Detach();
35   void Replace(RetainPtr<CFX_DIBitmap>&& pBitmap);
36 
37  private:
38   RetainPtr<CFX_DIBitmap> m_pBitmap;
39 };
40 
41 #endif  // CORE_FXGE_DIB_CFX_BITMAPSTORER_H_
42