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

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

Issue 2715153002: Gtk3: Refactor GtkButtonImageSource::GetImageForScale (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « chrome/browser/ui/libgtkui/gtk_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_gtk3.h" 5 #include "chrome/browser/ui/libgtkui/native_theme_gtk3.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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 void PaintWidget(cc::PaintCanvas* canvas, 56 void PaintWidget(cc::PaintCanvas* canvas,
57 const gfx::Rect& rect, 57 const gfx::Rect& rect,
58 GtkStyleContext* context, 58 GtkStyleContext* context,
59 BackgroundRenderMode bg_mode, 59 BackgroundRenderMode bg_mode,
60 bool render_frame) { 60 bool render_frame) {
61 canvas->drawBitmap( 61 canvas->drawBitmap(
62 GetWidgetBitmap(rect.size(), context, bg_mode, render_frame), rect.x(), 62 GetWidgetBitmap(rect.size(), context, bg_mode, render_frame), rect.x(),
63 rect.y()); 63 rect.y());
64 } 64 }
65 65
66 GtkStateFlags StateToStateFlags(NativeThemeGtk3::State state) {
67 switch (state) {
68 case NativeThemeGtk3::kDisabled:
69 return GTK_STATE_FLAG_INSENSITIVE;
70 case NativeThemeGtk3::kHovered:
71 return GTK_STATE_FLAG_PRELIGHT;
72 case NativeThemeGtk3::kNormal:
73 return GTK_STATE_FLAG_NORMAL;
74 case NativeThemeGtk3::kPressed:
75 return static_cast<GtkStateFlags>(GTK_STATE_FLAG_PRELIGHT |
76 GTK_STATE_FLAG_ACTIVE);
77 default:
78 NOTREACHED();
79 return GTK_STATE_FLAG_NORMAL;
80 }
81 }
82
83 SkColor SkColorFromColorId(ui::NativeTheme::ColorId color_id) { 66 SkColor SkColorFromColorId(ui::NativeTheme::ColorId color_id) {
84 const SkColor kPositiveTextColor = SkColorSetRGB(0x0b, 0x80, 0x43); 67 const SkColor kPositiveTextColor = SkColorSetRGB(0x0b, 0x80, 0x43);
85 const SkColor kNegativeTextColor = SkColorSetRGB(0xc5, 0x39, 0x29); 68 const SkColor kNegativeTextColor = SkColorSetRGB(0xc5, 0x39, 0x29);
86 69
87 switch (color_id) { 70 switch (color_id) {
88 // Windows 71 // Windows
89 case ui::NativeTheme::kColorId_WindowBackground: 72 case ui::NativeTheme::kColorId_WindowBackground:
90 // Dialogs 73 // Dialogs
91 case ui::NativeTheme::kColorId_DialogBackground: 74 case ui::NativeTheme::kColorId_DialogBackground:
92 case ui::NativeTheme::kColorId_BubbleBackground: 75 case ui::NativeTheme::kColorId_BubbleBackground:
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 587
605 if (frame_top_area.incognito) { 588 if (frame_top_area.incognito) {
606 bitmap = SkBitmapOperations::CreateHSLShiftedBitmap( 589 bitmap = SkBitmapOperations::CreateHSLShiftedBitmap(
607 bitmap, kDefaultTintFrameIncognito); 590 bitmap, kDefaultTintFrameIncognito);
608 } 591 }
609 592
610 canvas->drawBitmap(bitmap, rect.x(), rect.y()); 593 canvas->drawBitmap(bitmap, rect.x(), rect.y());
611 } 594 }
612 595
613 } // namespace libgtkui 596 } // namespace libgtkui
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtkui/gtk_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698