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

Unified Diff: core/fxge/apple/fx_quartz_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 side-by-side diff with in-line comments
Download patch
Index: core/fxge/apple/fx_quartz_device.cpp
diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp
index b3591a3da132eed48b8d6cacee31b3c686bc3c42..0f3832e73357cc878a2825bb90ef2f7f2e19d092 100644
--- a/core/fxge/apple/fx_quartz_device.cpp
+++ b/core/fxge/apple/fx_quartz_device.cpp
@@ -1023,6 +1023,7 @@ FX_BOOL CFX_QuartzDevice::Attach(CGContextRef context, int32_t nDeviceClass) {
SetDeviceDriver(pDriver);
return TRUE;
}
+
FX_BOOL CFX_QuartzDevice::Attach(CFX_DIBitmap* pBitmap) {
SetBitmap(pBitmap);
m_pContext = createContextWithBitmap(pBitmap);
@@ -1034,18 +1035,17 @@ FX_BOOL CFX_QuartzDevice::Attach(CFX_DIBitmap* pBitmap) {
SetDeviceDriver(pDriver);
return TRUE;
}
+
FX_BOOL CFX_QuartzDevice::Create(int32_t width,
int32_t height,
FXDIB_Format format) {
if ((uint8_t)format < 32) {
return FALSE;
}
- CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
- if (!pBitmap->Create(width, height, format)) {
- delete pBitmap;
+ std::unique_ptr<CFX_DIBitmap> pBitmap(new CFX_DIBitmap);
+ if (!pBitmap->Create(width, height, format))
return FALSE;
- }
m_bOwnedBitmap = TRUE;
- return Attach(pBitmap);
+ return Attach(pBitmap.release());
}
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_

Powered by Google App Engine
This is Rietveld 408576698