| OLD | NEW |
| 1 | 1 |
| 2 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 6 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1210 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); | 1210 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); |
| 1211 gdk_cairo_rectangle(cr, &event->area); | 1211 gdk_cairo_rectangle(cr, &event->area); |
| 1212 cairo_clip(cr); | 1212 cairo_clip(cr); |
| 1213 | 1213 |
| 1214 GdkColor bottom_color = GetGdkColor(ThemeService::COLOR_TOOLBAR); | 1214 GdkColor bottom_color = GetGdkColor(ThemeService::COLOR_TOOLBAR); |
| 1215 double bottom_color_rgb[] = { | 1215 double bottom_color_rgb[] = { |
| 1216 static_cast<double>(bottom_color.red / 257) / 255.0, | 1216 static_cast<double>(bottom_color.red / 257) / 255.0, |
| 1217 static_cast<double>(bottom_color.green / 257) / 255.0, | 1217 static_cast<double>(bottom_color.green / 257) / 255.0, |
| 1218 static_cast<double>(bottom_color.blue / 257) / 255.0, }; | 1218 static_cast<double>(bottom_color.blue / 257) / 255.0, }; |
| 1219 | 1219 |
| 1220 GtkAllocation allocation; |
| 1221 gtk_widget_get_allocation(widget, &allocation); |
| 1222 |
| 1220 cairo_pattern_t* pattern = | 1223 cairo_pattern_t* pattern = |
| 1221 cairo_pattern_create_linear(widget->allocation.x, widget->allocation.y, | 1224 cairo_pattern_create_linear(allocation.x, allocation.y, |
| 1222 widget->allocation.x, | 1225 allocation.x, |
| 1223 widget->allocation.y + | 1226 allocation.y + allocation.height); |
| 1224 widget->allocation.height); | |
| 1225 cairo_pattern_add_color_stop_rgb( | 1227 cairo_pattern_add_color_stop_rgb( |
| 1226 pattern, 0.0, | 1228 pattern, 0.0, |
| 1227 kTopSeparatorColor[0], kTopSeparatorColor[1], kTopSeparatorColor[2]); | 1229 kTopSeparatorColor[0], kTopSeparatorColor[1], kTopSeparatorColor[2]); |
| 1228 cairo_pattern_add_color_stop_rgb( | 1230 cairo_pattern_add_color_stop_rgb( |
| 1229 pattern, 0.5, | 1231 pattern, 0.5, |
| 1230 kMidSeparatorColor[0], kMidSeparatorColor[1], kMidSeparatorColor[2]); | 1232 kMidSeparatorColor[0], kMidSeparatorColor[1], kMidSeparatorColor[2]); |
| 1231 cairo_pattern_add_color_stop_rgb( | 1233 cairo_pattern_add_color_stop_rgb( |
| 1232 pattern, 1.0, | 1234 pattern, 1.0, |
| 1233 bottom_color_rgb[0], bottom_color_rgb[1], bottom_color_rgb[2]); | 1235 bottom_color_rgb[0], bottom_color_rgb[1], bottom_color_rgb[2]); |
| 1234 cairo_set_source(cr, pattern); | 1236 cairo_set_source(cr, pattern); |
| 1235 | 1237 |
| 1236 double start_x = 0.5 + widget->allocation.x; | 1238 double start_x = 0.5 + allocation.x; |
| 1237 cairo_new_path(cr); | 1239 cairo_new_path(cr); |
| 1238 cairo_set_line_width(cr, 1.0); | 1240 cairo_set_line_width(cr, 1.0); |
| 1239 cairo_move_to(cr, start_x, widget->allocation.y); | 1241 cairo_move_to(cr, start_x, allocation.y); |
| 1240 cairo_line_to(cr, start_x, | 1242 cairo_line_to(cr, start_x, allocation.y + allocation.height); |
| 1241 widget->allocation.y + widget->allocation.height); | |
| 1242 cairo_stroke(cr); | 1243 cairo_stroke(cr); |
| 1243 cairo_destroy(cr); | 1244 cairo_destroy(cr); |
| 1244 cairo_pattern_destroy(pattern); | 1245 cairo_pattern_destroy(pattern); |
| 1245 | 1246 |
| 1246 return TRUE; | 1247 return TRUE; |
| 1247 } | 1248 } |
| OLD | NEW |