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

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

Issue 10824402: Convert ui::MenuModel to use gfx::Image instead of ImageSkia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another day, another rebase Created 8 years, 4 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
« no previous file with comments | « ui/views/controls/menu/menu_model_adapter_unittest.cc ('k') | ui/views/view_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/menu/native_menu_win.cc
diff --git a/ui/views/controls/menu/native_menu_win.cc b/ui/views/controls/menu/native_menu_win.cc
index 44df996cccdfd5456d17ec5736fd06044292f01b..a6397ee00c41134940c1599978a56107c8bf3392 100644
--- a/ui/views/controls/menu/native_menu_win.cc
+++ b/ui/views/controls/menu/native_menu_win.cc
@@ -21,6 +21,7 @@
#include "ui/base/win/hwnd_util.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/font.h"
+#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/rect.h"
#include "ui/views/controls/menu/menu_2.h"
@@ -252,17 +253,19 @@ class NativeMenuWin::MenuHostWindow {
// Draw the icon after the label, otherwise it would be covered
// by the label.
- gfx::ImageSkia icon;
+ gfx::Image icon;
if (data->native_menu_win->model_->GetIconAt(data->model_index, &icon)) {
// We currently don't support items with both icons and checkboxes.
+ const gfx::ImageSkia* skia_icon = icon.ToImageSkia();
DCHECK(type != ui::MenuModel::TYPE_CHECK);
- gfx::Canvas canvas(icon.GetRepresentation(ui::SCALE_FACTOR_100P),
- false);
+ gfx::Canvas canvas(
+ skia_icon->GetRepresentation(ui::SCALE_FACTOR_100P),
+ false);
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 - icon.height()) / 2, NULL);
+ draw_item_struct->rcItem.top - skia_icon->height()) / 2, NULL);
} else if (type == ui::MenuModel::TYPE_CHECK &&
data->native_menu_win->model_->IsItemCheckedAt(
data->model_index)) {
« no previous file with comments | « ui/views/controls/menu/menu_model_adapter_unittest.cc ('k') | ui/views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698