| 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 <crtdbg.h> | 7 #include <crtdbg.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 #include <windows.h> |
| 13 #include "core/fxcodec/fx_codec.h" | 13 #include "core/fxcodec/fx_codec.h" |
| 14 #include "core/fxcrt/cfx_maybe_owned.h" | 14 #include "core/fxcrt/cfx_maybe_owned.h" |
| 15 #include "core/fxcrt/fx_memory.h" | 15 #include "core/fxcrt/fx_memory.h" |
| 16 #include "core/fxcrt/fx_system.h" | 16 #include "core/fxcrt/fx_system.h" |
| 17 #include "core/fxge/cfx_fontmapper.h" | |
| 18 #include "core/fxge/cfx_gemodule.h" | |
| 19 #include "core/fxge/cfx_graphstatedata.h" | |
| 20 #include "core/fxge/cfx_pathdata.h" | |
| 21 #include "core/fxge/cfx_windowsdevice.h" | 17 #include "core/fxge/cfx_windowsdevice.h" |
| 22 #include "core/fxge/dib/dib_int.h" | 18 #include "core/fxge/dib/dib_int.h" |
| 23 #include "core/fxge/fx_font.h" | 19 #include "core/fxge/fx_font.h" |
| 24 #include "core/fxge/fx_freetype.h" | 20 #include "core/fxge/fx_freetype.h" |
| 25 #include "core/fxge/ge/cfx_folderfontinfo.h" | 21 #include "core/fxge/ge/cfx_folderfontinfo.h" |
| 26 #include "core/fxge/ge/fx_text_int.h" | 22 #include "core/fxge/ge/fx_text_int.h" |
| 27 #include "core/fxge/ifx_systemfontinfo.h" | 23 #include "core/fxge/ifx_systemfontinfo.h" |
| 28 #include "core/fxge/win32/cfx_windowsdib.h" | 24 #include "core/fxge/win32/cfx_windowsdib.h" |
| 29 #include "core/fxge/win32/dwrite_int.h" | 25 #include "core/fxge/win32/dwrite_int.h" |
| 30 #include "core/fxge/win32/win32_int.h" | 26 #include "core/fxge/win32/win32_int.h" |
| (...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1362 bool CGdiDisplayDriver::StartDIBits(const CFX_DIBSource* pBitmap, | 1358 bool CGdiDisplayDriver::StartDIBits(const CFX_DIBSource* pBitmap, |
| 1363 int bitmap_alpha, | 1359 int bitmap_alpha, |
| 1364 uint32_t color, | 1360 uint32_t color, |
| 1365 const CFX_Matrix* pMatrix, | 1361 const CFX_Matrix* pMatrix, |
| 1366 uint32_t render_flags, | 1362 uint32_t render_flags, |
| 1367 void*& handle, | 1363 void*& handle, |
| 1368 int blend_type) { | 1364 int blend_type) { |
| 1369 return false; | 1365 return false; |
| 1370 } | 1366 } |
| 1371 | 1367 |
| 1372 CFX_WindowsDevice::CFX_WindowsDevice(HDC hDC) { | 1368 CFX_WindowsDevice::CFX_WindowsDevice(HDC hDC, int type) { |
| 1373 SetDeviceDriver(pdfium::WrapUnique(CreateDriver(hDC))); | 1369 SetDeviceDriver(pdfium::WrapUnique(CreateDriver(hDC, type))); |
| 1374 } | 1370 } |
| 1375 | 1371 |
| 1376 CFX_WindowsDevice::~CFX_WindowsDevice() {} | 1372 CFX_WindowsDevice::~CFX_WindowsDevice() {} |
| 1377 | 1373 |
| 1378 HDC CFX_WindowsDevice::GetDC() const { | 1374 HDC CFX_WindowsDevice::GetDC() const { |
| 1379 IFX_RenderDeviceDriver* pRDD = GetDeviceDriver(); | 1375 IFX_RenderDeviceDriver* pRDD = GetDeviceDriver(); |
| 1380 return pRDD ? reinterpret_cast<HDC>(pRDD->GetPlatformSurface()) : nullptr; | 1376 return pRDD ? reinterpret_cast<HDC>(pRDD->GetPlatformSurface()) : nullptr; |
| 1381 } | 1377 } |
| 1382 | 1378 |
| 1379 bool HasEscapeSupprt(HDC hdc, DWORD escape) { |
| 1380 const char* ptr = reinterpret_cast<const char*>(&escape); |
| 1381 return ExtEscape(hdc, QUERYESCSUPPORT, sizeof(escape), ptr, 0, nullptr) > 0; |
| 1382 } |
| 1383 |
| 1383 // static | 1384 // static |
| 1384 IFX_RenderDeviceDriver* CFX_WindowsDevice::CreateDriver(HDC hDC) { | 1385 IFX_RenderDeviceDriver* CFX_WindowsDevice::CreateDriver(HDC hDC, |
| 1386 int driver_type) { |
| 1385 int device_type = ::GetDeviceCaps(hDC, TECHNOLOGY); | 1387 int device_type = ::GetDeviceCaps(hDC, TECHNOLOGY); |
| 1386 int obj_type = ::GetObjectType(hDC); | 1388 int obj_type = ::GetObjectType(hDC); |
| 1387 bool use_printer = device_type == DT_RASPRINTER || | 1389 bool use_printer = device_type == DT_RASPRINTER || |
| 1388 device_type == DT_PLOTTER || obj_type == OBJ_ENHMETADC; | 1390 device_type == DT_PLOTTER || obj_type == OBJ_ENHMETADC; |
| 1389 if (use_printer) | 1391 |
| 1392 bool post_script = driver_type > 1; |
| 1393 if (!use_printer) |
| 1394 return new CGdiDisplayDriver(hDC); |
| 1395 |
| 1396 // TODO: Need to select between the two somehow and set the PS level. |
| 1397 int pslevel = driver_type; |
| 1398 if (post_script) |
| 1399 return new CPSPrinterDriver(hDC, pslevel, false); |
| 1400 else |
| 1390 return new CGdiPrinterDriver(hDC); | 1401 return new CGdiPrinterDriver(hDC); |
| 1391 return new CGdiDisplayDriver(hDC); | |
| 1392 } | 1402 } |
| OLD | NEW |