• 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_FXGE_IFX_RENDERDEVICEDRIVER_H_
8 #define CORE_FXGE_IFX_RENDERDEVICEDRIVER_H_
9 
10 #include <memory>
11 
12 #include "core/fxcrt/fx_coordinates.h"
13 #include "core/fxcrt/fx_system.h"
14 #include "core/fxcrt/retain_ptr.h"
15 
16 class CFX_DIBitmap;
17 class CFX_DIBSource;
18 class CFX_Font;
19 class CFX_GraphStateData;
20 class CFX_ImageRenderer;
21 class CFX_Matrix;
22 class CFX_PathData;
23 class CPDF_ShadingPattern;
24 class FXTEXT_CHARPOS;
25 class IFX_PauseIndicator;
26 struct FX_RECT;
27 
28 class IFX_RenderDeviceDriver {
29  public:
30   virtual ~IFX_RenderDeviceDriver();
31 
32   virtual int GetDeviceCaps(int caps_id) const = 0;
33   virtual CFX_Matrix GetCTM() const;
34 
35   virtual bool StartRendering();
36   virtual void EndRendering();
37   virtual void SaveState() = 0;
38   virtual void RestoreState(bool bKeepSaved) = 0;
39 
40   virtual bool SetClip_PathFill(const CFX_PathData* pPathData,
41                                 const CFX_Matrix* pObject2Device,
42                                 int fill_mode) = 0;
43   virtual bool SetClip_PathStroke(const CFX_PathData* pPathData,
44                                   const CFX_Matrix* pObject2Device,
45                                   const CFX_GraphStateData* pGraphState);
46   virtual bool DrawPath(const CFX_PathData* pPathData,
47                         const CFX_Matrix* pObject2Device,
48                         const CFX_GraphStateData* pGraphState,
49                         uint32_t fill_color,
50                         uint32_t stroke_color,
51                         int fill_mode,
52                         int blend_type) = 0;
53   virtual bool SetPixel(int x, int y, uint32_t color);
54   virtual bool FillRectWithBlend(const FX_RECT* pRect,
55                                  uint32_t fill_color,
56                                  int blend_type);
57   virtual bool DrawCosmeticLine(const CFX_PointF& ptMoveTo,
58                                 const CFX_PointF& ptLineTo,
59                                 uint32_t color,
60                                 int blend_type);
61 
62   virtual bool GetClipBox(FX_RECT* pRect) = 0;
63   virtual bool GetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap,
64                          int left,
65                          int top);
66   virtual RetainPtr<CFX_DIBitmap> GetBackDrop();
67   virtual bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
68                          uint32_t color,
69                          const FX_RECT* pSrcRect,
70                          int dest_left,
71                          int dest_top,
72                          int blend_type) = 0;
73   virtual bool StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
74                              uint32_t color,
75                              int dest_left,
76                              int dest_top,
77                              int dest_width,
78                              int dest_height,
79                              const FX_RECT* pClipRect,
80                              uint32_t flags,
81                              int blend_type) = 0;
82   virtual bool StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap,
83                            int bitmap_alpha,
84                            uint32_t color,
85                            const CFX_Matrix* pMatrix,
86                            uint32_t flags,
87                            std::unique_ptr<CFX_ImageRenderer>* handle,
88                            int blend_type) = 0;
89   virtual bool ContinueDIBits(CFX_ImageRenderer* handle,
90                               IFX_PauseIndicator* pPause);
91   virtual bool DrawDeviceText(int nChars,
92                               const FXTEXT_CHARPOS* pCharPos,
93                               CFX_Font* pFont,
94                               const CFX_Matrix* pObject2Device,
95                               float font_size,
96                               uint32_t color);
97   virtual int GetDriverType() const;
98   virtual void ClearDriver();
99   virtual bool DrawShading(const CPDF_ShadingPattern* pPattern,
100                            const CFX_Matrix* pMatrix,
101                            const FX_RECT& clip_rect,
102                            int alpha,
103                            bool bAlphaMode);
104   virtual bool SetBitsWithMask(const RetainPtr<CFX_DIBSource>& pBitmap,
105                                const RetainPtr<CFX_DIBSource>& pMask,
106                                int left,
107                                int top,
108                                int bitmap_alpha,
109                                int blend_type);
110 #if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_
111   virtual void Flush();
112 #endif
113 };
114 
115 #endif  // CORE_FXGE_IFX_RENDERDEVICEDRIVER_H_
116