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

Unified Diff: chrome/renderer/print_web_view_helper_win.cc

Issue 9212020: Make scoped dc objects smarter. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 10 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: chrome/renderer/print_web_view_helper_win.cc
===================================================================
--- chrome/renderer/print_web_view_helper_win.cc (revision 120644)
+++ chrome/renderer/print_web_view_helper_win.cc (working copy)
@@ -279,23 +279,23 @@
// Page used alpha blend, but printer doesn't support it. Rewrite the
// metafile and flatten out the transparency.
base::win::ScopedGetDC screen_dc(NULL);
- base::win::ScopedCreateDC bitmap_dc(CreateCompatibleDC(screen_dc));
- if (!bitmap_dc)
+ base::win::ScopedCreateDC bitmap_dc(CreateCompatibleDC(screen_dc.Get()));
+ if (!bitmap_dc.Get())
NOTREACHED() << "Bitmap DC creation failed";
- SetGraphicsMode(bitmap_dc, GM_ADVANCED);
+ SetGraphicsMode(bitmap_dc.Get(), GM_ADVANCED);
void* bits = NULL;
BITMAPINFO hdr;
gfx::CreateBitmapHeader(page_size.width(), page_size.height(),
&hdr.bmiHeader);
base::win::ScopedBitmap hbitmap(CreateDIBSection(
- bitmap_dc, &hdr, DIB_RGB_COLORS, &bits, NULL, 0));
+ bitmap_dc.Get(), &hdr, DIB_RGB_COLORS, &bits, NULL, 0));
if (!hbitmap)
NOTREACHED() << "Raster bitmap creation for printing failed";
- base::win::ScopedSelectObject selectBitmap(bitmap_dc, hbitmap);
+ base::win::ScopedSelectObject selectBitmap(bitmap_dc.Get(), hbitmap);
RECT rect = { 0, 0, page_size.width(), page_size.height() };
HBRUSH whiteBrush = static_cast<HBRUSH>(GetStockObject(WHITE_BRUSH));
- FillRect(bitmap_dc, &rect, whiteBrush);
+ FillRect(bitmap_dc.Get(), &rect, whiteBrush);
Metafile* metafile2(new printing::NativeMetafile);
metafile2->Init();

Powered by Google App Engine
This is Rietveld 408576698