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

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

Issue 10696130: Get rid of implicit conversion to and from ImageSkiaRep (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | « ui/gfx/image/image_skia_rep.cc ('k') | ui/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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/controls/menu/menu_win.h" 5 #include "ui/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.h" 10 #include "base/stl_util.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 DrawTextEx(hDC, const_cast<wchar_t*>(label.data()), 176 DrawTextEx(hDC, const_cast<wchar_t*>(label.data()),
177 static_cast<int>(label.size()), &rect, format | DT_LEFT, NULL); 177 static_cast<int>(label.size()), &rect, format | DT_LEFT, NULL);
178 if (!accel.empty()) 178 if (!accel.empty())
179 DrawTextEx(hDC, const_cast<wchar_t*>(accel.data()), 179 DrawTextEx(hDC, const_cast<wchar_t*>(accel.data()),
180 static_cast<int>(accel.size()), &rect, 180 static_cast<int>(accel.size()), &rect,
181 format | DT_RIGHT, NULL); 181 format | DT_RIGHT, NULL);
182 SelectObject(hDC, old_font); 182 SelectObject(hDC, old_font);
183 183
184 // Draw the icon after the label, otherwise it would be covered 184 // Draw the icon after the label, otherwise it would be covered
185 // by the label. 185 // by the label.
186 gfx::ImageSkiaRep icon_image_rep =
187 data->icon.GetRepresentation(ui::SCALE_FACTOR_100P);
186 if (data->icon.width() != 0 && data->icon.height() != 0) { 188 if (data->icon.width() != 0 && data->icon.height() != 0) {
187 gfx::Canvas canvas(data->icon, false); 189 gfx::Canvas canvas(icon_image_rep, false);
188 skia::DrawToNativeContext( 190 skia::DrawToNativeContext(
189 canvas.sk_canvas(), hDC, lpdis->rcItem.left + kItemLeftMargin, 191 canvas.sk_canvas(), hDC, lpdis->rcItem.left + kItemLeftMargin,
190 lpdis->rcItem.top + (lpdis->rcItem.bottom - lpdis->rcItem.top - 192 lpdis->rcItem.top + (lpdis->rcItem.bottom - lpdis->rcItem.top -
191 data->icon.height()) / 2, NULL); 193 data->icon.height()) / 2, NULL);
192 } 194 }
193 195
194 } else { 196 } else {
195 // Draw the separator 197 // Draw the separator
196 lpdis->rcItem.top += (lpdis->rcItem.bottom - lpdis->rcItem.top) / 3; 198 lpdis->rcItem.top += (lpdis->rcItem.bottom - lpdis->rcItem.top) / 3;
197 DrawEdge(hDC, &lpdis->rcItem, EDGE_ETCHED, BF_TOP); 199 DrawEdge(hDC, &lpdis->rcItem, EDGE_ETCHED, BF_TOP);
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 break; 565 break;
564 566
565 default: 567 default:
566 NOTREACHED(); 568 NOTREACHED();
567 return 0; 569 return 0;
568 } 570 }
569 return align_flags; 571 return align_flags;
570 } 572 }
571 573
572 } // namespace views 574 } // namespace views
OLDNEW
« no previous file with comments | « ui/gfx/image/image_skia_rep.cc ('k') | ui/views/controls/menu/native_menu_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698