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

Side by Side Diff: views/controls/menu/menu_separator_win.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_separator.h" 5 #include "views/controls/menu/menu_separator.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <uxtheme.h> 8 #include <uxtheme.h>
9 #include <Vssym32.h> 9 #include <Vssym32.h>
10 10
(...skipping 10 matching lines...) Expand all
21 // The gutter is rendered before the background. 21 // The gutter is rendered before the background.
22 int start_x = 0; 22 int start_x = 0;
23 const gfx::NativeTheme* theme = gfx::NativeTheme::instance(); 23 const gfx::NativeTheme* theme = gfx::NativeTheme::instance();
24 if (config.render_gutter) { 24 if (config.render_gutter) {
25 // If render_gutter is true, we're on Vista and need to render the 25 // If render_gutter is true, we're on Vista and need to render the
26 // gutter, then indent the separator from the gutter. 26 // gutter, then indent the separator from the gutter.
27 gfx::Rect gutter_bounds(MenuItemView::label_start() - 27 gfx::Rect gutter_bounds(MenuItemView::label_start() -
28 config.gutter_to_label - config.gutter_width, 0, 28 config.gutter_to_label - config.gutter_width, 0,
29 config.gutter_width, height()); 29 config.gutter_width, height());
30 gfx::NativeTheme::ExtraParams extra; 30 gfx::NativeTheme::ExtraParams extra;
31 theme->Paint(canvas->AsCanvasSkia(), gfx::NativeTheme::kMenuPopupGutter, 31 theme->Paint(canvas->GetSkCanvas(), gfx::NativeTheme::kMenuPopupGutter,
32 gfx::NativeTheme::kNormal, gutter_bounds, extra); 32 gfx::NativeTheme::kNormal, gutter_bounds, extra);
33 start_x = gutter_bounds.x() + config.gutter_width; 33 start_x = gutter_bounds.x() + config.gutter_width;
34 } 34 }
35 35
36 gfx::Rect separator_bounds(start_x, 0, width(), height()); 36 gfx::Rect separator_bounds(start_x, 0, width(), height());
37 gfx::NativeTheme::ExtraParams extra; 37 gfx::NativeTheme::ExtraParams extra;
38 extra.menu_separator.has_gutter = config.render_gutter; 38 extra.menu_separator.has_gutter = config.render_gutter;
39 theme->Paint(canvas->AsCanvasSkia(), gfx::NativeTheme::kMenuPopupSeparator, 39 theme->Paint(canvas->GetSkCanvas(), gfx::NativeTheme::kMenuPopupSeparator,
40 gfx::NativeTheme::kNormal, separator_bounds, extra); 40 gfx::NativeTheme::kNormal, separator_bounds, extra);
41 } 41 }
42 42
43 gfx::Size MenuSeparator::GetPreferredSize() { 43 gfx::Size MenuSeparator::GetPreferredSize() {
44 return gfx::Size(10, // Just in case we're the only item in a menu. 44 return gfx::Size(10, // Just in case we're the only item in a menu.
45 MenuConfig::instance().separator_height); 45 MenuConfig::instance().separator_height);
46 } 46 }
47 47
48 } // namespace views 48 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698