Bring back the Skia files from the old repo.
[pdfium.git] / core / src / fxge / skia / fx_skia_device.h
1 #ifndef _FX_SKIA_DEVICE_DRIVER_
2 #define _FX_SKIA_DEVICE_DRIVER_
3 //#define _SKIA_SUPPORT_
4 #if defined(_SKIA_SUPPORT_)
5 class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver
6 {
7 public:
8         CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout);
9         virtual ~CFX_SkiaDeviceDriver();
10
11         /** Options */
12         virtual int                     GetDeviceCaps(int caps_id);
13         
14         /** Save and restore all graphic states */
15         virtual void            SaveState();
16         virtual void            RestoreState(FX_BOOL bKeepSaved);
17         
18         /** Set clipping path using filled region */
19         virtual FX_BOOL         SetClip_PathFill(const CFX_PathData* pPathData, // path info
20                                                         const CFX_AffineMatrix* pObject2Device, // optional transformation
21                                                         int fill_mode   // fill mode, WINDING or ALTERNATE
22                                                         );
23         
24         /** Set clipping path using stroked region */
25         virtual FX_BOOL         SetClip_PathStroke(const CFX_PathData* pPathData,       // path info
26                                                         const CFX_AffineMatrix* pObject2Device, // optional transformation
27                                                         const CFX_GraphStateData* pGraphState   // graphic state, for pen attributes
28                                                         );
29         
30         /** Draw a path */
31         virtual FX_BOOL         DrawPath(const CFX_PathData* pPathData,
32                                                 const CFX_AffineMatrix* pObject2Device,
33                                                 const CFX_GraphStateData* pGraphState,
34                                                 FX_DWORD fill_color,
35                                                 FX_DWORD stroke_color,
36                                                 int fill_mode,
37                                                 int alpha_flag = 0, 
38                                                 void* pIccTransform = NULL
39                                                         );
40         
41         virtual FX_BOOL         SetPixel(int x, int y, FX_DWORD color,
42                                                 int alpha_flag = 0, void* pIccTransform = NULL);
43         
44         virtual FX_BOOL         FillRect(const FX_RECT* pRect, FX_DWORD fill_color, 
45                                                 int alpha_flag = 0, void* pIccTransform = NULL);
46         
47         /** Draw a single pixel (device dependant) line */
48         virtual FX_BOOL         DrawCosmeticLine(FX_FIXFLOAT x1, FX_FIXFLOAT y1, FX_FIXFLOAT x2, FX_FIXFLOAT y2, FX_DWORD color, 
49                                                         int alpha_flag, void* pIccTransform, int blend_type) { return FALSE; }
50         
51         virtual FX_BOOL         GetClipBox(FX_RECT* pRect);
52         
53         /** Load device buffer into a DIB */
54         virtual FX_BOOL         GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void* pIccTransform = NULL, FX_BOOL bDEdge = FALSE);
55
56         virtual CFX_DIBitmap*   GetBackDrop() { return m_pAggDriver->GetBackDrop(); }
57         
58         virtual FX_BOOL         SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, const FX_RECT* pSrcRect, 
59                                                 int dest_left, int dest_top, int blend_type, 
60                                                 int alpha_flag = 0, void* pIccTransform = NULL);
61         virtual FX_BOOL         StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color, int dest_left, int dest_top, 
62                                 int dest_width, int dest_height, const FX_RECT* pClipRect, FX_DWORD flags, 
63                                 int alpha_flag = 0, void* pIccTransform = NULL);
64         
65         virtual FX_BOOL         StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, FX_DWORD color, 
66                                 const CFX_AffineMatrix* pMatrix, FX_DWORD flags, FX_LPVOID& handle, 
67                                 int alpha_flag = 0, void* pIccTransform = NULL);
68         virtual FX_BOOL         ContinueDIBits(FX_LPVOID handle, IFX_Pause* pPause);
69         virtual void            CancelDIBits(FX_LPVOID handle);
70         
71         virtual FX_BOOL     DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont,
72                                                 CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FIXFLOAT font_size, FX_DWORD color, 
73                                                 int alpha_flag = 0, void* pIccTransform = NULL);
74         
75         virtual FX_BOOL         RenderRasterizer(rasterizer_scanline_aa& rasterizer, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bGroupKnockout, 
76                                                         int alpha_flag, void* pIccTransform);
77         virtual FX_BOOL         RenderRasterizerSkia(SkPath& skPath, const SkPaint& origPaint, SkIRect& rect, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bGroupKnockout, 
78                                                         int alpha_flag, void* pIccTransform, FX_BOOL bFill = TRUE);
79         void                            SetClipMask(rasterizer_scanline_aa& rasterizer);
80         void                            SetClipMask(SkPath& skPath, SkPaint* spaint);
81         virtual FX_LPBYTE       GetBuffer() const {return m_pAggDriver->GetBuffer();}
82
83         CFX_AggDeviceDriver* m_pAggDriver;
84 };
85 #endif 
86 #endif// _FX_SKIA_DEVICE_DRIVER_