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

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: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fxge/agg/fx_agg_driver.cpp ('k') | core/fxge/dib/fx_dib_main.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a9b9268ae61ee2e518eabe9db74619b061664648 100644
--- a/core/fxge/apple/fx_quartz_device.cpp
+++ b/core/fxge/apple/fx_quartz_device.cpp
@@ -10,6 +10,7 @@
#include "core/fxge/agg/fx_agg_driver.h"
#endif
+#include "core/fxcrt/include/fx_memory.h"
#include "core/fxge/dib/dib_int.h"
#include "core/fxge/ge/fx_text_int.h"
#include "core/fxge/include/fx_freetype.h"
@@ -1018,34 +1019,32 @@ FX_BOOL CFX_QuartzDevice::Attach(CGContextRef context, int32_t nDeviceClass) {
}
m_pContext = context;
CGContextRetain(m_pContext);
- IFX_RenderDeviceDriver* pDriver =
- new CFX_QuartzDeviceDriver(m_pContext, nDeviceClass);
- SetDeviceDriver(pDriver);
+ SetDeviceDriver(
+ WrapUnique(new CFX_QuartzDeviceDriver(m_pContext, nDeviceClass)));
return TRUE;
}
+
FX_BOOL CFX_QuartzDevice::Attach(CFX_DIBitmap* pBitmap) {
SetBitmap(pBitmap);
m_pContext = createContextWithBitmap(pBitmap);
if (!m_pContext)
return FALSE;
- IFX_RenderDeviceDriver* pDriver =
- new CFX_QuartzDeviceDriver(m_pContext, FXDC_DISPLAY);
- SetDeviceDriver(pDriver);
+ SetDeviceDriver(
+ WrapUnique(new CFX_QuartzDeviceDriver(m_pContext, FXDC_DISPLAY)));
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_
« no previous file with comments | « core/fxge/agg/fx_agg_driver.cpp ('k') | core/fxge/dib/fx_dib_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698