OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 CORE_FXGE_CFX_RENDERDEVICE_H_ | 7 #ifndef CORE_FXGE_CFX_RENDERDEVICE_H_ |
8 #define CORE_FXGE_CFX_RENDERDEVICE_H_ | 8 #define CORE_FXGE_CFX_RENDERDEVICE_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 void RestoreState(bool bKeepSaved); | 95 void RestoreState(bool bKeepSaved); |
96 | 96 |
97 int GetWidth() const { return m_Width; } | 97 int GetWidth() const { return m_Width; } |
98 int GetHeight() const { return m_Height; } | 98 int GetHeight() const { return m_Height; } |
99 int GetDeviceClass() const { return m_DeviceClass; } | 99 int GetDeviceClass() const { return m_DeviceClass; } |
100 int GetRenderCaps() const { return m_RenderCaps; } | 100 int GetRenderCaps() const { return m_RenderCaps; } |
101 int GetDeviceCaps(int id) const; | 101 int GetDeviceCaps(int id) const; |
102 CFX_Matrix GetCTM() const; | 102 CFX_Matrix GetCTM() const; |
103 CFX_DIBitmap* GetBitmap() const { return m_pBitmap; } | 103 CFX_DIBitmap* GetBitmap() const { return m_pBitmap; } |
104 void SetBitmap(CFX_DIBitmap* pBitmap) { m_pBitmap = pBitmap; } | 104 void SetBitmap(CFX_DIBitmap* pBitmap) { m_pBitmap = pBitmap; } |
105 FX_BOOL CreateCompatibleBitmap(CFX_DIBitmap* pDIB, | 105 bool CreateCompatibleBitmap(CFX_DIBitmap* pDIB, int width, int height) const; |
106 int width, | |
107 int height) const; | |
108 const FX_RECT& GetClipBox() const { return m_ClipBox; } | 106 const FX_RECT& GetClipBox() const { return m_ClipBox; } |
109 FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, | 107 bool SetClip_PathFill(const CFX_PathData* pPathData, |
110 const CFX_Matrix* pObject2Device, | 108 const CFX_Matrix* pObject2Device, |
111 int fill_mode); | 109 int fill_mode); |
112 FX_BOOL SetClip_Rect(const FX_RECT& pRect); | 110 bool SetClip_Rect(const FX_RECT& pRect); |
113 FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, | 111 bool SetClip_PathStroke(const CFX_PathData* pPathData, |
114 const CFX_Matrix* pObject2Device, | 112 const CFX_Matrix* pObject2Device, |
115 const CFX_GraphStateData* pGraphState); | 113 const CFX_GraphStateData* pGraphState); |
116 FX_BOOL DrawPath(const CFX_PathData* pPathData, | 114 bool DrawPath(const CFX_PathData* pPathData, |
117 const CFX_Matrix* pObject2Device, | 115 const CFX_Matrix* pObject2Device, |
118 const CFX_GraphStateData* pGraphState, | 116 const CFX_GraphStateData* pGraphState, |
119 uint32_t fill_color, | 117 uint32_t fill_color, |
120 uint32_t stroke_color, | 118 uint32_t stroke_color, |
121 int fill_mode) { | 119 int fill_mode) { |
122 return DrawPathWithBlend(pPathData, pObject2Device, pGraphState, fill_color, | 120 return DrawPathWithBlend(pPathData, pObject2Device, pGraphState, fill_color, |
123 stroke_color, fill_mode, FXDIB_BLEND_NORMAL); | 121 stroke_color, fill_mode, FXDIB_BLEND_NORMAL); |
124 } | 122 } |
125 FX_BOOL DrawPathWithBlend(const CFX_PathData* pPathData, | 123 bool DrawPathWithBlend(const CFX_PathData* pPathData, |
126 const CFX_Matrix* pObject2Device, | 124 const CFX_Matrix* pObject2Device, |
127 const CFX_GraphStateData* pGraphState, | 125 const CFX_GraphStateData* pGraphState, |
128 uint32_t fill_color, | 126 uint32_t fill_color, |
129 uint32_t stroke_color, | 127 uint32_t stroke_color, |
130 int fill_mode, | 128 int fill_mode, |
131 int blend_type); | 129 int blend_type); |
132 FX_BOOL SetPixel(int x, int y, uint32_t color); | 130 bool SetPixel(int x, int y, uint32_t color); |
133 FX_BOOL FillRect(const FX_RECT* pRect, uint32_t color) { | 131 bool FillRect(const FX_RECT* pRect, uint32_t color) { |
134 return FillRectWithBlend(pRect, color, FXDIB_BLEND_NORMAL); | 132 return FillRectWithBlend(pRect, color, FXDIB_BLEND_NORMAL); |
135 } | 133 } |
136 FX_BOOL FillRectWithBlend(const FX_RECT* pRect, | 134 bool FillRectWithBlend(const FX_RECT* pRect, uint32_t color, int blend_type); |
137 uint32_t color, | 135 bool DrawCosmeticLine(FX_FLOAT x1, |
138 int blend_type); | 136 FX_FLOAT y1, |
139 FX_BOOL DrawCosmeticLine(FX_FLOAT x1, | 137 FX_FLOAT x2, |
140 FX_FLOAT y1, | 138 FX_FLOAT y2, |
141 FX_FLOAT x2, | 139 uint32_t color, |
142 FX_FLOAT y2, | 140 int fill_mode, |
143 uint32_t color, | 141 int blend_type); |
144 int fill_mode, | |
145 int blend_type); | |
146 | 142 |
147 FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top); | 143 bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top); |
148 CFX_DIBitmap* GetBackDrop(); | 144 CFX_DIBitmap* GetBackDrop(); |
149 FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, int left, int top) { | 145 bool SetDIBits(const CFX_DIBSource* pBitmap, int left, int top) { |
150 return SetDIBitsWithBlend(pBitmap, left, top, FXDIB_BLEND_NORMAL); | 146 return SetDIBitsWithBlend(pBitmap, left, top, FXDIB_BLEND_NORMAL); |
151 } | 147 } |
152 FX_BOOL SetDIBitsWithBlend(const CFX_DIBSource* pBitmap, | 148 bool SetDIBitsWithBlend(const CFX_DIBSource* pBitmap, |
153 int left, | 149 int left, |
154 int top, | 150 int top, |
155 int blend_type); | 151 int blend_type); |
156 FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, | 152 bool StretchDIBits(const CFX_DIBSource* pBitmap, |
157 int left, | 153 int left, |
158 int top, | 154 int top, |
159 int dest_width, | 155 int dest_width, |
160 int dest_height) { | 156 int dest_height) { |
161 return StretchDIBitsWithFlagsAndBlend(pBitmap, left, top, dest_width, | 157 return StretchDIBitsWithFlagsAndBlend(pBitmap, left, top, dest_width, |
162 dest_height, 0, FXDIB_BLEND_NORMAL); | 158 dest_height, 0, FXDIB_BLEND_NORMAL); |
163 } | 159 } |
164 FX_BOOL StretchDIBitsWithFlagsAndBlend(const CFX_DIBSource* pBitmap, | 160 bool StretchDIBitsWithFlagsAndBlend(const CFX_DIBSource* pBitmap, |
165 int left, | 161 int left, |
166 int top, | 162 int top, |
167 int dest_width, | 163 int dest_width, |
168 int dest_height, | 164 int dest_height, |
169 uint32_t flags, | 165 uint32_t flags, |
170 int blend_type); | 166 int blend_type); |
171 FX_BOOL SetBitMask(const CFX_DIBSource* pBitmap, | 167 bool SetBitMask(const CFX_DIBSource* pBitmap, |
172 int left, | 168 int left, |
173 int top, | 169 int top, |
174 uint32_t color); | 170 uint32_t color); |
175 FX_BOOL StretchBitMask(const CFX_DIBSource* pBitmap, | 171 bool StretchBitMask(const CFX_DIBSource* pBitmap, |
176 int left, | 172 int left, |
177 int top, | 173 int top, |
178 int dest_width, | 174 int dest_width, |
179 int dest_height, | 175 int dest_height, |
180 uint32_t color); | 176 uint32_t color); |
181 FX_BOOL StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap, | 177 bool StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap, |
182 int left, | 178 int left, |
183 int top, | 179 int top, |
184 int dest_width, | 180 int dest_width, |
185 int dest_height, | 181 int dest_height, |
186 uint32_t color, | 182 uint32_t color, |
187 uint32_t flags); | 183 uint32_t flags); |
188 FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, | 184 bool StartDIBits(const CFX_DIBSource* pBitmap, |
189 int bitmap_alpha, | 185 int bitmap_alpha, |
190 uint32_t color, | 186 uint32_t color, |
191 const CFX_Matrix* pMatrix, | 187 const CFX_Matrix* pMatrix, |
192 uint32_t flags, | 188 uint32_t flags, |
193 void*& handle) { | 189 void*& handle) { |
194 return StartDIBitsWithBlend(pBitmap, bitmap_alpha, color, pMatrix, flags, | 190 return StartDIBitsWithBlend(pBitmap, bitmap_alpha, color, pMatrix, flags, |
195 handle, FXDIB_BLEND_NORMAL); | 191 handle, FXDIB_BLEND_NORMAL); |
196 } | 192 } |
197 FX_BOOL StartDIBitsWithBlend(const CFX_DIBSource* pBitmap, | 193 bool StartDIBitsWithBlend(const CFX_DIBSource* pBitmap, |
198 int bitmap_alpha, | 194 int bitmap_alpha, |
199 uint32_t color, | 195 uint32_t color, |
200 const CFX_Matrix* pMatrix, | 196 const CFX_Matrix* pMatrix, |
201 uint32_t flags, | 197 uint32_t flags, |
202 void*& handle, | 198 void*& handle, |
203 int blend_type); | 199 int blend_type); |
204 FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause); | 200 bool ContinueDIBits(void* handle, IFX_Pause* pPause); |
205 void CancelDIBits(void* handle); | 201 void CancelDIBits(void* handle); |
206 | 202 |
207 FX_BOOL DrawNormalText(int nChars, | 203 bool DrawNormalText(int nChars, |
208 const FXTEXT_CHARPOS* pCharPos, | 204 const FXTEXT_CHARPOS* pCharPos, |
209 CFX_Font* pFont, | 205 CFX_Font* pFont, |
210 FX_FLOAT font_size, | 206 FX_FLOAT font_size, |
211 const CFX_Matrix* pText2Device, | 207 const CFX_Matrix* pText2Device, |
212 uint32_t fill_color, | 208 uint32_t fill_color, |
213 uint32_t text_flags); | 209 uint32_t text_flags); |
214 FX_BOOL DrawTextPath(int nChars, | 210 bool DrawTextPath(int nChars, |
215 const FXTEXT_CHARPOS* pCharPos, | 211 const FXTEXT_CHARPOS* pCharPos, |
216 CFX_Font* pFont, | 212 CFX_Font* pFont, |
217 FX_FLOAT font_size, | 213 FX_FLOAT font_size, |
218 const CFX_Matrix* pText2User, | 214 const CFX_Matrix* pText2User, |
219 const CFX_Matrix* pUser2Device, | 215 const CFX_Matrix* pUser2Device, |
220 const CFX_GraphStateData* pGraphState, | 216 const CFX_GraphStateData* pGraphState, |
221 uint32_t fill_color, | 217 uint32_t fill_color, |
222 uint32_t stroke_color, | 218 uint32_t stroke_color, |
223 CFX_PathData* pClippingPath, | 219 CFX_PathData* pClippingPath, |
224 int nFlag); | 220 int nFlag); |
225 | 221 |
226 #ifdef _SKIA_SUPPORT_ | 222 #ifdef _SKIA_SUPPORT_ |
227 virtual void DebugVerifyBitmapIsPreMultiplied() const; | 223 virtual void DebugVerifyBitmapIsPreMultiplied() const; |
228 virtual bool SetBitsWithMask(const CFX_DIBSource* pBitmap, | 224 virtual bool SetBitsWithMask(const CFX_DIBSource* pBitmap, |
229 const CFX_DIBSource* pMask, | 225 const CFX_DIBSource* pMask, |
230 int left, | 226 int left, |
231 int top, | 227 int top, |
232 int bitmap_alpha, | 228 int bitmap_alpha, |
233 int blend_type); | 229 int blend_type); |
234 void Flush(); | 230 void Flush(); |
235 #endif | 231 #endif |
236 | 232 |
237 private: | 233 private: |
238 void InitDeviceInfo(); | 234 void InitDeviceInfo(); |
239 void UpdateClipBox(); | 235 void UpdateClipBox(); |
240 FX_BOOL DrawFillStrokePath(const CFX_PathData* pPathData, | 236 bool DrawFillStrokePath(const CFX_PathData* pPathData, |
241 const CFX_Matrix* pObject2Device, | 237 const CFX_Matrix* pObject2Device, |
242 const CFX_GraphStateData* pGraphState, | 238 const CFX_GraphStateData* pGraphState, |
243 uint32_t fill_color, | 239 uint32_t fill_color, |
244 uint32_t stroke_color, | 240 uint32_t stroke_color, |
245 int fill_mode, | 241 int fill_mode, |
246 int blend_type); | 242 int blend_type); |
247 | 243 |
248 CFX_DIBitmap* m_pBitmap; | 244 CFX_DIBitmap* m_pBitmap; |
249 int m_Width; | 245 int m_Width; |
250 int m_Height; | 246 int m_Height; |
251 int m_bpp; | 247 int m_bpp; |
252 int m_RenderCaps; | 248 int m_RenderCaps; |
253 int m_DeviceClass; | 249 int m_DeviceClass; |
254 FX_RECT m_ClipBox; | 250 FX_RECT m_ClipBox; |
255 std::unique_ptr<IFX_RenderDeviceDriver> m_pDeviceDriver; | 251 std::unique_ptr<IFX_RenderDeviceDriver> m_pDeviceDriver; |
256 }; | 252 }; |
257 | 253 |
258 #endif // CORE_FXGE_CFX_RENDERDEVICE_H_ | 254 #endif // CORE_FXGE_CFX_RENDERDEVICE_H_ |
OLD | NEW |