OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef _FX_SKIA_DEVICE_DRIVER_ | 5 #ifndef _FX_SKIA_DEVICE_DRIVER_ |
6 #define _FX_SKIA_DEVICE_DRIVER_ | 6 #define _FX_SKIA_DEVICE_DRIVER_ |
7 //#define _SKIA_SUPPORT_ | 7 //#define _SKIA_SUPPORT_ |
8 #if defined(_SKIA_SUPPORT_) | 8 #if defined(_SKIA_SUPPORT_) |
9 class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver | 9 class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { |
10 { | 10 public: |
11 public: | 11 CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, |
12 » CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL bRg
bByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout); | 12 int dither_bits, |
13 » virtual ~CFX_SkiaDeviceDriver(); | 13 FX_BOOL bRgbByteOrder, |
| 14 CFX_DIBitmap* pOriDevice, |
| 15 FX_BOOL bGroupKnockout); |
| 16 virtual ~CFX_SkiaDeviceDriver(); |
14 | 17 |
15 » /** Options */ | 18 /** Options */ |
16 » virtual int» » » GetDeviceCaps(int caps_id); | 19 virtual int GetDeviceCaps(int caps_id); |
17 » | |
18 » /** Save and restore all graphic states */ | |
19 » virtual void» » SaveState(); | |
20 » virtual void» » RestoreState(FX_BOOL bKeepSaved); | |
21 » | |
22 » /** Set clipping path using filled region */ | |
23 » virtual FX_BOOL»» SetClip_PathFill(const CFX_PathData* pPathData,»
// path info | |
24 » » » » » » » const CFX_AffineMatrix*
pObject2Device,»// optional transformation | |
25 » » » » » » » int fill_mode» // fill
mode, WINDING or ALTERNATE | |
26 » » » » » » » ); | |
27 » | |
28 » /** Set clipping path using stroked region */ | |
29 » virtual FX_BOOL»» SetClip_PathStroke(const CFX_PathData* pPathData
,» // path info | |
30 » » » » » » » const CFX_AffineMatrix*
pObject2Device,»// optional transformation | |
31 » » » » » » » const CFX_GraphStateData
* pGraphState» // graphic state, for pen attributes | |
32 » » » » » » » ); | |
33 » | |
34 » /** Draw a path */ | |
35 » virtual FX_BOOL»» DrawPath(const CFX_PathData* pPathData, | |
36 » » » » » » const CFX_AffineMatrix* pObject2
Device, | |
37 » » » » » » const CFX_GraphStateData* pGraph
State, | |
38 » » » » » » FX_DWORD fill_color, | |
39 » » » » » » FX_DWORD stroke_color, | |
40 » » » » » » int fill_mode, | |
41 » » » » » » int alpha_flag = 0, | |
42 » » » » » » void* pIccTransform = NULL | |
43 » » » » » » » ); | |
44 » | |
45 » virtual FX_BOOL»» SetPixel(int x, int y, FX_DWORD color, | |
46 » » » » » » int alpha_flag = 0, void* pIccTr
ansform = NULL); | |
47 » | |
48 » virtual FX_BOOL»» FillRect(const FX_RECT* pRect, FX_DWORD fill_col
or, | |
49 » » » » » » int alpha_flag = 0, void* pIccTr
ansform = NULL); | |
50 » | |
51 » /** Draw a single pixel (device dependant) line */ | |
52 » virtual FX_BOOL»» DrawCosmeticLine(FX_FIXFLOAT x1, FX_FIXFLOAT y1,
FX_FIXFLOAT x2, FX_FIXFLOAT y2, FX_DWORD color, | |
53 » » » » » » » int alpha_flag, void* pI
ccTransform, int blend_type) { return FALSE; } | |
54 » | |
55 » virtual FX_BOOL»» GetClipBox(FX_RECT* pRect); | |
56 » | |
57 » /** Load device buffer into a DIB */ | |
58 » virtual FX_BOOL»» GetDIBits(CFX_DIBitmap* pBitmap, int left, int t
op, void* pIccTransform = NULL, FX_BOOL bDEdge = FALSE); | |
59 | 20 |
60 » virtual CFX_DIBitmap* GetBackDrop() { return m_pAggDriver->GetBackDrop
(); } | 21 /** Save and restore all graphic states */ |
61 » | 22 virtual void SaveState(); |
62 » virtual FX_BOOL»» SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD
color, const FX_RECT* pSrcRect, | 23 virtual void RestoreState(FX_BOOL bKeepSaved); |
63 » » » » » » int dest_left, int dest_top, int
blend_type, | |
64 » » » » » » int alpha_flag = 0, void* pIccTr
ansform = NULL); | |
65 » virtual FX_BOOL»» StretchDIBits(const CFX_DIBSource* pBitmap, FX_D
WORD color, int dest_left, int dest_top, | |
66 » » » » int dest_width, int dest_height, const FX_RECT*
pClipRect, FX_DWORD flags, | |
67 » » » » int alpha_flag = 0, void* pIccTransform = NULL); | |
68 » | |
69 » virtual FX_BOOL»» StartDIBits(const CFX_DIBSource* pBitmap, int bi
tmap_alpha, FX_DWORD color, | |
70 » » » » const CFX_AffineMatrix* pMatrix, FX_DWORD flags,
FX_LPVOID& handle, | |
71 » » » » int alpha_flag = 0, void* pIccTransform = NULL); | |
72 » virtual FX_BOOL»» ContinueDIBits(FX_LPVOID handle, IFX_Pause* pPau
se); | |
73 » virtual void» » CancelDIBits(FX_LPVOID handle); | |
74 » | |
75 » virtual FX_BOOL DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCh
arPos, CFX_Font* pFont, | |
76 » » » » » » CFX_FontCache* pCache, const CFX
_AffineMatrix* pObject2Device, FX_FIXFLOAT font_size, FX_DWORD color, | |
77 » » » » » » int alpha_flag = 0, void* pIccTr
ansform = NULL); | |
78 » | |
79 » virtual FX_BOOL»» RenderRasterizer(rasterizer_scanline_aa& rasteri
zer, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bGroupKnockout, | |
80 » » » » » » » int alpha_flag, void* pI
ccTransform); | |
81 » virtual FX_BOOL»» RenderRasterizerSkia(SkPath& skPath, const SkPai
nt& origPaint, SkIRect& rect, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bGroup
Knockout, | |
82 » » » » » » » int alpha_flag, void* pI
ccTransform, FX_BOOL bFill = TRUE); | |
83 » void» » » » SetClipMask(rasterizer_scanline_aa& rast
erizer); | |
84 » void» » » » SetClipMask(SkPath& skPath, SkPaint* spa
int); | |
85 » virtual»FX_LPBYTE» GetBuffer() const {return m_pAggDriver->GetBuffe
r();} | |
86 | 24 |
87 » CFX_AggDeviceDriver* m_pAggDriver; | 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 FX_LPVOID& handle, |
| 109 int alpha_flag = 0, |
| 110 void* pIccTransform = NULL); |
| 111 virtual FX_BOOL ContinueDIBits(FX_LPVOID handle, IFX_Pause* pPause); |
| 112 virtual void CancelDIBits(FX_LPVOID 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 FX_LPBYTE GetBuffer() const { return m_pAggDriver->GetBuffer(); } |
| 142 |
| 143 CFX_AggDeviceDriver* m_pAggDriver; |
88 }; | 144 }; |
89 #endif | 145 #endif |
90 #endif// _FX_SKIA_DEVICE_DRIVER_ | 146 #endif // _FX_SKIA_DEVICE_DRIVER_ |
OLD | NEW |