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

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

Issue 8122013: Allow CanvasSkia to bind to an existing SkCanvas. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 1 more fix Created 9 years, 2 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) 2011 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_item_view.h" 5 #include "views/controls/menu/menu_item_view.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "grit/ui_resources.h" 8 #include "grit/ui_resources.h"
9 #include "third_party/skia/include/effects/SkGradientShader.h" 9 #include "third_party/skia/include/effects/SkGradientShader.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 int bottom_margin = GetBottomMargin(); 61 int bottom_margin = GetBottomMargin();
62 int icon_y = top_margin + (height() - config.item_top_margin - 62 int icon_y = top_margin + (height() - config.item_top_margin -
63 bottom_margin - config.check_height) / 2; 63 bottom_margin - config.check_height) / 2;
64 int icon_height = config.check_height; 64 int icon_height = config.check_height;
65 int available_height = height() - top_margin - bottom_margin; 65 int available_height = height() - top_margin - bottom_margin;
66 66
67 // Render the background. As MenuScrollViewContainer draws the background, we 67 // Render the background. As MenuScrollViewContainer draws the background, we
68 // only need the background when we want it to look different, as when we're 68 // only need the background when we want it to look different, as when we're
69 // selected. 69 // selected.
70 if (render_selection) 70 if (render_selection)
71 canvas->AsCanvasSkia()->drawColor(kSelectedBackgroundColor, 71 canvas->GetSkCanvas()->drawColor(kSelectedBackgroundColor,
72 SkXfermode::kSrc_Mode); 72 SkXfermode::kSrc_Mode);
73 73
74 // Render the check. 74 // Render the check.
75 if (type_ == CHECKBOX && GetDelegate()->IsItemChecked(GetCommand())) { 75 if (type_ == CHECKBOX && GetDelegate()->IsItemChecked(GetCommand())) {
76 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 76 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
77 SkBitmap* check = rb.GetBitmapNamed(IDR_MENU_CHECK); 77 SkBitmap* check = rb.GetBitmapNamed(IDR_MENU_CHECK);
78 // Don't use config.check_width here as it's padded to force more padding. 78 // Don't use config.check_width here as it's padded to force more padding.
79 gfx::Rect check_bounds(icon_x, icon_y, check->width(), icon_height); 79 gfx::Rect check_bounds(icon_x, icon_y, check->width(), icon_height);
80 AdjustBoundsForRTLUI(&check_bounds); 80 AdjustBoundsForRTLUI(&check_bounds);
81 canvas->DrawBitmapInt(*check, check_bounds.x(), check_bounds.y()); 81 canvas->DrawBitmapInt(*check, check_bounds.x(), check_bounds.y());
82 } else if (type_ == RADIO) { 82 } else if (type_ == RADIO) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 top_margin + (available_height - 132 top_margin + (available_height -
133 config.arrow_width) / 2, 133 config.arrow_width) / 2,
134 config.arrow_width, height()); 134 config.arrow_width, height());
135 AdjustBoundsForRTLUI(&arrow_bounds); 135 AdjustBoundsForRTLUI(&arrow_bounds);
136 canvas->DrawBitmapInt(*GetSubmenuArrowImage(), 136 canvas->DrawBitmapInt(*GetSubmenuArrowImage(),
137 arrow_bounds.x(), arrow_bounds.y()); 137 arrow_bounds.x(), arrow_bounds.y());
138 } 138 }
139 } 139 }
140 140
141 } // namespace views 141 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698