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

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: vector change 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
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
27 void CFX_RenderDevice::Flush() {
28 delete m_pDeviceDriver;
29 m_pDeviceDriver = nullptr;
30 }
31 23
32 void CFX_RenderDevice::SetDeviceDriver(IFX_RenderDeviceDriver* pDriver) { 24 void CFX_RenderDevice::SetDeviceDriver(IFX_RenderDeviceDriver* pDriver) {
33 delete m_pDeviceDriver; 25 m_pDeviceDriver.reset(pDriver);
34 m_pDeviceDriver = pDriver;
35 InitDeviceInfo(); 26 InitDeviceInfo();
36 } 27 }
37 28
38 void CFX_RenderDevice::InitDeviceInfo() { 29 void CFX_RenderDevice::InitDeviceInfo() {
39 m_Width = m_pDeviceDriver->GetDeviceCaps(FXDC_PIXEL_WIDTH); 30 m_Width = m_pDeviceDriver->GetDeviceCaps(FXDC_PIXEL_WIDTH);
40 m_Height = m_pDeviceDriver->GetDeviceCaps(FXDC_PIXEL_HEIGHT); 31 m_Height = m_pDeviceDriver->GetDeviceCaps(FXDC_PIXEL_HEIGHT);
41 m_bpp = m_pDeviceDriver->GetDeviceCaps(FXDC_BITS_PIXEL); 32 m_bpp = m_pDeviceDriver->GetDeviceCaps(FXDC_BITS_PIXEL);
42 m_RenderCaps = m_pDeviceDriver->GetDeviceCaps(FXDC_RENDER_CAPS); 33 m_RenderCaps = m_pDeviceDriver->GetDeviceCaps(FXDC_RENDER_CAPS);
43 m_DeviceClass = m_pDeviceDriver->GetDeviceCaps(FXDC_DEVICE_CLASS); 34 m_DeviceClass = m_pDeviceDriver->GetDeviceCaps(FXDC_DEVICE_CLASS);
44 if (!m_pDeviceDriver->GetClipBox(&m_ClipBox)) { 35 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) { 480 void CFX_RenderDevice::CancelDIBits(void* handle) {
490 m_pDeviceDriver->CancelDIBits(handle); 481 m_pDeviceDriver->CancelDIBits(handle);
491 } 482 }
492 483
493 #ifdef _SKIA_SUPPORT_ 484 #ifdef _SKIA_SUPPORT_
494 485
495 void CFX_RenderDevice::DebugVerifyBitmapIsPreMultiplied() const { 486 void CFX_RenderDevice::DebugVerifyBitmapIsPreMultiplied() const {
496 SkASSERT(0); 487 SkASSERT(0);
497 } 488 }
498 #endif 489 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698