• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_AGG_CFX_AGG_IMAGERENDERER_H_
8 #define CORE_FXGE_AGG_CFX_AGG_IMAGERENDERER_H_
9 
10 #include <memory>
11 
12 #include "core/fxcrt/fx_coordinates.h"
13 #include "core/fxcrt/retain_ptr.h"
14 #include "core/fxcrt/unowned_ptr.h"
15 #include "core/fxge/agg/cfx_agg_bitmapcomposer.h"
16 
17 class CFX_DIBBase;
18 class CFX_DIBitmap;
19 class CFX_ImageTransformer;
20 class CFX_ImageStretcher;
21 class PauseIndicatorIface;
22 
23 class CFX_AggImageRenderer {
24  public:
25   CFX_AggImageRenderer(const RetainPtr<CFX_DIBitmap>& pDevice,
26                        const CFX_AggClipRgn* pClipRgn,
27                        RetainPtr<const CFX_DIBBase> source,
28                        float alpha,
29                        uint32_t mask_color,
30                        const CFX_Matrix& matrix,
31                        const FXDIB_ResampleOptions& options,
32                        bool bRgbByteOrder);
33   ~CFX_AggImageRenderer();
34 
35   bool Continue(PauseIndicatorIface* pPause);
36 
37  private:
38   enum class State : uint8_t { kInitial = 0, kStretching, kTransforming };
39 
40   RetainPtr<CFX_DIBitmap> const m_pDevice;
41   UnownedPtr<const CFX_AggClipRgn> const m_pClipRgn;
42   const CFX_Matrix m_Matrix;
43   std::unique_ptr<CFX_ImageTransformer> m_pTransformer;
44   std::unique_ptr<CFX_ImageStretcher> m_Stretcher;
45   CFX_AggBitmapComposer m_Composer;
46   FX_RECT m_ClipBox;
47   const float m_Alpha;
48   uint32_t m_MaskColor;
49   State m_State = State::kInitial;
50   const bool m_bRgbByteOrder;
51 };
52 
53 #endif  // CORE_FXGE_AGG_CFX_AGG_IMAGERENDERER_H_
54