Clean up CPDF_AnnotList.
[pdfium.git] / core / src / fxge / skia / fx_skia_device.h
1 // Copyright 2014 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 #ifndef CORE_SRC_FXGE_SKIA_FX_SKIA_DEVICE_H_
6 #define CORE_SRC_FXGE_SKIA_FX_SKIA_DEVICE_H_
7
8 #if defined(_SKIA_SUPPORT_)
9 class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
10  public:
11   CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap,
12                        int dither_bits,
13                        FX_BOOL bRgbByteOrder,
14                        CFX_DIBitmap* pOriDevice,
15                        FX_BOOL bGroupKnockout);
16   ~CFX_SkiaDeviceDriver() override;
17
18   /** Options */
19   virtual int GetDeviceCaps(int caps_id);
20
21   /** Save and restore all graphic states */
22   virtual void SaveState();
23   virtual void RestoreState(FX_BOOL bKeepSaved);
24
25   /** Set clipping path using filled region */
26   virtual FX_BOOL SetClip_PathFill(
27       const CFX_PathData* pPathData,           // path info
28       const CFX_AffineMatrix* pObject2Device,  // optional transformation
29       int fill_mode  // fill mode, WINDING or ALTERNATE
30       );
31
32   /** Set clipping path using stroked region */
33   virtual FX_BOOL SetClip_PathStroke(
34       const CFX_PathData* pPathData,           // path info
35       const CFX_AffineMatrix* pObject2Device,  // optional transformation
36       const CFX_GraphStateData*
37           pGraphState  // graphic state, for pen attributes
38       );
39
40   /** Draw a path */
41   virtual FX_BOOL DrawPath(const CFX_PathData* pPathData,
42                            const CFX_AffineMatrix* pObject2Device,
43                            const CFX_GraphStateData* pGraphState,
44                            FX_DWORD fill_color,
45                            FX_DWORD stroke_color,
46                            int fill_mode,
47                            int alpha_flag = 0,
48                            void* pIccTransform = NULL);
49
50   virtual FX_BOOL SetPixel(int x,
51                            int y,
52                            FX_DWORD color,
53                            int alpha_flag = 0,
54                            void* pIccTransform = NULL);
55
56   virtual FX_BOOL FillRect(const FX_RECT* pRect,
57                            FX_DWORD fill_color,
58                            int alpha_flag = 0,
59                            void* pIccTransform = NULL);
60
61   /** Draw a single pixel (device dependant) line */
62   virtual FX_BOOL DrawCosmeticLine(FX_FIXFLOAT x1,
63                                    FX_FIXFLOAT y1,
64                                    FX_FIXFLOAT x2,
65                                    FX_FIXFLOAT y2,
66                                    FX_DWORD color,
67                                    int alpha_flag,
68                                    void* pIccTransform,
69                                    int blend_type) {
70     return FALSE;
71   }
72
73   virtual FX_BOOL GetClipBox(FX_RECT* pRect);
74
75   /** Load device buffer into a DIB */
76   virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap,
77                             int left,
78                             int top,
79                             void* pIccTransform = NULL,
80                             FX_BOOL bDEdge = FALSE);
81
82   virtual CFX_DIBitmap* GetBackDrop() { return m_pAggDriver->GetBackDrop(); }
83
84   virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
85                             FX_DWORD color,
86                             const FX_RECT* pSrcRect,
87                             int dest_left,
88                             int dest_top,
89                             int blend_type,
90                             int alpha_flag = 0,
91                             void* pIccTransform = NULL);
92   virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
93                                 FX_DWORD color,
94                                 int dest_left,
95                                 int dest_top,
96                                 int dest_width,
97                                 int dest_height,
98                                 const FX_RECT* pClipRect,
99                                 FX_DWORD flags,
100                                 int alpha_flag = 0,
101                                 void* pIccTransform = NULL);
102
103   virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
104                               int bitmap_alpha,
105                               FX_DWORD color,
106                               const CFX_AffineMatrix* pMatrix,
107                               FX_DWORD flags,
108                               void*& handle,
109                               int alpha_flag = 0,
110                               void* pIccTransform = NULL);
111   virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause);
112   virtual void CancelDIBits(void* handle);
113
114   virtual FX_BOOL DrawDeviceText(int nChars,
115                                  const FXTEXT_CHARPOS* pCharPos,
116                                  CFX_Font* pFont,
117                                  CFX_FontCache* pCache,
118                                  const CFX_AffineMatrix* pObject2Device,
119                                  FX_FIXFLOAT font_size,
120                                  FX_DWORD color,
121                                  int alpha_flag = 0,
122                                  void* pIccTransform = NULL);
123
124   virtual FX_BOOL RenderRasterizer(rasterizer_scanline_aa& rasterizer,
125                                    FX_DWORD color,
126                                    FX_BOOL bFullCover,
127                                    FX_BOOL bGroupKnockout,
128                                    int alpha_flag,
129                                    void* pIccTransform);
130   virtual FX_BOOL RenderRasterizerSkia(SkPath& skPath,
131                                        const SkPaint& origPaint,
132                                        SkIRect& rect,
133                                        FX_DWORD color,
134                                        FX_BOOL bFullCover,
135                                        FX_BOOL bGroupKnockout,
136                                        int alpha_flag,
137                                        void* pIccTransform,
138                                        FX_BOOL bFill = TRUE);
139   void SetClipMask(rasterizer_scanline_aa& rasterizer);
140   void SetClipMask(SkPath& skPath, SkPaint* spaint);
141   virtual uint8_t* GetBuffer() const { return m_pAggDriver->GetBuffer(); }
142
143   CFX_AggDeviceDriver* m_pAggDriver;
144 };
145 #endif  // defined(_SKIA_SUPPORT_)
146
147 #endif  // CORE_SRC_FXGE_SKIA_FX_SKIA_DEVICE_H_