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

Unified Diff: views/controls/menu/native_menu_win.cc

Issue 8122013: Allow CanvasSkia to bind to an existing SkCanvas. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 1 more fix Created 9 years, 2 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: views/controls/menu/native_menu_win.cc
diff --git a/views/controls/menu/native_menu_win.cc b/views/controls/menu/native_menu_win.cc
index fd823534333e451128c79608544946a5e25382eb..f490d12a39ed07fb621724954f58043cc9da995f 100644
--- a/views/controls/menu/native_menu_win.cc
+++ b/views/controls/menu/native_menu_win.cc
@@ -249,10 +249,11 @@ class NativeMenuWin::MenuHostWindow {
// We currently don't support items with both icons and checkboxes.
DCHECK(type != ui::MenuModel::TYPE_CHECK);
gfx::CanvasSkia canvas(icon.width(), icon.height(), false);
- canvas.drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode);
+ canvas.sk_canvas()->drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode);
canvas.DrawBitmapInt(icon, 0, 0);
skia::DrawToNativeContext(
- &canvas, dc, draw_item_struct->rcItem.left + kItemLeftMargin,
+ canvas.sk_canvas(), dc,
+ draw_item_struct->rcItem.left + kItemLeftMargin,
draw_item_struct->rcItem.top + (draw_item_struct->rcItem.bottom -
draw_item_struct->rcItem.top - icon.height()) / 2, NULL);
} else if (type == ui::MenuModel::TYPE_CHECK &&
@@ -279,12 +280,13 @@ class NativeMenuWin::MenuHostWindow {
// Draw the background and the check.
NativeTheme::instance()->Paint(
- &canvas, NativeTheme::kMenuCheckBackground, state, bounds, extra);
+ canvas.sk_canvas(), NativeTheme::kMenuCheckBackground,
+ state, bounds, extra);
NativeTheme::instance()->Paint(
- &canvas, NativeTheme::kMenuCheck, state, bounds, extra);
+ canvas.sk_canvas(), NativeTheme::kMenuCheck, state, bounds, extra);
// Draw checkbox to menu.
- skia::DrawToNativeContext(&canvas, dc,
+ skia::DrawToNativeContext(canvas.sk_canvas(), dc,
draw_item_struct->rcItem.left + kItemLeftMargin,
draw_item_struct->rcItem.top + (draw_item_struct->rcItem.bottom -
draw_item_struct->rcItem.top - config.check_height) / 2, NULL);

Powered by Google App Engine
This is Rietveld 408576698