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

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

Issue 1235753006: Merge to XFA: Cleanup: Do not check pointers before deleting them, part 2. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 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/src/fxge/apple/fx_mac_imp.cpp ('k') | core/src/fxge/win32/fx_win32_dwrite.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 8
9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ 9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_
10 #include <crtdbg.h> 10 #include <crtdbg.h>
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 OSVERSIONINFO ver; 406 OSVERSIONINFO ver;
407 ver.dwOSVersionInfoSize = sizeof(ver); 407 ver.dwOSVersionInfoSize = sizeof(ver);
408 GetVersionEx(&ver); 408 GetVersionEx(&ver);
409 pPlatformData->m_bHalfTone = ver.dwMajorVersion >= 5; 409 pPlatformData->m_bHalfTone = ver.dwMajorVersion >= 5;
410 pPlatformData->m_GdiplusExt.Load(); 410 pPlatformData->m_GdiplusExt.Load();
411 m_pPlatformData = pPlatformData; 411 m_pPlatformData = pPlatformData;
412 m_pFontMgr->SetSystemFontInfo(IFX_SystemFontInfo::CreateDefault()); 412 m_pFontMgr->SetSystemFontInfo(IFX_SystemFontInfo::CreateDefault());
413 } 413 }
414 void CFX_GEModule::DestroyPlatform() 414 void CFX_GEModule::DestroyPlatform()
415 { 415 {
416 if (m_pPlatformData) { 416 delete (CWin32Platform*)m_pPlatformData;
417 delete (CWin32Platform*)m_pPlatformData;
418 }
419 m_pPlatformData = NULL; 417 m_pPlatformData = NULL;
420 } 418 }
421 CGdiDeviceDriver::CGdiDeviceDriver(HDC hDC, int device_class) 419 CGdiDeviceDriver::CGdiDeviceDriver(HDC hDC, int device_class)
422 { 420 {
423 m_hDC = hDC; 421 m_hDC = hDC;
424 m_DeviceClass = device_class; 422 m_DeviceClass = device_class;
425 CWin32Platform* pPlatform = (CWin32Platform*)CFX_GEModule::Get()->GetPlatfor mData(); 423 CWin32Platform* pPlatform = (CWin32Platform*)CFX_GEModule::Get()->GetPlatfor mData();
426 SetStretchBltMode(hDC, pPlatform->m_bHalfTone ? HALFTONE : COLORONCOLOR); 424 SetStretchBltMode(hDC, pPlatform->m_bHalfTone ? HALFTONE : COLORONCOLOR);
427 if (GetObjectType(m_hDC) == OBJ_MEMDC) { 425 if (GetObjectType(m_hDC) == OBJ_MEMDC) {
428 HBITMAP hBitmap = CreateBitmap(1, 1, 1, 1, NULL); 426 HBITMAP hBitmap = CreateBitmap(1, 1, 1, 1, NULL);
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 SelectObject(m_hDC, m_hOldBitmap); 1207 SelectObject(m_hDC, m_hOldBitmap);
1210 DeleteDC(m_hDC); 1208 DeleteDC(m_hDC);
1211 } 1209 }
1212 if (m_hBitmap) { 1210 if (m_hBitmap) {
1213 DeleteObject(m_hBitmap); 1211 DeleteObject(m_hBitmap);
1214 } 1212 }
1215 delete GetBitmap(); 1213 delete GetBitmap();
1216 } 1214 }
1217 1215
1218 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ 1216 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_
OLDNEW
« no previous file with comments | « core/src/fxge/apple/fx_mac_imp.cpp ('k') | core/src/fxge/win32/fx_win32_dwrite.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698