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 CORE_SRC_FXGE_SKIA_FX_SKIA_DEVICE_H_ | 5 #ifndef CORE_SRC_FXGE_SKIA_FX_SKIA_DEVICE_H_ |
6 #define CORE_SRC_FXGE_SKIA_FX_SKIA_DEVICE_H_ | 6 #define CORE_SRC_FXGE_SKIA_FX_SKIA_DEVICE_H_ |
7 | 7 |
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 | 20 |
18 » /** Save and restore all graphic states */ | 21 /** Save and restore all graphic states */ |
19 » virtual void» » SaveState(); | 22 virtual void SaveState(); |
20 » virtual void» » RestoreState(FX_BOOL bKeepSaved); | 23 virtual void RestoreState(FX_BOOL bKeepSaved); |
21 | 24 |
22 » /** Set clipping path using filled region */ | 25 /** Set clipping path using filled region */ |
23 » virtual FX_BOOL»» SetClip_PathFill(const CFX_PathData* pPathData,»
// path info | 26 virtual FX_BOOL SetClip_PathFill( |
24 » » » » » » » const CFX_AffineMatrix*
pObject2Device,»// optional transformation | 27 const CFX_PathData* pPathData, // path info |
25 » » » » » » » int fill_mode» // fill
mode, WINDING or ALTERNATE | 28 const CFX_AffineMatrix* pObject2Device, // optional transformation |
26 » » » » » » » ); | 29 int fill_mode // fill mode, WINDING or ALTERNATE |
| 30 ); |
27 | 31 |
28 » /** Set clipping path using stroked region */ | 32 /** Set clipping path using stroked region */ |
29 » virtual FX_BOOL»» SetClip_PathStroke(const CFX_PathData* pPathData
,» // path info | 33 virtual FX_BOOL SetClip_PathStroke( |
30 » » » » » » » const CFX_AffineMatrix*
pObject2Device,»// optional transformation | 34 const CFX_PathData* pPathData, // path info |
31 » » » » » » » const CFX_GraphStateData
* pGraphState» // graphic state, for pen attributes | 35 const CFX_AffineMatrix* pObject2Device, // optional transformation |
32 » » » » » » » ); | 36 const CFX_GraphStateData* |
| 37 pGraphState // graphic state, for pen attributes |
| 38 ); |
33 | 39 |
34 » /** Draw a path */ | 40 /** Draw a path */ |
35 » virtual FX_BOOL»» DrawPath(const CFX_PathData* pPathData, | 41 virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, |
36 » » » » » » const CFX_AffineMatrix* pObject2
Device, | 42 const CFX_AffineMatrix* pObject2Device, |
37 » » » » » » const CFX_GraphStateData* pGraph
State, | 43 const CFX_GraphStateData* pGraphState, |
38 » » » » » » FX_DWORD fill_color, | 44 FX_DWORD fill_color, |
39 » » » » » » FX_DWORD stroke_color, | 45 FX_DWORD stroke_color, |
40 » » » » » » int fill_mode, | 46 int fill_mode, |
41 » » » » » » int alpha_flag = 0, | 47 int alpha_flag = 0, |
42 » » » » » » void* pIccTransform = NULL | 48 void* pIccTransform = NULL); |
43 » » » » » » » ); | |
44 | 49 |
45 » virtual FX_BOOL»» SetPixel(int x, int y, FX_DWORD color, | 50 virtual FX_BOOL SetPixel(int x, |
46 » » » » » » int alpha_flag = 0, void* pIccTr
ansform = NULL); | 51 int y, |
| 52 FX_DWORD color, |
| 53 int alpha_flag = 0, |
| 54 void* pIccTransform = NULL); |
47 | 55 |
48 » virtual FX_BOOL»» FillRect(const FX_RECT* pRect, FX_DWORD fill_col
or, | 56 virtual FX_BOOL FillRect(const FX_RECT* pRect, |
49 » » » » » » int alpha_flag = 0, void* pIccTr
ansform = NULL); | 57 FX_DWORD fill_color, |
| 58 int alpha_flag = 0, |
| 59 void* pIccTransform = NULL); |
50 | 60 |
51 » /** Draw a single pixel (device dependant) line */ | 61 /** 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, | 62 virtual FX_BOOL DrawCosmeticLine(FX_FIXFLOAT x1, |
53 » » » » » » » int alpha_flag, void* pI
ccTransform, int blend_type) { return FALSE; } | 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 } |
54 | 72 |
55 » virtual FX_BOOL»» GetClipBox(FX_RECT* pRect); | 73 virtual FX_BOOL GetClipBox(FX_RECT* pRect); |
56 | 74 |
57 » /** Load device buffer into a DIB */ | 75 /** 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); | 76 virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, |
| 77 int left, |
| 78 int top, |
| 79 void* pIccTransform = NULL, |
| 80 FX_BOOL bDEdge = FALSE); |
59 | 81 |
60 » virtual CFX_DIBitmap* GetBackDrop() { return m_pAggDriver->GetBackDrop
(); } | 82 virtual CFX_DIBitmap* GetBackDrop() { return m_pAggDriver->GetBackDrop(); } |
61 | 83 |
62 » virtual FX_BOOL»» SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD
color, const FX_RECT* pSrcRect, | 84 virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, |
63 » » » » » » int dest_left, int dest_top, int
blend_type, | 85 FX_DWORD color, |
64 » » » » » » int alpha_flag = 0, void* pIccTr
ansform = NULL); | 86 const FX_RECT* pSrcRect, |
65 » virtual FX_BOOL»» StretchDIBits(const CFX_DIBSource* pBitmap, FX_D
WORD color, int dest_left, int dest_top, | 87 int dest_left, |
66 » » » » int dest_width, int dest_height, const FX_RECT*
pClipRect, FX_DWORD flags, | 88 int dest_top, |
67 » » » » int alpha_flag = 0, void* pIccTransform = NULL); | 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); |
68 | 102 |
69 » virtual FX_BOOL»» StartDIBits(const CFX_DIBSource* pBitmap, int bi
tmap_alpha, FX_DWORD color, | 103 virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, |
70 » » » » const CFX_AffineMatrix* pMatrix, FX_DWORD flags,
void*& handle, | 104 int bitmap_alpha, |
71 » » » » int alpha_flag = 0, void* pIccTransform = NULL); | 105 FX_DWORD color, |
72 » virtual FX_BOOL»» ContinueDIBits(void* handle, IFX_Pause* pPause); | 106 const CFX_AffineMatrix* pMatrix, |
73 » virtual void» » CancelDIBits(void* handle); | 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); |
74 | 113 |
75 » virtual FX_BOOL DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCh
arPos, CFX_Font* pFont, | 114 virtual FX_BOOL DrawDeviceText(int nChars, |
76 » » » » » » CFX_FontCache* pCache, const CFX
_AffineMatrix* pObject2Device, FX_FIXFLOAT font_size, FX_DWORD color, | 115 const FXTEXT_CHARPOS* pCharPos, |
77 » » » » » » int alpha_flag = 0, void* pIccTr
ansform = NULL); | 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); |
78 | 123 |
79 » virtual FX_BOOL»» RenderRasterizer(rasterizer_scanline_aa& rasteri
zer, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bGroupKnockout, | 124 virtual FX_BOOL RenderRasterizer(rasterizer_scanline_aa& rasterizer, |
80 » » » » » » » int alpha_flag, void* pI
ccTransform); | 125 FX_DWORD color, |
81 » virtual FX_BOOL»» RenderRasterizerSkia(SkPath& skPath, const SkPai
nt& origPaint, SkIRect& rect, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bGroup
Knockout, | 126 FX_BOOL bFullCover, |
82 » » » » » » » int alpha_flag, void* pI
ccTransform, FX_BOOL bFill = TRUE); | 127 FX_BOOL bGroupKnockout, |
83 » void» » » » SetClipMask(rasterizer_scanline_aa& rast
erizer); | 128 int alpha_flag, |
84 » void» » » » SetClipMask(SkPath& skPath, SkPaint* spa
int); | 129 void* pIccTransform); |
85 » virtual»uint8_t*» GetBuffer() const {return m_pAggDriver->GetBuffe
r();} | 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(); } |
86 | 142 |
87 » CFX_AggDeviceDriver* m_pAggDriver; | 143 CFX_AggDeviceDriver* m_pAggDriver; |
88 }; | 144 }; |
89 #endif // defined(_SKIA_SUPPORT_) | 145 #endif // defined(_SKIA_SUPPORT_) |
90 | 146 |
91 #endif // CORE_SRC_FXGE_SKIA_FX_SKIA_DEVICE_H_ | 147 #endif // CORE_SRC_FXGE_SKIA_FX_SKIA_DEVICE_H_ |
OLD | NEW |