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

Unified Diff: core/fxge/win32/fx_win32_device.cpp

Issue 2572293002: More unique_ptr returns from DIB methods. (Closed)
Patch Set: win build Created 4 years 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/fx_dib.h ('k') | core/fxge/win32/fx_win32_print.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxge/win32/fx_win32_device.cpp
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp
index 2746587be243400ea432d3f6fd7dc8055a177a68..679479160f3700193896fc2e5201b9b6a4f18ee9 100644
--- a/core/fxge/win32/fx_win32_device.cpp
+++ b/core/fxge/win32/fx_win32_device.cpp
@@ -795,7 +795,7 @@ bool CGdiDeviceDriver::GDI_SetDIBits(CFX_DIBitmap* pBitmap1,
int left,
int top) {
if (m_DeviceClass == FXDC_PRINTER) {
- std::unique_ptr<CFX_DIBitmap> pBitmap(pBitmap1->FlipImage(false, true));
+ std::unique_ptr<CFX_DIBitmap> pBitmap = pBitmap1->FlipImage(false, true);
if (!pBitmap)
return false;
@@ -814,7 +814,7 @@ bool CGdiDeviceDriver::GDI_SetDIBits(CFX_DIBitmap* pBitmap1,
dst_height, pBuffer, (BITMAPINFO*)info.c_str(),
DIB_RGB_COLORS, SRCCOPY);
} else {
- CFX_DIBitmap* pBitmap = pBitmap1;
+ CFX_MaybeOwned<CFX_DIBitmap> pBitmap(pBitmap1);
if (pBitmap->IsCmykImage()) {
pBitmap = pBitmap->CloneConvert(FXDIB_Rgb).release();
if (!pBitmap)
@@ -822,14 +822,11 @@ bool CGdiDeviceDriver::GDI_SetDIBits(CFX_DIBitmap* pBitmap1,
}
int width = pSrcRect->Width(), height = pSrcRect->Height();
LPBYTE pBuffer = pBitmap->GetBuffer();
- CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap);
+ CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap.Get());
::SetDIBitsToDevice(m_hDC, left, top, width, height, pSrcRect->left,
pBitmap->GetHeight() - pSrcRect->bottom, 0,
pBitmap->GetHeight(), pBuffer,
(BITMAPINFO*)info.c_str(), DIB_RGB_COLORS);
- if (pBitmap != pBitmap1) {
- delete pBitmap;
- }
}
return true;
}
« no previous file with comments | « core/fxge/fx_dib.h ('k') | core/fxge/win32/fx_win32_print.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698