diff options
author | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-14 03:37:14 +0000 |
---|---|---|
committer | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-14 03:37:14 +0000 |
commit | 46db9f43fe29b92895d3138a22d3bc042632135a (patch) | |
tree | 00d16d75a583afb05e3df73d76ff04b0b5562bb6 /chrome/renderer/print_web_view_helper_win.cc | |
parent | c6aef90f9f927ac75bb99d6d77782fc33c37769d (diff) | |
download | chromium_src-46db9f43fe29b92895d3138a22d3bc042632135a.zip chromium_src-46db9f43fe29b92895d3138a22d3bc042632135a.tar.gz chromium_src-46db9f43fe29b92895d3138a22d3bc042632135a.tar.bz2 |
Make scoped dc objects smarter
So we don't destroy the dc with gdi objects selected.
Also remove implicit conversion to HDC.
BUG=110113,113683
TEST=chrome runs, base unittests green.
Review URL: https://chromiumcodereview.appspot.com/9212020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121840 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/print_web_view_helper_win.cc')
-rw-r--r-- | chrome/renderer/print_web_view_helper_win.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/chrome/renderer/print_web_view_helper_win.cc b/chrome/renderer/print_web_view_helper_win.cc index 3ed93fd..1cac932 100644 --- a/chrome/renderer/print_web_view_helper_win.cc +++ b/chrome/renderer/print_web_view_helper_win.cc @@ -279,23 +279,23 @@ Metafile* PrintWebViewHelper::RenderPage( // 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(); |