• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 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_FPDFAPI_RENDER_CPDF_IMAGERENDERER_H_
8 #define CORE_FPDFAPI_RENDER_CPDF_IMAGERENDERER_H_
9 
10 #include <memory>
11 
12 #include "core/fpdfapi/render/cpdf_imageloader.h"
13 
14 class CFX_FxgeDevice;
15 class CFX_ImageTransformer;
16 class CPDF_ImageObject;
17 class CPDF_PageObject;
18 class CPDF_Pattern;
19 class CPDF_RenderStatus;
20 
21 class CPDF_ImageRenderer {
22  public:
23   CPDF_ImageRenderer();
24   ~CPDF_ImageRenderer();
25 
26   bool Start(CPDF_RenderStatus* pStatus,
27              CPDF_PageObject* pObj,
28              const CFX_Matrix* pObj2Device,
29              bool bStdCS,
30              int blendType);
31 
32   bool Start(CPDF_RenderStatus* pStatus,
33              const CFX_DIBSource* pDIBSource,
34              FX_ARGB bitmap_argb,
35              int bitmap_alpha,
36              const CFX_Matrix* pImage2Device,
37              uint32_t flags,
38              bool bStdCS,
39              int blendType);
40 
41   bool Continue(IFX_Pause* pPause);
GetResult()42   bool GetResult() const { return m_Result; }
43 
44  private:
45   bool StartBitmapAlpha();
46   bool StartDIBSource();
47   bool StartRenderDIBSource();
48   bool StartLoadDIBSource();
49   bool DrawMaskedImage();
50   bool DrawPatternImage(const CFX_Matrix* pObj2Device);
51   bool NotDrawing() const;
52   FX_RECT GetDrawRect() const;
53   CFX_Matrix GetDrawMatrix(const FX_RECT& rect) const;
54   void CalculateDrawImage(CFX_FxgeDevice* bitmap_device1,
55                           CFX_FxgeDevice* bitmap_device2,
56                           const CFX_DIBSource* pDIBSource,
57                           CFX_Matrix* pNewMatrix,
58                           const FX_RECT& rect) const;
59 
60   CPDF_RenderStatus* m_pRenderStatus;
61   CPDF_ImageObject* m_pImageObject;
62   int m_Status;
63   const CFX_Matrix* m_pObj2Device;
64   CFX_Matrix m_ImageMatrix;
65   CPDF_ImageLoader m_Loader;
66   const CFX_DIBSource* m_pDIBSource;
67   std::unique_ptr<CFX_DIBitmap> m_pClone;
68   int m_BitmapAlpha;
69   bool m_bPatternColor;
70   CPDF_Pattern* m_pPattern;
71   FX_ARGB m_FillArgb;
72   uint32_t m_Flags;
73   std::unique_ptr<CFX_ImageTransformer> m_pTransformer;
74   void* m_DeviceHandle;
75   bool m_bStdCS;
76   int m_BlendType;
77   bool m_Result;
78 };
79 
80 #endif  // CORE_FPDFAPI_RENDER_CPDF_IMAGERENDERER_H_
81