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

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

Issue 1192743004: Cleanup: Do not check pointers before deleting them. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years, 6 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/src/fxge/ge/fx_ge.cpp ('k') | core/src/fxge/ge/fx_ge_font.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 "../../../include/fxge/fx_ge.h" 7 #include "../../../include/fxge/fx_ge.h"
8 CFX_RenderDevice::CFX_RenderDevice() 8 CFX_RenderDevice::CFX_RenderDevice()
9 { 9 {
10 m_pDeviceDriver = NULL; 10 m_pDeviceDriver = NULL;
11 m_pBitmap = NULL; 11 m_pBitmap = NULL;
12 } 12 }
13 CFX_RenderDevice::~CFX_RenderDevice() 13 CFX_RenderDevice::~CFX_RenderDevice()
14 { 14 {
15 if (m_pDeviceDriver) { 15 delete m_pDeviceDriver;
16 delete m_pDeviceDriver;
17 }
18 } 16 }
19 void CFX_RenderDevice::SetDeviceDriver(IFX_RenderDeviceDriver* pDriver) 17 void CFX_RenderDevice::SetDeviceDriver(IFX_RenderDeviceDriver* pDriver)
20 { 18 {
21 if (m_pDeviceDriver) { 19 delete m_pDeviceDriver;
22 delete m_pDeviceDriver;
23 }
24 m_pDeviceDriver = pDriver; 20 m_pDeviceDriver = pDriver;
25 InitDeviceInfo(); 21 InitDeviceInfo();
26 } 22 }
27 void CFX_RenderDevice::InitDeviceInfo() 23 void CFX_RenderDevice::InitDeviceInfo()
28 { 24 {
29 ASSERT(m_pDeviceDriver != NULL); 25 ASSERT(m_pDeviceDriver != NULL);
30 m_Width = m_pDeviceDriver->GetDeviceCaps(FXDC_PIXEL_WIDTH); 26 m_Width = m_pDeviceDriver->GetDeviceCaps(FXDC_PIXEL_WIDTH);
31 m_Height = m_pDeviceDriver->GetDeviceCaps(FXDC_PIXEL_HEIGHT); 27 m_Height = m_pDeviceDriver->GetDeviceCaps(FXDC_PIXEL_HEIGHT);
32 m_bpp = m_pDeviceDriver->GetDeviceCaps(FXDC_BITS_PIXEL); 28 m_bpp = m_pDeviceDriver->GetDeviceCaps(FXDC_BITS_PIXEL);
33 m_RenderCaps = m_pDeviceDriver->GetDeviceCaps(FXDC_RENDER_CAPS); 29 m_RenderCaps = m_pDeviceDriver->GetDeviceCaps(FXDC_RENDER_CAPS);
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 return m_pDeviceDriver->StartDIBits(pBitmap, bitmap_alpha, argb, pMatrix, fl ags, handle, alpha_flag, pIccTransform, blend_mode); 392 return m_pDeviceDriver->StartDIBits(pBitmap, bitmap_alpha, argb, pMatrix, fl ags, handle, alpha_flag, pIccTransform, blend_mode);
397 } 393 }
398 FX_BOOL CFX_RenderDevice::ContinueDIBits(void* handle, IFX_Pause* pPause) 394 FX_BOOL CFX_RenderDevice::ContinueDIBits(void* handle, IFX_Pause* pPause)
399 { 395 {
400 return m_pDeviceDriver->ContinueDIBits(handle, pPause); 396 return m_pDeviceDriver->ContinueDIBits(handle, pPause);
401 } 397 }
402 void CFX_RenderDevice::CancelDIBits(void* handle) 398 void CFX_RenderDevice::CancelDIBits(void* handle)
403 { 399 {
404 m_pDeviceDriver->CancelDIBits(handle); 400 m_pDeviceDriver->CancelDIBits(handle);
405 } 401 }
OLDNEW
« no previous file with comments | « core/src/fxge/ge/fx_ge.cpp ('k') | core/src/fxge/ge/fx_ge_font.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698