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

Side by Side Diff: chrome/browser/ui/libgtkui/native_theme_gtk2.cc

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: DrawingDisplayItem Created 3 years, 10 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chrome/browser/ui/libgtkui/native_theme_gtk2.h" 5 #include "chrome/browser/ui/libgtkui/native_theme_gtk2.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "chrome/browser/ui/libgtkui/chrome_gtk_frame.h" 9 #include "chrome/browser/ui/libgtkui/chrome_gtk_frame.h"
10 #include "chrome/browser/ui/libgtkui/chrome_gtk_menu_subclasses.h" 10 #include "chrome/browser/ui/libgtkui/chrome_gtk_menu_subclasses.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 CR_DEFINE_STATIC_LOCAL(NativeThemeGtk2, s_native_theme, ()); 64 CR_DEFINE_STATIC_LOCAL(NativeThemeGtk2, s_native_theme, ());
65 return &s_native_theme; 65 return &s_native_theme;
66 } 66 }
67 67
68 // Constructors automatically called 68 // Constructors automatically called
69 NativeThemeGtk2::NativeThemeGtk2() {} 69 NativeThemeGtk2::NativeThemeGtk2() {}
70 // This doesn't actually get called 70 // This doesn't actually get called
71 NativeThemeGtk2::~NativeThemeGtk2() {} 71 NativeThemeGtk2::~NativeThemeGtk2() {}
72 72
73 void NativeThemeGtk2::PaintMenuPopupBackground( 73 void NativeThemeGtk2::PaintMenuPopupBackground(
74 SkCanvas* canvas, 74 cc::PaintCanvas* canvas,
75 const gfx::Size& size, 75 const gfx::Size& size,
76 const MenuBackgroundExtraParams& menu_background) const { 76 const MenuBackgroundExtraParams& menu_background) const {
77 if (menu_background.corner_radius > 0) { 77 if (menu_background.corner_radius > 0) {
78 SkPaint paint; 78 cc::PaintFlags paint;
79 paint.setStyle(SkPaint::kFill_Style); 79 paint.setStyle(cc::PaintFlags::kFill_Style);
80 paint.setFlags(SkPaint::kAntiAlias_Flag); 80 paint.setFlags(cc::PaintFlags::kAntiAlias_Flag);
81 paint.setColor(GetSystemColor(kColorId_MenuBackgroundColor)); 81 paint.setColor(GetSystemColor(kColorId_MenuBackgroundColor));
82 82
83 gfx::Path path; 83 gfx::Path path;
84 SkRect rect = SkRect::MakeWH(SkIntToScalar(size.width()), 84 SkRect rect = SkRect::MakeWH(SkIntToScalar(size.width()),
85 SkIntToScalar(size.height())); 85 SkIntToScalar(size.height()));
86 SkScalar radius = SkIntToScalar(menu_background.corner_radius); 86 SkScalar radius = SkIntToScalar(menu_background.corner_radius);
87 SkScalar radii[8] = {radius, radius, radius, radius, 87 SkScalar radii[8] = {radius, radius, radius, radius,
88 radius, radius, radius, radius}; 88 radius, radius, radius, radius};
89 path.addRoundRect(rect, radii); 89 path.addRoundRect(rect, radii);
90 90
91 canvas->drawPath(path, paint); 91 canvas->drawPath(path, paint);
92 } else { 92 } else {
93 canvas->drawColor(GetSystemColor(kColorId_MenuBackgroundColor), 93 canvas->drawColor(GetSystemColor(kColorId_MenuBackgroundColor),
94 SkBlendMode::kSrc); 94 SkBlendMode::kSrc);
95 } 95 }
96 } 96 }
97 97
98 void NativeThemeGtk2::PaintMenuItemBackground( 98 void NativeThemeGtk2::PaintMenuItemBackground(
99 SkCanvas* canvas, 99 cc::PaintCanvas* canvas,
100 State state, 100 State state,
101 const gfx::Rect& rect, 101 const gfx::Rect& rect,
102 const MenuItemExtraParams& menu_item) const { 102 const MenuItemExtraParams& menu_item) const {
103 SkColor color; 103 SkColor color;
104 SkPaint paint; 104 cc::PaintFlags paint;
105 switch (state) { 105 switch (state) {
106 case NativeTheme::kNormal: 106 case NativeTheme::kNormal:
107 case NativeTheme::kDisabled: 107 case NativeTheme::kDisabled:
108 color = GetSystemColor(NativeTheme::kColorId_MenuBackgroundColor); 108 color = GetSystemColor(NativeTheme::kColorId_MenuBackgroundColor);
109 paint.setColor(color); 109 paint.setColor(color);
110 break; 110 break;
111 case NativeTheme::kHovered: 111 case NativeTheme::kHovered:
112 color = 112 color =
113 GetSystemColor(NativeTheme::kColorId_FocusedMenuItemBackgroundColor); 113 GetSystemColor(NativeTheme::kColorId_FocusedMenuItemBackgroundColor);
114 paint.setColor(color); 114 paint.setColor(color);
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 GtkWidget* NativeThemeGtk2::GetSeparator() const { 462 GtkWidget* NativeThemeGtk2::GetSeparator() const {
463 static GtkWidget* fake_separator = NULL; 463 static GtkWidget* fake_separator = NULL;
464 464
465 if (!fake_separator) 465 if (!fake_separator)
466 fake_separator = gtk_hseparator_new(); 466 fake_separator = gtk_hseparator_new();
467 467
468 return fake_separator; 468 return fake_separator;
469 } 469 }
470 470
471 } // namespace libgtkui 471 } // namespace libgtkui
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtkui/native_theme_gtk2.h ('k') | chrome/browser/ui/libgtkui/native_theme_gtk3.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698