• 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_FILTEREDDIB_H_
8 #define CORE_FXGE_DIB_CFX_FILTEREDDIB_H_
9 
10 #include <vector>
11 
12 #include "core/fxcrt/retain_ptr.h"
13 #include "core/fxge/dib/cfx_dibsource.h"
14 
15 class CFX_FilteredDIB : public CFX_DIBSource {
16  public:
17   template <typename T, typename... Args>
18   friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
19 
20   ~CFX_FilteredDIB() override;
21 
22   virtual FXDIB_Format GetDestFormat() = 0;
23   virtual uint32_t* GetDestPalette() = 0;
24   virtual void TranslateScanline(const uint8_t* src_buf,
25                                  std::vector<uint8_t>* dest_buf) const = 0;
26   virtual void TranslateDownSamples(uint8_t* dest_buf,
27                                     const uint8_t* src_buf,
28                                     int pixels,
29                                     int Bpp) const = 0;
30 
31   void LoadSrc(const RetainPtr<CFX_DIBSource>& pSrc);
32 
33  protected:
34   CFX_FilteredDIB();
35 
36   // CFX_DIBSource
37   const uint8_t* GetScanline(int line) const override;
38   void DownSampleScanline(int line,
39                           uint8_t* dest_scan,
40                           int dest_bpp,
41                           int dest_width,
42                           bool bFlipX,
43                           int clip_left,
44                           int clip_width) const override;
45 
46   RetainPtr<CFX_DIBSource> m_pSrc;
47   mutable std::vector<uint8_t> m_Scanline;
48 };
49 
50 #endif  // CORE_FXGE_DIB_CFX_FILTEREDDIB_H_
51