| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |