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

Unified Diff: ui/gfx/native_theme_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: ui/gfx/native_theme_win.cc
===================================================================
--- ui/gfx/native_theme_win.cc (revision 120644)
+++ ui/gfx/native_theme_win.cc (working copy)
@@ -635,18 +635,18 @@
base::win::ScopedCreateDC mem_dc(CreateCompatibleDC(hdc));
base::win::ScopedBitmap mem_bitmap(CreateCompatibleBitmap(hdc, r.width(),
r.height()));
- base::win::ScopedSelectObject select_bitmap(mem_dc, mem_bitmap);
+ base::win::ScopedSelectObject select_bitmap(mem_dc.Get(), mem_bitmap);
// Copy and horizontally mirror the background from hdc into mem_dc. Use
// a negative-width source rect, starting at the rightmost pixel.
- StretchBlt(mem_dc, 0, 0, r.width(), r.height(),
+ StretchBlt(mem_dc.Get(), 0, 0, r.width(), r.height(),
hdc, r.right()-1, r.y(), -r.width(), r.height(), SRCCOPY);
// Draw the arrow.
RECT theme_rect = {0, 0, r.width(), r.height()};
- HRESULT result = draw_theme_(handle, mem_dc, MENU_POPUPSUBMENU,
+ HRESULT result = draw_theme_(handle, mem_dc.Get(), MENU_POPUPSUBMENU,
state_id, &theme_rect, NULL);
// Copy and mirror the result back into mem_dc.
StretchBlt(hdc, r.x(), r.y(), r.width(), r.height(),
- mem_dc, r.width()-1, 0, -r.width(), r.height(), SRCCOPY);
+ mem_dc.Get(), r.width()-1, 0, -r.width(), r.height(), SRCCOPY);
return result;
}
}
@@ -1668,9 +1668,9 @@
return E_OUTOFMEMORY;
base::win::ScopedCreateDC bitmap_dc(CreateCompatibleDC(NULL));
- base::win::ScopedSelectObject select_bitmap(bitmap_dc, mask_bitmap);
+ base::win::ScopedSelectObject select_bitmap(bitmap_dc.Get(), mask_bitmap);
RECT local_rect = { 0, 0, width, height };
- DrawFrameControl(bitmap_dc, &local_rect, type, state);
+ DrawFrameControl(bitmap_dc.Get(), &local_rect, type, state);
// We're going to use BitBlt with a b&w mask. This results in using the dest
// dc's text color for the black bits in the mask, and the dest dc's
@@ -1699,7 +1699,8 @@
}
COLORREF old_bg_color = SetBkColor(hdc, GetSysColor(bg_color_key));
COLORREF old_text_color = SetTextColor(hdc, GetSysColor(text_color_key));
- BitBlt(hdc, rect.x(), rect.y(), width, height, bitmap_dc, 0, 0, SRCCOPY);
+ BitBlt(hdc, rect.x(), rect.y(), width, height,
+ bitmap_dc.Get(), 0, 0, SRCCOPY);
Peter Kasting 2012/02/08 00:38:49 Nit: Arbitrary-seeming choice of wrapping points
cpu_(ooo_6.6-7.5) 2012/02/10 19:41:55 Done.
SetBkColor(hdc, old_bg_color);
SetTextColor(hdc, old_text_color);

Powered by Google App Engine
This is Rietveld 408576698