summaryrefslogtreecommitdiff
path: root/core/fxge/dib/cfx_filtereddib.h
blob: e998c7169aab6110fa1d24474f6a44ab0d0b75a6 (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
42
43
44
45
46
47
48
49
50
// 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_FILTEREDDIB_H_
#define CORE_FXGE_DIB_CFX_FILTEREDDIB_H_

#include <vector>

#include "core/fxcrt/retain_ptr.h"
#include "core/fxge/dib/cfx_dibsource.h"

class CFX_FilteredDIB : public CFX_DIBSource {
 public:
  template <typename T, typename... Args>
  friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);

  ~CFX_FilteredDIB() override;

  virtual FXDIB_Format GetDestFormat() = 0;
  virtual uint32_t* GetDestPalette() = 0;
  virtual void TranslateScanline(const uint8_t* src_buf,
                                 std::vector<uint8_t>* dest_buf) const = 0;
  virtual void TranslateDownSamples(uint8_t* dest_buf,
                                    const uint8_t* src_buf,
                                    int pixels,
                                    int Bpp) const = 0;

  void LoadSrc(const RetainPtr<CFX_DIBSource>& pSrc);

 protected:
  CFX_FilteredDIB();

  // CFX_DIBSource
  const uint8_t* GetScanline(int line) const override;
  void DownSampleScanline(int line,
                          uint8_t* dest_scan,
                          int dest_bpp,
                          int dest_width,
                          bool bFlipX,
                          int clip_left,
                          int clip_width) const override;

  RetainPtr<CFX_DIBSource> m_pSrc;
  mutable std::vector<uint8_t> m_Scanline;
};

#endif  // CORE_FXGE_DIB_CFX_FILTEREDDIB_H_