OLD | NEW |
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 "chrome/browser/ui/gtk/gtk_theme_service.h" | 5 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 SkBitmap* GtkThemeService::GenerateFrameImage( | 983 SkBitmap* GtkThemeService::GenerateFrameImage( |
984 int color_id, | 984 int color_id, |
985 const char* gradient_name) const { | 985 const char* gradient_name) const { |
986 // We use two colors: the main color (passed in) and a lightened version of | 986 // We use two colors: the main color (passed in) and a lightened version of |
987 // that color (which is supposed to match the light gradient at the top of | 987 // that color (which is supposed to match the light gradient at the top of |
988 // several GTK+ themes, such as Ambiance, Clearlooks or Bluebird). | 988 // several GTK+ themes, such as Ambiance, Clearlooks or Bluebird). |
989 ColorMap::const_iterator it = colors_.find(color_id); | 989 ColorMap::const_iterator it = colors_.find(color_id); |
990 DCHECK(it != colors_.end()); | 990 DCHECK(it != colors_.end()); |
991 SkColor base = it->second; | 991 SkColor base = it->second; |
992 | 992 |
993 gfx::CanvasSkia canvas(kToolbarImageWidth, kToolbarImageHeight, true); | 993 gfx::CanvasSkia canvas; |
| 994 canvas.Init(kToolbarImageWidth, kToolbarImageHeight, true); |
994 | 995 |
995 int gradient_size; | 996 int gradient_size; |
996 const GdkColor* gradient_top_color = NULL; | 997 const GdkColor* gradient_top_color = NULL; |
997 gtk_widget_style_get(GTK_WIDGET(fake_frame_), | 998 gtk_widget_style_get(GTK_WIDGET(fake_frame_), |
998 "frame-gradient-size", &gradient_size, | 999 "frame-gradient-size", &gradient_size, |
999 gradient_name, &gradient_top_color, | 1000 gradient_name, &gradient_top_color, |
1000 NULL); | 1001 NULL); |
1001 if (gradient_size) { | 1002 if (gradient_size) { |
1002 SkColor lighter = gradient_top_color ? GdkToSkColor(gradient_top_color) | 1003 SkColor lighter = gradient_top_color ? GdkToSkColor(gradient_top_color) |
1003 : color_utils::HSLShift(base, kGtkFrameShift); | 1004 : color_utils::HSLShift(base, kGtkFrameShift); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 cairo_set_line_width(cr, 1.0); | 1134 cairo_set_line_width(cr, 1.0); |
1134 cairo_move_to(cr, start_x, widget->allocation.y); | 1135 cairo_move_to(cr, start_x, widget->allocation.y); |
1135 cairo_line_to(cr, start_x, | 1136 cairo_line_to(cr, start_x, |
1136 widget->allocation.y + widget->allocation.height); | 1137 widget->allocation.y + widget->allocation.height); |
1137 cairo_stroke(cr); | 1138 cairo_stroke(cr); |
1138 cairo_destroy(cr); | 1139 cairo_destroy(cr); |
1139 cairo_pattern_destroy(pattern); | 1140 cairo_pattern_destroy(pattern); |
1140 | 1141 |
1141 return TRUE; | 1142 return TRUE; |
1142 } | 1143 } |
OLD | NEW |