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_IMAGERENDERER_H_ 8 #define CORE_FXGE_DIB_CFX_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/dib/cfx_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_ImageRenderer { 24 public: 25 CFX_ImageRenderer(const RetainPtr<CFX_DIBitmap>& pDevice, 26 const CFX_ClipRgn* pClipRgn, 27 const RetainPtr<CFX_DIBBase>& pSource, 28 int bitmap_alpha, 29 uint32_t mask_color, 30 const CFX_Matrix& matrix, 31 const FXDIB_ResampleOptions& options, 32 bool bRgbByteOrder); 33 ~CFX_ImageRenderer(); 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_ClipRgn> 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_BitmapComposer m_Composer; 46 FX_RECT m_ClipBox; 47 const int m_BitmapAlpha; 48 uint32_t m_MaskColor; 49 State m_State = State::kInitial; 50 const bool m_bRgbByteOrder; 51 }; 52 53 #endif // CORE_FXGE_DIB_CFX_IMAGERENDERER_H_ 54