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 #include "core/include/fxge/fx_ge.h" | 7 #include "core/include/fxge/fx_ge.h" |
8 | 8 |
9 CFX_RenderDevice::CFX_RenderDevice() { | 9 CFX_RenderDevice::CFX_RenderDevice() { |
10 m_pDeviceDriver = NULL; | 10 m_pDeviceDriver = NULL; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 102 } |
103 void CFX_RenderDevice::UpdateClipBox() { | 103 void CFX_RenderDevice::UpdateClipBox() { |
104 if (m_pDeviceDriver->GetClipBox(&m_ClipBox)) { | 104 if (m_pDeviceDriver->GetClipBox(&m_ClipBox)) { |
105 return; | 105 return; |
106 } | 106 } |
107 m_ClipBox.left = 0; | 107 m_ClipBox.left = 0; |
108 m_ClipBox.top = 0; | 108 m_ClipBox.top = 0; |
109 m_ClipBox.right = m_Width; | 109 m_ClipBox.right = m_Width; |
110 m_ClipBox.bottom = m_Height; | 110 m_ClipBox.bottom = m_Height; |
111 } | 111 } |
| 112 |
112 FX_BOOL CFX_RenderDevice::DrawPath(const CFX_PathData* pPathData, | 113 FX_BOOL CFX_RenderDevice::DrawPath(const CFX_PathData* pPathData, |
113 const CFX_Matrix* pObject2Device, | 114 const CFX_Matrix* pObject2Device, |
114 const CFX_GraphStateData* pGraphState, | 115 const CFX_GraphStateData* pGraphState, |
115 FX_DWORD fill_color, | 116 FX_DWORD fill_color, |
116 FX_DWORD stroke_color, | 117 FX_DWORD stroke_color, |
117 int fill_mode, | 118 int fill_mode, |
118 int alpha_flag, | 119 int alpha_flag, |
119 void* pIccTransform, | 120 void* pIccTransform, |
120 int blend_type) { | 121 int blend_type) { |
121 uint8_t fill_alpha, stroke_alpha; | 122 uint8_t fill_alpha, stroke_alpha; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 if (fill_mode & FXFILL_NOPATHSMOOTH) { | 218 if (fill_mode & FXFILL_NOPATHSMOOTH) { |
218 smooth_path |= FXFILL_NOPATHSMOOTH; | 219 smooth_path |= FXFILL_NOPATHSMOOTH; |
219 } | 220 } |
220 m_pDeviceDriver->DrawPath(&newPath, pMatrix, &graphState, 0, strokecolor, | 221 m_pDeviceDriver->DrawPath(&newPath, pMatrix, &graphState, 0, strokecolor, |
221 smooth_path, alpha_flag, pIccTransform, | 222 smooth_path, alpha_flag, pIccTransform, |
222 blend_type); | 223 blend_type); |
223 } | 224 } |
224 } | 225 } |
225 if ((fill_mode & 3) && fill_alpha && stroke_alpha < 0xff && | 226 if ((fill_mode & 3) && fill_alpha && stroke_alpha < 0xff && |
226 (fill_mode & FX_FILL_STROKE)) { | 227 (fill_mode & FX_FILL_STROKE)) { |
| 228 if (m_RenderCaps & FXRC_FILLSTROKE_PATH) { |
| 229 return m_pDeviceDriver->DrawPath(pPathData, pObject2Device, pGraphState, |
| 230 fill_color, stroke_color, fill_mode, |
| 231 alpha_flag, pIccTransform, blend_type); |
| 232 } |
| 233 return DrawFillStrokePath(pPathData, pObject2Device, pGraphState, |
| 234 fill_color, stroke_color, fill_mode, alpha_flag, |
| 235 pIccTransform, blend_type); |
| 236 } |
| 237 return m_pDeviceDriver->DrawPath(pPathData, pObject2Device, pGraphState, |
| 238 fill_color, stroke_color, fill_mode, |
| 239 alpha_flag, pIccTransform, blend_type); |
| 240 } |
| 241 |
| 242 // This can be removed once PDFium entirely relies on Skia |
| 243 FX_BOOL CFX_RenderDevice::DrawFillStrokePath( |
| 244 const CFX_PathData* pPathData, |
| 245 const CFX_Matrix* pObject2Device, |
| 246 const CFX_GraphStateData* pGraphState, |
| 247 FX_DWORD fill_color, |
| 248 FX_DWORD stroke_color, |
| 249 int fill_mode, |
| 250 int alpha_flag, |
| 251 void* pIccTransform, |
| 252 int blend_type) { |
227 if (!(m_RenderCaps & FXRC_GET_BITS)) { | 253 if (!(m_RenderCaps & FXRC_GET_BITS)) { |
228 return FALSE; | 254 return FALSE; |
229 } | 255 } |
230 CFX_FloatRect bbox; | 256 CFX_FloatRect bbox; |
231 if (pGraphState) { | 257 if (pGraphState) { |
232 bbox = pPathData->GetBoundingBox(pGraphState->m_LineWidth, | 258 bbox = pPathData->GetBoundingBox(pGraphState->m_LineWidth, |
233 pGraphState->m_MiterLimit); | 259 pGraphState->m_MiterLimit); |
234 } else { | 260 } else { |
235 bbox = pPathData->GetBoundingBox(); | 261 bbox = pPathData->GetBoundingBox(); |
236 } | 262 } |
(...skipping 28 matching lines...) Expand all Loading... |
265 matrix.Concat(fScaleX, 0, 0, fScaleY, 0, 0); | 291 matrix.Concat(fScaleX, 0, 0, fScaleY, 0, 0); |
266 if (!bitmap_device.GetDeviceDriver()->DrawPath( | 292 if (!bitmap_device.GetDeviceDriver()->DrawPath( |
267 pPathData, &matrix, pGraphState, fill_color, stroke_color, | 293 pPathData, &matrix, pGraphState, fill_color, stroke_color, |
268 fill_mode, alpha_flag, pIccTransform, blend_type)) { | 294 fill_mode, alpha_flag, pIccTransform, blend_type)) { |
269 return FALSE; | 295 return FALSE; |
270 } | 296 } |
271 FX_RECT src_rect(0, 0, FXSYS_round(rect.Width() * fScaleX), | 297 FX_RECT src_rect(0, 0, FXSYS_round(rect.Width() * fScaleX), |
272 FXSYS_round(rect.Height() * fScaleY)); | 298 FXSYS_round(rect.Height() * fScaleY)); |
273 return m_pDeviceDriver->SetDIBits(&bitmap, 0, &src_rect, rect.left, | 299 return m_pDeviceDriver->SetDIBits(&bitmap, 0, &src_rect, rect.left, |
274 rect.top, FXDIB_BLEND_NORMAL); | 300 rect.top, FXDIB_BLEND_NORMAL); |
275 } | |
276 return m_pDeviceDriver->DrawPath(pPathData, pObject2Device, pGraphState, | |
277 fill_color, stroke_color, fill_mode, | |
278 alpha_flag, pIccTransform, blend_type); | |
279 } | 301 } |
| 302 |
280 FX_BOOL CFX_RenderDevice::SetPixel(int x, | 303 FX_BOOL CFX_RenderDevice::SetPixel(int x, |
281 int y, | 304 int y, |
282 FX_DWORD color, | 305 FX_DWORD color, |
283 int alpha_flag, | 306 int alpha_flag, |
284 void* pIccTransform) { | 307 void* pIccTransform) { |
285 if (m_pDeviceDriver->SetPixel(x, y, color, alpha_flag, pIccTransform)) { | 308 if (m_pDeviceDriver->SetPixel(x, y, color, alpha_flag, pIccTransform)) { |
286 return TRUE; | 309 return TRUE; |
287 } | 310 } |
288 FX_RECT rect(x, y, x + 1, y + 1); | 311 FX_RECT rect(x, y, x + 1, y + 1); |
289 return FillRect(&rect, color, alpha_flag, pIccTransform); | 312 return FillRect(&rect, color, alpha_flag, pIccTransform); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 return m_pDeviceDriver->StartDIBits(pBitmap, bitmap_alpha, argb, pMatrix, | 488 return m_pDeviceDriver->StartDIBits(pBitmap, bitmap_alpha, argb, pMatrix, |
466 flags, handle, alpha_flag, pIccTransform, | 489 flags, handle, alpha_flag, pIccTransform, |
467 blend_mode); | 490 blend_mode); |
468 } | 491 } |
469 FX_BOOL CFX_RenderDevice::ContinueDIBits(void* handle, IFX_Pause* pPause) { | 492 FX_BOOL CFX_RenderDevice::ContinueDIBits(void* handle, IFX_Pause* pPause) { |
470 return m_pDeviceDriver->ContinueDIBits(handle, pPause); | 493 return m_pDeviceDriver->ContinueDIBits(handle, pPause); |
471 } | 494 } |
472 void CFX_RenderDevice::CancelDIBits(void* handle) { | 495 void CFX_RenderDevice::CancelDIBits(void* handle) { |
473 m_pDeviceDriver->CancelDIBits(handle); | 496 m_pDeviceDriver->CancelDIBits(handle); |
474 } | 497 } |
OLD | NEW |