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 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1403 } | 1403 } |
1404 CFX_DIBExtractor temp(pSource); | 1404 CFX_DIBExtractor temp(pSource); |
1405 CFX_DIBitmap* pBitmap = temp; | 1405 CFX_DIBitmap* pBitmap = temp; |
1406 if (pBitmap) { | 1406 if (pBitmap) { |
1407 return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, | 1407 return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, |
1408 dest_height, flags, pIccTransform); | 1408 dest_height, flags, pIccTransform); |
1409 } | 1409 } |
1410 return FALSE; | 1410 return FALSE; |
1411 } | 1411 } |
1412 | 1412 |
1413 // static | 1413 CFX_WindowsDevice::CFX_WindowsDevice(HDC hDC) { |
1414 int CFX_WindowsDevice::m_psLevel = 2; | 1414 SetDeviceDriver(CreateDriver(hDC)); |
| 1415 } |
1415 | 1416 |
1416 CFX_WindowsDevice::CFX_WindowsDevice(HDC hDC, | 1417 CFX_WindowsDevice::~CFX_WindowsDevice() {} |
1417 FX_BOOL bCmykOutput, | |
1418 FX_BOOL bForcePSOutput, | |
1419 int psLevel) { | |
1420 m_bForcePSOutput = bForcePSOutput; | |
1421 m_psLevel = psLevel; | |
1422 if (bForcePSOutput) { | |
1423 IFX_RenderDeviceDriver* pDriver = new CPSPrinterDriver; | |
1424 ((CPSPrinterDriver*)pDriver)->Init(hDC, psLevel, bCmykOutput); | |
1425 SetDeviceDriver(pDriver); | |
1426 return; | |
1427 } | |
1428 SetDeviceDriver(CreateDriver(hDC, bCmykOutput)); | |
1429 } | |
1430 | 1418 |
1431 HDC CFX_WindowsDevice::GetDC() const { | 1419 HDC CFX_WindowsDevice::GetDC() const { |
1432 IFX_RenderDeviceDriver* pRDD = GetDeviceDriver(); | 1420 IFX_RenderDeviceDriver* pRDD = GetDeviceDriver(); |
1433 return pRDD ? reinterpret_cast<HDC>(pRDD->GetPlatformSurface()) : nullptr; | 1421 return pRDD ? reinterpret_cast<HDC>(pRDD->GetPlatformSurface()) : nullptr; |
1434 } | 1422 } |
1435 | 1423 |
1436 IFX_RenderDeviceDriver* CFX_WindowsDevice::CreateDriver(HDC hDC, | 1424 // static |
1437 FX_BOOL bCmykOutput) { | 1425 IFX_RenderDeviceDriver* CFX_WindowsDevice::CreateDriver(HDC hDC) { |
1438 int device_type = ::GetDeviceCaps(hDC, TECHNOLOGY); | 1426 int device_type = ::GetDeviceCaps(hDC, TECHNOLOGY); |
1439 int obj_type = ::GetObjectType(hDC); | 1427 int obj_type = ::GetObjectType(hDC); |
1440 bool use_printer = device_type == DT_RASPRINTER || | 1428 bool use_printer = device_type == DT_RASPRINTER || |
1441 device_type == DT_PLOTTER || obj_type == OBJ_ENHMETADC; | 1429 device_type == DT_PLOTTER || obj_type == OBJ_ENHMETADC; |
1442 if (use_printer) | 1430 if (use_printer) |
1443 return new CGdiPrinterDriver(hDC); | 1431 return new CGdiPrinterDriver(hDC); |
1444 return new CGdiDisplayDriver(hDC); | 1432 return new CGdiDisplayDriver(hDC); |
1445 } | 1433 } |
1446 | 1434 |
1447 CFX_WinBitmapDevice::CFX_WinBitmapDevice(int width, | 1435 CFX_WinBitmapDevice::CFX_WinBitmapDevice(int width, |
(...skipping 26 matching lines...) Expand all Loading... |
1474 if (m_hDC) { | 1462 if (m_hDC) { |
1475 SelectObject(m_hDC, m_hOldBitmap); | 1463 SelectObject(m_hDC, m_hOldBitmap); |
1476 DeleteDC(m_hDC); | 1464 DeleteDC(m_hDC); |
1477 } | 1465 } |
1478 if (m_hBitmap) | 1466 if (m_hBitmap) |
1479 DeleteObject(m_hBitmap); | 1467 DeleteObject(m_hBitmap); |
1480 delete GetBitmap(); | 1468 delete GetBitmap(); |
1481 } | 1469 } |
1482 | 1470 |
1483 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ | 1471 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ |
OLD | NEW |