OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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.h" | 10 #include "base/stl_util.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(data->icon.width(), data->icon.height(), false); |
189 canvas.drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode); | 189 canvas.sk_canvas()->drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode); |
190 canvas.DrawBitmapInt(data->icon, 0, 0); | 190 canvas.DrawBitmapInt(data->icon, 0, 0); |
191 skia::DrawToNativeContext( | 191 skia::DrawToNativeContext( |
192 &canvas, hDC, lpdis->rcItem.left + kItemLeftMargin, | 192 canvas.sk_canvas(), hDC, lpdis->rcItem.left + kItemLeftMargin, |
193 lpdis->rcItem.top + (lpdis->rcItem.bottom - lpdis->rcItem.top - | 193 lpdis->rcItem.top + (lpdis->rcItem.bottom - lpdis->rcItem.top - |
194 data->icon.height()) / 2, NULL); | 194 data->icon.height()) / 2, NULL); |
195 } | 195 } |
196 | 196 |
197 } else { | 197 } else { |
198 // Draw the separator | 198 // Draw the separator |
199 lpdis->rcItem.top += (lpdis->rcItem.bottom - lpdis->rcItem.top) / 3; | 199 lpdis->rcItem.top += (lpdis->rcItem.bottom - lpdis->rcItem.top) / 3; |
200 DrawEdge(hDC, &lpdis->rcItem, EDGE_ETCHED, BF_TOP); | 200 DrawEdge(hDC, &lpdis->rcItem, EDGE_ETCHED, BF_TOP); |
201 } | 201 } |
202 | 202 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 break; | 567 break; |
568 | 568 |
569 default: | 569 default: |
570 NOTREACHED(); | 570 NOTREACHED(); |
571 return 0; | 571 return 0; |
572 } | 572 } |
573 return align_flags; | 573 return align_flags; |
574 } | 574 } |
575 | 575 |
576 } // namespace views | 576 } // namespace views |
OLD | NEW |