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

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

Issue 113443: ChromeCanvas->gfx::Canvas (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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/chrome_menu.cc ('k') | views/controls/native_control.h » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <atlbase.h> 7 #include <atlbase.h>
8 #include <atlapp.h> 8 #include <atlapp.h>
9 #include <atlwin.h> 9 #include <atlwin.h>
10 #include <atlcrack.h> 10 #include <atlcrack.h>
11 #include <atlframe.h> 11 #include <atlframe.h>
12 #include <atlmisc.h> 12 #include <atlmisc.h>
13 #include <string> 13 #include <string>
14 14
15 #include "app/gfx/chrome_canvas.h" 15 #include "app/gfx/canvas.h"
16 #include "app/gfx/chrome_font.h" 16 #include "app/gfx/font.h"
17 #include "app/l10n_util.h" 17 #include "app/l10n_util.h"
18 #include "app/l10n_util_win.h" 18 #include "app/l10n_util_win.h"
19 #include "base/gfx/rect.h" 19 #include "base/gfx/rect.h"
20 #include "base/logging.h" 20 #include "base/logging.h"
21 #include "base/stl_util-inl.h" 21 #include "base/stl_util-inl.h"
22 #include "base/string_util.h" 22 #include "base/string_util.h"
23 #include "views/accelerator.h" 23 #include "views/accelerator.h"
24 24
25 namespace views { 25 namespace views {
26 26
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 static_cast<int>(label.size()), &rect, format | DT_LEFT, NULL); 181 static_cast<int>(label.size()), &rect, format | DT_LEFT, NULL);
182 if (!accel.empty()) 182 if (!accel.empty())
183 DrawTextEx(hDC, const_cast<wchar_t*>(accel.data()), 183 DrawTextEx(hDC, const_cast<wchar_t*>(accel.data()),
184 static_cast<int>(accel.size()), &rect, 184 static_cast<int>(accel.size()), &rect,
185 format | DT_RIGHT, NULL); 185 format | DT_RIGHT, NULL);
186 SelectObject(hDC, old_font); 186 SelectObject(hDC, old_font);
187 187
188 // Draw the icon after the label, otherwise it would be covered 188 // Draw the icon after the label, otherwise it would be covered
189 // by the label. 189 // by the label.
190 if (data->icon.width() != 0 && data->icon.height() != 0) { 190 if (data->icon.width() != 0 && data->icon.height() != 0) {
191 ChromeCanvas canvas(data->icon.width(), data->icon.height(), false); 191 gfx::Canvas canvas(data->icon.width(), data->icon.height(), false);
192 canvas.drawColor(SK_ColorBLACK, SkPorterDuff::kClear_Mode); 192 canvas.drawColor(SK_ColorBLACK, SkPorterDuff::kClear_Mode);
193 canvas.DrawBitmapInt(data->icon, 0, 0); 193 canvas.DrawBitmapInt(data->icon, 0, 0);
194 canvas.getTopPlatformDevice().drawToHDC(hDC, lpdis->rcItem.left + 194 canvas.getTopPlatformDevice().drawToHDC(hDC, lpdis->rcItem.left +
195 kItemLeftMargin, lpdis->rcItem.top + (lpdis->rcItem.bottom - 195 kItemLeftMargin, lpdis->rcItem.top + (lpdis->rcItem.bottom -
196 lpdis->rcItem.top - data->icon.height()) / 2, NULL); 196 lpdis->rcItem.top - data->icon.height()) / 2, NULL);
197 } 197 }
198 198
199 } else { 199 } else {
200 // Draw the separator 200 // Draw the separator
201 lpdis->rcItem.top += (lpdis->rcItem.bottom - lpdis->rcItem.top) / 3; 201 lpdis->rcItem.top += (lpdis->rcItem.bottom - lpdis->rcItem.top) / 3;
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 break; 556 break;
557 557
558 default: 558 default:
559 NOTREACHED(); 559 NOTREACHED();
560 return 0; 560 return 0;
561 } 561 }
562 return align_flags; 562 return align_flags;
563 } 563 }
564 564
565 } // namespace views 565 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/menu/chrome_menu.cc ('k') | views/controls/native_control.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698