Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: core/fxge/win32/fx_win32_device.cpp

Issue 2386273004: Add ptr_util.h from base until std::make_unique<> available (Closed)
Patch Set: 2016 Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fxge/skia/fx_skia_device.cpp ('k') | fpdfsdk/cpdfsdk_document.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
13 #include "core/fxcodec/fx_codec.h" 13 #include "core/fxcodec/fx_codec.h"
14 #include "core/fxcrt/fx_memory.h" 14 #include "core/fxcrt/fx_memory.h"
15 #include "core/fxcrt/fx_system.h" 15 #include "core/fxcrt/fx_system.h"
16 #include "core/fxge/cfx_fontmapper.h" 16 #include "core/fxge/cfx_fontmapper.h"
17 #include "core/fxge/cfx_gemodule.h" 17 #include "core/fxge/cfx_gemodule.h"
18 #include "core/fxge/cfx_graphstatedata.h" 18 #include "core/fxge/cfx_graphstatedata.h"
19 #include "core/fxge/cfx_pathdata.h" 19 #include "core/fxge/cfx_pathdata.h"
20 #include "core/fxge/cfx_windowsdevice.h" 20 #include "core/fxge/cfx_windowsdevice.h"
21 #include "core/fxge/dib/dib_int.h" 21 #include "core/fxge/dib/dib_int.h"
22 #include "core/fxge/fx_font.h" 22 #include "core/fxge/fx_font.h"
23 #include "core/fxge/fx_freetype.h" 23 #include "core/fxge/fx_freetype.h"
24 #include "core/fxge/ge/cfx_folderfontinfo.h" 24 #include "core/fxge/ge/cfx_folderfontinfo.h"
25 #include "core/fxge/ge/fx_text_int.h" 25 #include "core/fxge/ge/fx_text_int.h"
26 #include "core/fxge/ifx_systemfontinfo.h" 26 #include "core/fxge/ifx_systemfontinfo.h"
27 #include "core/fxge/win32/cfx_windowsdib.h" 27 #include "core/fxge/win32/cfx_windowsdib.h"
28 #include "core/fxge/win32/dwrite_int.h" 28 #include "core/fxge/win32/dwrite_int.h"
29 #include "core/fxge/win32/win32_int.h" 29 #include "core/fxge/win32/win32_int.h"
30 #include "third_party/base/ptr_util.h"
30 #include "third_party/base/stl_util.h" 31 #include "third_party/base/stl_util.h"
31 32
32 #ifndef _SKIA_SUPPORT_ 33 #ifndef _SKIA_SUPPORT_
33 #include "core/fxge/agg/fx_agg_driver.h" 34 #include "core/fxge/agg/fx_agg_driver.h"
34 #endif 35 #endif
35 36
36 namespace { 37 namespace {
37 38
38 const struct { 39 const struct {
39 const FX_CHAR* m_pFaceName; 40 const FX_CHAR* m_pFaceName;
(...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 int bitmap_alpha, 1363 int bitmap_alpha,
1363 uint32_t color, 1364 uint32_t color,
1364 const CFX_Matrix* pMatrix, 1365 const CFX_Matrix* pMatrix,
1365 uint32_t render_flags, 1366 uint32_t render_flags,
1366 void*& handle, 1367 void*& handle,
1367 int blend_type) { 1368 int blend_type) {
1368 return FALSE; 1369 return FALSE;
1369 } 1370 }
1370 1371
1371 CFX_WindowsDevice::CFX_WindowsDevice(HDC hDC) { 1372 CFX_WindowsDevice::CFX_WindowsDevice(HDC hDC) {
1372 SetDeviceDriver(WrapUnique(CreateDriver(hDC))); 1373 SetDeviceDriver(pdfium::WrapUnique(CreateDriver(hDC)));
1373 } 1374 }
1374 1375
1375 CFX_WindowsDevice::~CFX_WindowsDevice() {} 1376 CFX_WindowsDevice::~CFX_WindowsDevice() {}
1376 1377
1377 HDC CFX_WindowsDevice::GetDC() const { 1378 HDC CFX_WindowsDevice::GetDC() const {
1378 IFX_RenderDeviceDriver* pRDD = GetDeviceDriver(); 1379 IFX_RenderDeviceDriver* pRDD = GetDeviceDriver();
1379 return pRDD ? reinterpret_cast<HDC>(pRDD->GetPlatformSurface()) : nullptr; 1380 return pRDD ? reinterpret_cast<HDC>(pRDD->GetPlatformSurface()) : nullptr;
1380 } 1381 }
1381 1382
1382 // static 1383 // static
1383 IFX_RenderDeviceDriver* CFX_WindowsDevice::CreateDriver(HDC hDC) { 1384 IFX_RenderDeviceDriver* CFX_WindowsDevice::CreateDriver(HDC hDC) {
1384 int device_type = ::GetDeviceCaps(hDC, TECHNOLOGY); 1385 int device_type = ::GetDeviceCaps(hDC, TECHNOLOGY);
1385 int obj_type = ::GetObjectType(hDC); 1386 int obj_type = ::GetObjectType(hDC);
1386 bool use_printer = device_type == DT_RASPRINTER || 1387 bool use_printer = device_type == DT_RASPRINTER ||
1387 device_type == DT_PLOTTER || obj_type == OBJ_ENHMETADC; 1388 device_type == DT_PLOTTER || obj_type == OBJ_ENHMETADC;
1388 if (use_printer) 1389 if (use_printer)
1389 return new CGdiPrinterDriver(hDC); 1390 return new CGdiPrinterDriver(hDC);
1390 return new CGdiDisplayDriver(hDC); 1391 return new CGdiDisplayDriver(hDC);
1391 } 1392 }
OLDNEW
« no previous file with comments | « core/fxge/skia/fx_skia_device.cpp ('k') | fpdfsdk/cpdfsdk_document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698