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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef FX_AGG_DRIVER_H_ | 7 #ifndef FX_AGG_DRIVER_H_ |
8 #define FX_AGG_DRIVER_H_ | 8 #define FX_AGG_DRIVER_H_ |
9 | 9 |
10 #include "../../../../../third_party/agg23/agg_clip_liang_barsky.h" | 10 #include "../../../../../third_party/agg23/agg_clip_liang_barsky.h" |
11 #include "../../../../../third_party/agg23/agg_path_storage.h" | 11 #include "../../../../../third_party/agg23/agg_path_storage.h" |
12 #include "../../../../../third_party/agg23/agg_rasterizer_scanline_aa.h" | 12 #include "../../../../../third_party/agg23/agg_rasterizer_scanline_aa.h" |
13 | 13 |
14 class CAgg_PathData | 14 class CAgg_PathData { |
15 { | 15 public: |
16 public: | 16 CAgg_PathData() {} |
17 CAgg_PathData() {} | 17 ~CAgg_PathData() {} |
18 ~CAgg_PathData() {} | 18 FX_NAMESPACE_DECLARE(agg, path_storage) m_PathData; |
19 FX_NAMESPACE_DECLARE(agg, path_storage)» m_PathData; | 19 void BuildPath(const CFX_PathData* pPathData, |
20 void» » » BuildPath(const CFX_PathData* pPathData, const C
FX_AffineMatrix* pObject2Device); | 20 const CFX_AffineMatrix* pObject2Device); |
21 }; | 21 }; |
22 class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver | 22 class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver { |
23 { | 23 public: |
24 public: | 24 CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, |
25 CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL bRgbByte
Order, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout); | 25 int dither_bits, |
26 virtual ~CFX_AggDeviceDriver(); | 26 FX_BOOL bRgbByteOrder, |
27 void» » » » InitPlatform(); | 27 CFX_DIBitmap* pOriDevice, |
28 void» » » » DestroyPlatform(); | 28 FX_BOOL bGroupKnockout); |
| 29 virtual ~CFX_AggDeviceDriver(); |
| 30 void InitPlatform(); |
| 31 void DestroyPlatform(); |
29 | 32 |
| 33 virtual int GetDeviceCaps(int caps_id); |
30 | 34 |
31 virtual int»» » GetDeviceCaps(int caps_id); | 35 virtual void SaveState(); |
| 36 virtual void RestoreState(FX_BOOL bKeepSaved); |
32 | 37 |
| 38 virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, |
| 39 const CFX_AffineMatrix* pObject2Device, |
| 40 int fill_mode); |
33 | 41 |
34 virtual void» » SaveState(); | 42 virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, |
35 virtual void» » RestoreState(FX_BOOL bKeepSaved); | 43 const CFX_AffineMatrix* pObject2Device, |
| 44 const CFX_GraphStateData* pGraphState); |
36 | 45 |
| 46 virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, |
| 47 const CFX_AffineMatrix* pObject2Device, |
| 48 const CFX_GraphStateData* pGraphState, |
| 49 FX_DWORD fill_color, |
| 50 FX_DWORD stroke_color, |
| 51 int fill_mode, |
| 52 int alpha_flag, |
| 53 void* pIccTransform, |
| 54 int blend_type); |
37 | 55 |
38 virtual FX_BOOL» » SetClip_PathFill(const CFX_PathData* pPathData, | 56 virtual FX_BOOL SetPixel(int x, |
39 const CFX_AffineMatrix* pObject2Device, | 57 int y, |
40 int fill_mode | 58 FX_DWORD color, |
41 ); | 59 int alpha_flag, |
| 60 void* pIccTransform); |
42 | 61 |
| 62 virtual FX_BOOL FillRect(const FX_RECT* pRect, |
| 63 FX_DWORD fill_color, |
| 64 int alpha_flag, |
| 65 void* pIccTransform, |
| 66 int blend_type); |
43 | 67 |
44 virtual FX_BOOL» » SetClip_PathStroke(const CFX_PathData* pPathData
, | 68 virtual FX_BOOL DrawCosmeticLine(FX_FLOAT x1, |
45 const CFX_AffineMatrix* pObject2Devic
e, | 69 FX_FLOAT y1, |
46 const CFX_GraphStateData* pGraphState | 70 FX_FLOAT x2, |
47 ); | 71 FX_FLOAT y2, |
| 72 FX_DWORD color, |
| 73 int alpha_flag, |
| 74 void* pIccTransform, |
| 75 int blend_type) { |
| 76 return FALSE; |
| 77 } |
48 | 78 |
| 79 virtual FX_BOOL GetClipBox(FX_RECT* pRect); |
49 | 80 |
50 virtual FX_BOOL» » DrawPath(const CFX_PathData* pPathData, | 81 virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, |
| 82 int left, |
| 83 int top, |
| 84 void* pIccTransform = NULL, |
| 85 FX_BOOL bDEdge = FALSE); |
| 86 virtual CFX_DIBitmap* GetBackDrop() { return m_pOriDevice; } |
| 87 |
| 88 virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, |
| 89 FX_DWORD color, |
| 90 const FX_RECT* pSrcRect, |
| 91 int left, |
| 92 int top, |
| 93 int blend_type, |
| 94 int alpha_flag, |
| 95 void* pIccTransform); |
| 96 virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, |
| 97 FX_DWORD color, |
| 98 int dest_left, |
| 99 int dest_top, |
| 100 int dest_width, |
| 101 int dest_height, |
| 102 const FX_RECT* pClipRect, |
| 103 FX_DWORD flags, |
| 104 int alpha_flag, |
| 105 void* pIccTransform, |
| 106 int blend_type); |
| 107 |
| 108 virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, |
| 109 int bitmap_alpha, |
| 110 FX_DWORD color, |
| 111 const CFX_AffineMatrix* pMatrix, |
| 112 FX_DWORD flags, |
| 113 void*& handle, |
| 114 int alpha_flag, |
| 115 void* pIccTransform, |
| 116 int blend_type); |
| 117 virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause); |
| 118 virtual void CancelDIBits(void* handle); |
| 119 |
| 120 virtual FX_BOOL DrawDeviceText(int nChars, |
| 121 const FXTEXT_CHARPOS* pCharPos, |
| 122 CFX_Font* pFont, |
| 123 CFX_FontCache* pCache, |
51 const CFX_AffineMatrix* pObject2Device, | 124 const CFX_AffineMatrix* pObject2Device, |
52 const CFX_GraphStateData* pGraphState, | 125 FX_FLOAT font_size, |
53 FX_DWORD fill_color, | 126 FX_DWORD color, |
54 FX_DWORD stroke_color, | |
55 int fill_mode, | |
56 int alpha_flag, | 127 int alpha_flag, |
57 void* pIccTransform, | 128 void* pIccTransform); |
58 int blend_type | 129 virtual FX_BOOL RenderRasterizer( |
59 ); | 130 FX_NAMESPACE_DECLARE(agg, rasterizer_scanline_aa) & rasterizer, |
| 131 FX_DWORD color, |
| 132 FX_BOOL bFullCover, |
| 133 FX_BOOL bGroupKnockout, |
| 134 int alpha_flag, |
| 135 void* pIccTransform); |
60 | 136 |
61 virtual FX_BOOL» » SetPixel(int x, int y, FX_DWORD color, | 137 void SetClipMask(FX_NAMESPACE_DECLARE(agg, rasterizer_scanline_aa) & |
62 int alpha_flag, void* pIccTransform); | 138 rasterizer); |
63 | 139 |
64 virtual FX_BOOL» » FillRect(const FX_RECT* pRect, | 140 virtual uint8_t* GetBuffer() const { return m_pBitmap->GetBuffer(); } |
65 FX_DWORD fill_color, int alpha_flag, void* pIcc
Transform, int blend_type); | 141 virtual int GetDriverType() { return 1; } |
66 | 142 |
67 | 143 CFX_DIBitmap* m_pBitmap; |
68 virtual FX_BOOL» » DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FL
OAT x2, FX_FLOAT y2, FX_DWORD color, | 144 CFX_ClipRgn* m_pClipRgn; |
69 int alpha_flag, void* pIccTransform, in
t blend_type) | 145 CFX_PtrArray m_StateStack; |
70 { | 146 void* m_pPlatformGraphics; |
71 return FALSE; | 147 void* m_pPlatformBitmap; |
72 } | 148 void* m_pDwRenderTartget; |
73 | 149 int m_FillFlags; |
74 virtual FX_BOOL» » GetClipBox(FX_RECT* pRect); | 150 int m_DitherBits; |
75 | 151 FX_BOOL m_bRgbByteOrder; |
76 | 152 CFX_DIBitmap* m_pOriDevice; |
77 virtual FX_BOOL» » GetDIBits(CFX_DIBitmap* pBitmap, int left, int t
op, void* pIccTransform = NULL, FX_BOOL bDEdge = FALSE); | 153 FX_BOOL m_bGroupKnockout; |
78 virtual CFX_DIBitmap* GetBackDrop() | |
79 { | |
80 return m_pOriDevice; | |
81 } | |
82 | |
83 virtual FX_BOOL» » SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD
color, const FX_RECT* pSrcRect, int left, int top, int blend_type, | |
84 int alpha_flag, void* pIccTransform); | |
85 virtual FX_BOOL» » StretchDIBits(const CFX_DIBSource* pBitmap, FX_D
WORD color, int dest_left, int dest_top, | |
86 int dest_width, int dest_height, const FX_
RECT* pClipRect, FX_DWORD flags, | |
87 int alpha_flag, void* pIccTransform, int b
lend_type); | |
88 | |
89 virtual FX_BOOL» » StartDIBits(const CFX_DIBSource* pBitmap, int bi
tmap_alpha, FX_DWORD color, | |
90 const CFX_AffineMatrix* pMatrix, FX_DWORD fl
ags, void*& handle, | |
91 int alpha_flag, void* pIccTransform, int ble
nd_type); | |
92 virtual FX_BOOL» » ContinueDIBits(void* handle, IFX_Pause* pPause); | |
93 virtual void» » CancelDIBits(void* handle); | |
94 | |
95 virtual FX_BOOL DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPo
s, CFX_Font* pFont, | |
96 CFX_FontCache* pCache, const CFX_AffineMa
trix* pObject2Device, FX_FLOAT font_size, FX_DWORD color, | |
97 int alpha_flag, void* pIccTransform); | |
98 virtual FX_BOOL» » RenderRasterizer(FX_NAMESPACE_DECLARE(agg, raste
rizer_scanline_aa)& rasterizer, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bGro
upKnockout, | |
99 int alpha_flag, void* pIccTransform); | |
100 | |
101 void» » » » SetClipMask(FX_NAMESPACE_DECLARE(agg, ra
sterizer_scanline_aa)& rasterizer); | |
102 | |
103 virtual» uint8_t*» GetBuffer() const | |
104 { | |
105 return m_pBitmap->GetBuffer(); | |
106 } | |
107 virtual int»» » GetDriverType() | |
108 { | |
109 return 1; | |
110 } | |
111 | |
112 CFX_DIBitmap*» » m_pBitmap; | |
113 CFX_ClipRgn*» » m_pClipRgn; | |
114 CFX_PtrArray» » m_StateStack; | |
115 void*» » » » m_pPlatformGraphics; | |
116 void*» » » » m_pPlatformBitmap; | |
117 void*» » » » m_pDwRenderTartget; | |
118 int»» » » » m_FillFlags; | |
119 int»» » » » m_DitherBits; | |
120 FX_BOOL» » » » m_bRgbByteOrder; | |
121 CFX_DIBitmap* m_pOriDevice; | |
122 FX_BOOL m_bGroupKnockout; | |
123 }; | 154 }; |
124 | 155 |
125 #endif // FX_AGG_DRIVER_H_ | 156 #endif // FX_AGG_DRIVER_H_ |
OLD | NEW |