xref: /aosp_15_r20/external/pdfium/core/fxge/dib/cfx_bitmapstorer.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2017 The PDFium Authors
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 "core/fxcrt/retain_ptr.h"
11 #include "core/fxge/dib/scanlinecomposer_iface.h"
12 #include "third_party/base/containers/span.h"
13 
14 class CFX_DIBitmap;
15 
16 class CFX_BitmapStorer final : public ScanlineComposerIface {
17  public:
18   CFX_BitmapStorer();
19   ~CFX_BitmapStorer() override;
20 
21   // ScanlineComposerIface:
22   void ComposeScanline(int line, pdfium::span<const uint8_t> scanline) override;
23   bool SetInfo(int width,
24                int height,
25                FXDIB_Format src_format,
26                pdfium::span<const uint32_t> src_palette) override;
27 
GetBitmap()28   RetainPtr<CFX_DIBitmap> GetBitmap() { return m_pBitmap; }
29   RetainPtr<CFX_DIBitmap> Detach();
30   void Replace(RetainPtr<CFX_DIBitmap>&& pBitmap);
31 
32  private:
33   RetainPtr<CFX_DIBitmap> m_pBitmap;
34 };
35 
36 #endif  // CORE_FXGE_DIB_CFX_BITMAPSTORER_H_
37