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

Side by Side Diff: views/controls/menu/menu_win.cc

Issue 6879013: skia::PlatformCanvas is being deprecated. Going forward we will use gfx::Canvas wherever we need ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/controls/menu/menu_separator_win.cc ('k') | views/controls/menu/native_menu_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "views/controls/menu/menu_win.h" 5 #include "views/controls/menu/menu_win.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util-inl.h" 10 #include "base/stl_util-inl.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 static_cast<int>(label.size()), &rect, format | DT_LEFT, NULL); 178 static_cast<int>(label.size()), &rect, format | DT_LEFT, NULL);
179 if (!accel.empty()) 179 if (!accel.empty())
180 DrawTextEx(hDC, const_cast<wchar_t*>(accel.data()), 180 DrawTextEx(hDC, const_cast<wchar_t*>(accel.data()),
181 static_cast<int>(accel.size()), &rect, 181 static_cast<int>(accel.size()), &rect,
182 format | DT_RIGHT, NULL); 182 format | DT_RIGHT, NULL);
183 SelectObject(hDC, old_font); 183 SelectObject(hDC, old_font);
184 184
185 // Draw the icon after the label, otherwise it would be covered 185 // Draw the icon after the label, otherwise it would be covered
186 // by the label. 186 // by the label.
187 if (data->icon.width() != 0 && data->icon.height() != 0) { 187 if (data->icon.width() != 0 && data->icon.height() != 0) {
188 gfx::CanvasSkia canvas(data->icon.width(), data->icon.height(), false); 188 gfx::CanvasSkia canvas;
189 canvas.drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode); 189 canvas.Init(data->icon.width(), data->icon.height(), false);
190 canvas.skia_canvas()->drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode);
190 canvas.DrawBitmapInt(data->icon, 0, 0); 191 canvas.DrawBitmapInt(data->icon, 0, 0);
191 canvas.getTopPlatformDevice().drawToHDC(hDC, lpdis->rcItem.left + 192 canvas.BlitToNativeContext(
192 kItemLeftMargin, lpdis->rcItem.top + (lpdis->rcItem.bottom - 193 gfx::Rect(data->icon.width(), data->icon.height()),
193 lpdis->rcItem.top - data->icon.height()) / 2, NULL); 194 gfx::Point(lpdis->rcItem.left + kItemLeftMargin,
195 lpdis->rcItem.top + (lpdis->rcItem.bottom -
196 lpdis->rcItem.top - data->icon.height()) / 2),
197 hDC);
194 } 198 }
195
196 } else { 199 } else {
197 // Draw the separator 200 // Draw the separator
198 lpdis->rcItem.top += (lpdis->rcItem.bottom - lpdis->rcItem.top) / 3; 201 lpdis->rcItem.top += (lpdis->rcItem.bottom - lpdis->rcItem.top) / 3;
199 DrawEdge(hDC, &lpdis->rcItem, EDGE_ETCHED, BF_TOP); 202 DrawEdge(hDC, &lpdis->rcItem, EDGE_ETCHED, BF_TOP);
200 } 203 }
201 204
202 SetBkColor(hDC, prev_bg_color); 205 SetBkColor(hDC, prev_bg_color);
203 SetTextColor(hDC, prev_text_color); 206 SetTextColor(hDC, prev_text_color);
204 } 207 }
205 208
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 break; 569 break;
567 570
568 default: 571 default:
569 NOTREACHED(); 572 NOTREACHED();
570 return 0; 573 return 0;
571 } 574 }
572 return align_flags; 575 return align_flags;
573 } 576 }
574 577
575 } // namespace views 578 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/menu/menu_separator_win.cc ('k') | views/controls/menu/native_menu_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698