| 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/fxge/include/fx_ge.h" | 7 #include "core/fxge/include/fx_ge.h" |
| 8 | 8 |
| 9 CFX_RenderDevice::CFX_RenderDevice() { | 9 CFX_RenderDevice::CFX_RenderDevice() { |
| 10 m_pDeviceDriver = NULL; | 10 m_pDeviceDriver = nullptr; |
| 11 m_pBitmap = NULL; | 11 m_pBitmap = nullptr; |
| 12 } | 12 } |
| 13 CFX_RenderDevice::~CFX_RenderDevice() { | 13 CFX_RenderDevice::~CFX_RenderDevice() { |
| 14 delete m_pDeviceDriver; | 14 delete m_pDeviceDriver; |
| 15 } | 15 } |
| 16 void CFX_RenderDevice::SetDeviceDriver(IFX_RenderDeviceDriver* pDriver) { | 16 void CFX_RenderDevice::SetDeviceDriver(IFX_RenderDeviceDriver* pDriver) { |
| 17 delete m_pDeviceDriver; | 17 delete m_pDeviceDriver; |
| 18 m_pDeviceDriver = pDriver; | 18 m_pDeviceDriver = pDriver; |
| 19 InitDeviceInfo(); | 19 InitDeviceInfo(); |
| 20 } | 20 } |
| 21 void CFX_RenderDevice::InitDeviceInfo() { | 21 void CFX_RenderDevice::InitDeviceInfo() { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 CFX_PathData newPath; | 186 CFX_PathData newPath; |
| 187 FX_BOOL bThin = FALSE; | 187 FX_BOOL bThin = FALSE; |
| 188 if (pPathData->GetZeroAreaPath(newPath, (CFX_Matrix*)pObject2Device, bThin, | 188 if (pPathData->GetZeroAreaPath(newPath, (CFX_Matrix*)pObject2Device, bThin, |
| 189 m_pDeviceDriver->GetDriverType())) { | 189 m_pDeviceDriver->GetDriverType())) { |
| 190 CFX_GraphStateData graphState; | 190 CFX_GraphStateData graphState; |
| 191 graphState.m_LineWidth = 0.0f; | 191 graphState.m_LineWidth = 0.0f; |
| 192 uint32_t strokecolor = fill_color; | 192 uint32_t strokecolor = fill_color; |
| 193 if (bThin) { | 193 if (bThin) { |
| 194 strokecolor = (((fill_alpha >> 2) << 24) | (strokecolor & 0x00ffffff)); | 194 strokecolor = (((fill_alpha >> 2) << 24) | (strokecolor & 0x00ffffff)); |
| 195 } | 195 } |
| 196 CFX_Matrix* pMatrix = NULL; | 196 CFX_Matrix* pMatrix = nullptr; |
| 197 if (pObject2Device && !pObject2Device->IsIdentity()) { | 197 if (pObject2Device && !pObject2Device->IsIdentity()) { |
| 198 pMatrix = (CFX_Matrix*)pObject2Device; | 198 pMatrix = (CFX_Matrix*)pObject2Device; |
| 199 } | 199 } |
| 200 int smooth_path = FX_ZEROAREA_FILL; | 200 int smooth_path = FX_ZEROAREA_FILL; |
| 201 if (fill_mode & FXFILL_NOPATHSMOOTH) { | 201 if (fill_mode & FXFILL_NOPATHSMOOTH) { |
| 202 smooth_path |= FXFILL_NOPATHSMOOTH; | 202 smooth_path |= FXFILL_NOPATHSMOOTH; |
| 203 } | 203 } |
| 204 m_pDeviceDriver->DrawPath(&newPath, pMatrix, &graphState, 0, strokecolor, | 204 m_pDeviceDriver->DrawPath(&newPath, pMatrix, &graphState, 0, strokecolor, |
| 205 smooth_path, 0, nullptr, blend_type); | 205 smooth_path, 0, nullptr, blend_type); |
| 206 } | 206 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 FX_RECT rect = bbox.GetOutterRect(); | 248 FX_RECT rect = bbox.GetOutterRect(); |
| 249 CFX_DIBitmap bitmap, Backdrop; | 249 CFX_DIBitmap bitmap, Backdrop; |
| 250 if (!CreateCompatibleBitmap(&bitmap, FXSYS_round(rect.Width() * fScaleX), | 250 if (!CreateCompatibleBitmap(&bitmap, FXSYS_round(rect.Width() * fScaleX), |
| 251 FXSYS_round(rect.Height() * fScaleY))) { | 251 FXSYS_round(rect.Height() * fScaleY))) { |
| 252 return FALSE; | 252 return FALSE; |
| 253 } | 253 } |
| 254 if (bitmap.HasAlpha()) { | 254 if (bitmap.HasAlpha()) { |
| 255 bitmap.Clear(0); | 255 bitmap.Clear(0); |
| 256 Backdrop.Copy(&bitmap); | 256 Backdrop.Copy(&bitmap); |
| 257 } else { | 257 } else { |
| 258 if (!m_pDeviceDriver->GetDIBits(&bitmap, rect.left, rect.top, NULL)) { | 258 if (!m_pDeviceDriver->GetDIBits(&bitmap, rect.left, rect.top, nullptr)) { |
| 259 return FALSE; | 259 return FALSE; |
| 260 } | 260 } |
| 261 Backdrop.Copy(&bitmap); | 261 Backdrop.Copy(&bitmap); |
| 262 } | 262 } |
| 263 CFX_FxgeDevice bitmap_device; | 263 CFX_FxgeDevice bitmap_device; |
| 264 bitmap_device.Attach(&bitmap, false, &Backdrop, true); | 264 bitmap_device.Attach(&bitmap, false, &Backdrop, true); |
| 265 CFX_Matrix matrix; | 265 CFX_Matrix matrix; |
| 266 if (pObject2Device) { | 266 if (pObject2Device) { |
| 267 matrix = *pObject2Device; | 267 matrix = *pObject2Device; |
| 268 } | 268 } |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 flags, handle, 0, nullptr, blend_mode); | 449 flags, handle, 0, nullptr, blend_mode); |
| 450 } | 450 } |
| 451 | 451 |
| 452 FX_BOOL CFX_RenderDevice::ContinueDIBits(void* handle, IFX_Pause* pPause) { | 452 FX_BOOL CFX_RenderDevice::ContinueDIBits(void* handle, IFX_Pause* pPause) { |
| 453 return m_pDeviceDriver->ContinueDIBits(handle, pPause); | 453 return m_pDeviceDriver->ContinueDIBits(handle, pPause); |
| 454 } | 454 } |
| 455 | 455 |
| 456 void CFX_RenderDevice::CancelDIBits(void* handle) { | 456 void CFX_RenderDevice::CancelDIBits(void* handle) { |
| 457 m_pDeviceDriver->CancelDIBits(handle); | 457 m_pDeviceDriver->CancelDIBits(handle); |
| 458 } | 458 } |
| OLD | NEW |