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

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

Issue 24262008: Revert 224473 "Remove dependency on ui::ScaleFactor from ui/gfx" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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
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 = data->icon.GetRepresentation(1.0f); 186 gfx::ImageSkiaRep icon_image_rep =
187 data->icon.GetRepresentation(ui::SCALE_FACTOR_100P);
187 if (data->icon.width() != 0 && data->icon.height() != 0) { 188 if (data->icon.width() != 0 && data->icon.height() != 0) {
188 gfx::Canvas canvas(icon_image_rep, false); 189 gfx::Canvas canvas(icon_image_rep, false);
189 skia::DrawToNativeContext( 190 skia::DrawToNativeContext(
190 canvas.sk_canvas(), hDC, lpdis->rcItem.left + kItemLeftMargin, 191 canvas.sk_canvas(), hDC, lpdis->rcItem.left + kItemLeftMargin,
191 lpdis->rcItem.top + (lpdis->rcItem.bottom - lpdis->rcItem.top - 192 lpdis->rcItem.top + (lpdis->rcItem.bottom - lpdis->rcItem.top -
192 data->icon.height()) / 2, NULL); 193 data->icon.height()) / 2, NULL);
193 } 194 }
194 195
195 } else { 196 } else {
196 // Draw the separator 197 // Draw the separator
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 break; 565 break;
565 566
566 default: 567 default:
567 NOTREACHED(); 568 NOTREACHED();
568 return 0; 569 return 0;
569 } 570 }
570 return align_flags; 571 return align_flags;
571 } 572 }
572 573
573 } // namespace views 574 } // namespace views
OLDNEW
« no previous file with comments | « trunk/src/ui/views/controls/glow_hover_controller.cc ('k') | trunk/src/ui/views/controls/menu/native_menu_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698