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

Side by Side Diff: core/fxge/ge/fx_ge_device.cpp

Issue 2163103002: Use smart pointers for graphics device classes (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: fix all platforms Created 4 years, 5 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/dib/fx_dib_main.cpp ('k') | core/fxge/include/fx_dib.h » ('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 "core/fxge/include/fx_ge.h" 7 #include "core/fxge/include/fx_ge.h"
8 #include "core/fxge/include/ifx_renderdevicedriver.h" 8 #include "core/fxge/include/ifx_renderdevicedriver.h"
9 9
10 #if defined _SKIA_SUPPORT_ 10 #if defined _SKIA_SUPPORT_
11 #include "third_party/skia/include/core/SkTypes.h" 11 #include "third_party/skia/include/core/SkTypes.h"
12 #endif 12 #endif
13 13
14 CFX_RenderDevice::CFX_RenderDevice() 14 CFX_RenderDevice::CFX_RenderDevice()
15 : m_pBitmap(nullptr), 15 : m_pBitmap(nullptr),
16 m_Width(0), 16 m_Width(0),
17 m_Height(0), 17 m_Height(0),
18 m_bpp(0), 18 m_bpp(0),
19 m_RenderCaps(0), 19 m_RenderCaps(0),
20 m_DeviceClass(0), 20 m_DeviceClass(0) {}
21 m_pDeviceDriver(nullptr) {}
22 21
23 CFX_RenderDevice::~CFX_RenderDevice() { 22 CFX_RenderDevice::~CFX_RenderDevice() {}
24 delete m_pDeviceDriver;
25 }
26 23
27 void CFX_RenderDevice::Flush() { 24 void CFX_RenderDevice::SetDeviceDriver(
28 delete m_pDeviceDriver; 25 std::unique_ptr<IFX_RenderDeviceDriver> pDriver) {
29 m_pDeviceDriver = nullptr; 26 m_pDeviceDriver = std::move(pDriver);
30 }
31
32 void CFX_RenderDevice::SetDeviceDriver(IFX_RenderDeviceDriver* pDriver) {
33 delete m_pDeviceDriver;
34 m_pDeviceDriver = pDriver;
35 InitDeviceInfo(); 27 InitDeviceInfo();
36 } 28 }
37 29
38 void CFX_RenderDevice::InitDeviceInfo() { 30 void CFX_RenderDevice::InitDeviceInfo() {
39 m_Width = m_pDeviceDriver->GetDeviceCaps(FXDC_PIXEL_WIDTH); 31 m_Width = m_pDeviceDriver->GetDeviceCaps(FXDC_PIXEL_WIDTH);
40 m_Height = m_pDeviceDriver->GetDeviceCaps(FXDC_PIXEL_HEIGHT); 32 m_Height = m_pDeviceDriver->GetDeviceCaps(FXDC_PIXEL_HEIGHT);
41 m_bpp = m_pDeviceDriver->GetDeviceCaps(FXDC_BITS_PIXEL); 33 m_bpp = m_pDeviceDriver->GetDeviceCaps(FXDC_BITS_PIXEL);
42 m_RenderCaps = m_pDeviceDriver->GetDeviceCaps(FXDC_RENDER_CAPS); 34 m_RenderCaps = m_pDeviceDriver->GetDeviceCaps(FXDC_RENDER_CAPS);
43 m_DeviceClass = m_pDeviceDriver->GetDeviceCaps(FXDC_DEVICE_CLASS); 35 m_DeviceClass = m_pDeviceDriver->GetDeviceCaps(FXDC_DEVICE_CLASS);
44 if (!m_pDeviceDriver->GetClipBox(&m_ClipBox)) { 36 if (!m_pDeviceDriver->GetClipBox(&m_ClipBox)) {
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 void CFX_RenderDevice::CancelDIBits(void* handle) { 481 void CFX_RenderDevice::CancelDIBits(void* handle) {
490 m_pDeviceDriver->CancelDIBits(handle); 482 m_pDeviceDriver->CancelDIBits(handle);
491 } 483 }
492 484
493 #ifdef _SKIA_SUPPORT_ 485 #ifdef _SKIA_SUPPORT_
494 486
495 void CFX_RenderDevice::DebugVerifyBitmapIsPreMultiplied() const { 487 void CFX_RenderDevice::DebugVerifyBitmapIsPreMultiplied() const {
496 SkASSERT(0); 488 SkASSERT(0);
497 } 489 }
498 #endif 490 #endif
OLDNEW
« no previous file with comments | « core/fxge/dib/fx_dib_main.cpp ('k') | core/fxge/include/fx_dib.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698