Commit ed1ea859 authored by rvargas's avatar rvargas Committed by Commit bot

Remove implicit HANDLE conversions from ui.

BUG=416722
R=sky@chromium.org

Review URL: https://codereview.chromium.org/606453002

Cr-Commit-Position: refs/heads/master@{#296585}
parent a175a7c2
......@@ -348,9 +348,9 @@ HICON IconUtil::CreateCursorFromDIB(const gfx::Size& icon_size,
}
HBITMAP old_bitmap = reinterpret_cast<HBITMAP>(
SelectObject(working_dc, bitmap_handle));
SetBkMode(working_dc, TRANSPARENT);
SelectObject(working_dc, old_bitmap);
SelectObject(working_dc.Get(), bitmap_handle));
SetBkMode(working_dc.Get(), TRANSPARENT);
SelectObject(working_dc.Get(), old_bitmap);
base::win::ScopedGDIObject<HBITMAP> mask(
CreateBitmap(icon_size.width(),
......
......@@ -180,9 +180,9 @@ std::string PlatformFontWin::GetLocalizedFontName() const {
// When a font has a localized name for a language matching the system
// locale, GetTextFace() returns the localized name.
base::win::ScopedSelectObject font(memory_dc, font_ref_->hfont());
base::win::ScopedSelectObject font(memory_dc.Get(), font_ref_->hfont());
wchar_t localized_font_name[LF_FACESIZE];
int length = GetTextFace(memory_dc, arraysize(localized_font_name),
int length = GetTextFace(memory_dc.Get(), arraysize(localized_font_name),
&localized_font_name[0]);
if (length <= 0)
return GetFontName();
......
......@@ -874,18 +874,18 @@ HRESULT NativeThemeWin::PaintMenuArrow(
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;
}
......@@ -1976,9 +1976,9 @@ HRESULT NativeThemeWin::PaintFrameControl(HDC hdc,
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
......@@ -2004,7 +2004,8 @@ HRESULT NativeThemeWin::PaintFrameControl(HDC hdc,
}
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);
SetBkColor(hdc, old_bg_color);
SetTextColor(hdc, old_text_color);
......
......@@ -56,18 +56,18 @@ bool GrabHwndSnapshot(HWND window_handle,
&hdr);
unsigned char *bit_ptr = NULL;
base::win::ScopedBitmap bitmap(
CreateDIBSection(mem_hdc,
CreateDIBSection(mem_hdc.Get(),
reinterpret_cast<BITMAPINFO*>(&hdr),
DIB_RGB_COLORS,
reinterpret_cast<void **>(&bit_ptr),
NULL, 0));
base::win::ScopedSelectObject select_bitmap(mem_hdc, bitmap);
base::win::ScopedSelectObject select_bitmap(mem_hdc.Get(), bitmap);
// Clear the bitmap to white (so that rounded corners on windows
// show up on a white background, and strangely-shaped windows
// look reasonable). Not capturing an alpha mask saves a
// bit of space.
PatBlt(mem_hdc, 0, 0, snapshot_bounds.width(), snapshot_bounds.height(),
PatBlt(mem_hdc.Get(), 0, 0, snapshot_bounds.width(), snapshot_bounds.height(),
WHITENESS);
// Grab a copy of the window
// First, see if PrintWindow is defined (it's not in Windows 2000).
......@@ -82,10 +82,11 @@ bool GrabHwndSnapshot(HWND window_handle,
// than nothing and will work fine in the average case (window is
// completely on screen). Always BitBlt when grabbing the whole screen.
if (snapshot_bounds.origin() == gfx::Point() && print_window && window_handle)
(*print_window)(window_handle, mem_hdc, 0);
(*print_window)(window_handle, mem_hdc.Get(), 0);
else
BitBlt(mem_hdc, 0, 0, snapshot_bounds.width(), snapshot_bounds.height(),
window_hdc, snapshot_bounds.x(), snapshot_bounds.y(), SRCCOPY);
BitBlt(mem_hdc.Get(), 0, 0, snapshot_bounds.width(),
snapshot_bounds.height(), window_hdc, snapshot_bounds.x(),
snapshot_bounds.y(), SRCCOPY);
// We now have a copy of the window contents in a DIB, so
// encode it into a useful format for posting to the bug report
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment