| 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-inl.h" | 10 #include "base/stl_util-inl.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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.drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode); |
| 190 canvas.DrawBitmapInt(data->icon, 0, 0); | 190 canvas.DrawBitmapInt(data->icon, 0, 0); |
| 191 canvas.getTopPlatformDevice().drawToHDC(hDC, lpdis->rcItem.left + | 191 skia::DrawToNativeContext( |
| 192 kItemLeftMargin, lpdis->rcItem.top + (lpdis->rcItem.bottom - | 192 &canvas, hDC, lpdis->rcItem.left + kItemLeftMargin, |
| 193 lpdis->rcItem.top - data->icon.height()) / 2, NULL); | 193 lpdis->rcItem.top + (lpdis->rcItem.bottom - lpdis->rcItem.top - |
| 194 data->icon.height()) / 2, NULL); |
| 194 } | 195 } |
| 195 | 196 |
| 196 } else { | 197 } else { |
| 197 // Draw the separator | 198 // Draw the separator |
| 198 lpdis->rcItem.top += (lpdis->rcItem.bottom - lpdis->rcItem.top) / 3; | 199 lpdis->rcItem.top += (lpdis->rcItem.bottom - lpdis->rcItem.top) / 3; |
| 199 DrawEdge(hDC, &lpdis->rcItem, EDGE_ETCHED, BF_TOP); | 200 DrawEdge(hDC, &lpdis->rcItem, EDGE_ETCHED, BF_TOP); |
| 200 } | 201 } |
| 201 | 202 |
| 202 SetBkColor(hDC, prev_bg_color); | 203 SetBkColor(hDC, prev_bg_color); |
| 203 SetTextColor(hDC, prev_text_color); | 204 SetTextColor(hDC, prev_text_color); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 break; | 567 break; |
| 567 | 568 |
| 568 default: | 569 default: |
| 569 NOTREACHED(); | 570 NOTREACHED(); |
| 570 return 0; | 571 return 0; |
| 571 } | 572 } |
| 572 return align_flags; | 573 return align_flags; |
| 573 } | 574 } |
| 574 | 575 |
| 575 } // namespace views | 576 } // namespace views |
| OLD | NEW |