summaryrefslogtreecommitdiff
path: root/core/fxge/dib/cfx_bitmapstorer.h
blob: 7d3482fc3f8c539971082e958273a0207a417cb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright 2017 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#ifndef CORE_FXGE_DIB_CFX_BITMAPSTORER_H_
#define CORE_FXGE_DIB_CFX_BITMAPSTORER_H_

#include <memory>
#include <vector>

#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/retain_ptr.h"
#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/dib/scanlinecomposer_iface.h"
#include "third_party/base/stl_util.h"

class CFX_BitmapStorer : public ScanlineComposerIface {
 public:
  CFX_BitmapStorer();
  ~CFX_BitmapStorer() override;

  // ScanlineComposerIface
  void ComposeScanline(int line,
                       const uint8_t* scanline,
                       const uint8_t* scan_extra_alpha) override;
  bool SetInfo(int width,
               int height,
               FXDIB_Format src_format,
               uint32_t* pSrcPalette) override;

  RetainPtr<CFX_DIBitmap> GetBitmap() { return m_pBitmap; }
  RetainPtr<CFX_DIBitmap> Detach();
  void Replace(RetainPtr<CFX_DIBitmap>&& pBitmap);

 private:
  RetainPtr<CFX_DIBitmap> m_pBitmap;
};

#endif  // CORE_FXGE_DIB_CFX_BITMAPSTORER_H_