| 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 #include "core/fxge/cfx_renderdevice.h" | 7 #include "core/fxge/cfx_renderdevice.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 } // namespace | 347 } // namespace |
| 348 | 348 |
| 349 CFX_RenderDevice::CFX_RenderDevice() | 349 CFX_RenderDevice::CFX_RenderDevice() |
| 350 : m_pBitmap(nullptr), | 350 : m_pBitmap(nullptr), |
| 351 m_Width(0), | 351 m_Width(0), |
| 352 m_Height(0), | 352 m_Height(0), |
| 353 m_bpp(0), | 353 m_bpp(0), |
| 354 m_RenderCaps(0), | 354 m_RenderCaps(0), |
| 355 m_DeviceClass(0) {} | 355 m_DeviceClass(0) {} |
| 356 | 356 |
| 357 CFX_RenderDevice::~CFX_RenderDevice() {} | 357 CFX_RenderDevice::~CFX_RenderDevice() { |
| 358 #if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_ |
| 359 Flush(); |
| 360 #endif |
| 361 } |
| 358 | 362 |
| 359 #ifdef _SKIA_SUPPORT_ | 363 #if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_ |
| 360 void CFX_RenderDevice::Flush() { | 364 void CFX_RenderDevice::Flush() { |
| 361 m_pDeviceDriver.reset(); | 365 m_pDeviceDriver.reset(); |
| 362 } | 366 } |
| 363 #endif | 367 #endif |
| 364 | 368 |
| 365 void CFX_RenderDevice::SetDeviceDriver( | 369 void CFX_RenderDevice::SetDeviceDriver( |
| 366 std::unique_ptr<IFX_RenderDeviceDriver> pDriver) { | 370 std::unique_ptr<IFX_RenderDeviceDriver> pDriver) { |
| 367 m_pDeviceDriver = std::move(pDriver); | 371 m_pDeviceDriver = std::move(pDriver); |
| 368 InitDeviceInfo(); | 372 InitDeviceInfo(); |
| 369 } | 373 } |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 CFX_Matrix matrix; | 612 CFX_Matrix matrix; |
| 609 if (pObject2Device) | 613 if (pObject2Device) |
| 610 matrix = *pObject2Device; | 614 matrix = *pObject2Device; |
| 611 matrix.TranslateI(-rect.left, -rect.top); | 615 matrix.TranslateI(-rect.left, -rect.top); |
| 612 matrix.Concat(fScaleX, 0, 0, fScaleY, 0, 0); | 616 matrix.Concat(fScaleX, 0, 0, fScaleY, 0, 0); |
| 613 if (!bitmap_device.GetDeviceDriver()->DrawPath( | 617 if (!bitmap_device.GetDeviceDriver()->DrawPath( |
| 614 pPathData, &matrix, pGraphState, fill_color, stroke_color, fill_mode, | 618 pPathData, &matrix, pGraphState, fill_color, stroke_color, fill_mode, |
| 615 blend_type)) { | 619 blend_type)) { |
| 616 return false; | 620 return false; |
| 617 } | 621 } |
| 622 #if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_ |
| 623 bitmap_device.GetDeviceDriver()->Flush(); |
| 624 #endif |
| 618 FX_RECT src_rect(0, 0, FXSYS_round(rect.Width() * fScaleX), | 625 FX_RECT src_rect(0, 0, FXSYS_round(rect.Width() * fScaleX), |
| 619 FXSYS_round(rect.Height() * fScaleY)); | 626 FXSYS_round(rect.Height() * fScaleY)); |
| 620 return m_pDeviceDriver->SetDIBits(&bitmap, 0, &src_rect, rect.left, rect.top, | 627 return m_pDeviceDriver->SetDIBits(&bitmap, 0, &src_rect, rect.left, rect.top, |
| 621 FXDIB_BLEND_NORMAL); | 628 FXDIB_BLEND_NORMAL); |
| 622 } | 629 } |
| 623 | 630 |
| 624 bool CFX_RenderDevice::SetPixel(int x, int y, uint32_t color) { | 631 bool CFX_RenderDevice::SetPixel(int x, int y, uint32_t color) { |
| 625 if (m_pDeviceDriver->SetPixel(x, y, color)) | 632 if (m_pDeviceDriver->SetPixel(x, y, color)) |
| 626 return true; | 633 return true; |
| 627 | 634 |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 fill_color, stroke_color, fill_mode, | 1079 fill_color, stroke_color, fill_mode, |
| 1073 FXDIB_BLEND_NORMAL)) { | 1080 FXDIB_BLEND_NORMAL)) { |
| 1074 return false; | 1081 return false; |
| 1075 } | 1082 } |
| 1076 } | 1083 } |
| 1077 if (pClippingPath) | 1084 if (pClippingPath) |
| 1078 pClippingPath->Append(&TransformedPath, pUser2Device); | 1085 pClippingPath->Append(&TransformedPath, pUser2Device); |
| 1079 } | 1086 } |
| 1080 return true; | 1087 return true; |
| 1081 } | 1088 } |
| OLD | NEW |