OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 206 |
207 SkBitmap fill_color; | 207 SkBitmap fill_color; |
208 fill_color.setConfig(SkBitmap::kARGB_8888_Config, | 208 fill_color.setConfig(SkBitmap::kARGB_8888_Config, |
209 original.width(), original.height(), 0); | 209 original.width(), original.height(), 0); |
210 fill_color.allocPixels(); | 210 fill_color.allocPixels(); |
211 fill_color.eraseColor(color); | 211 fill_color.eraseColor(color); |
212 SkBitmap masked = SkBitmapOperations::CreateMaskedBitmap( | 212 SkBitmap masked = SkBitmapOperations::CreateMaskedBitmap( |
213 fill_color, original); | 213 fill_color, original); |
214 | 214 |
215 GtkIconSource* icon = gtk_icon_source_new(); | 215 GtkIconSource* icon = gtk_icon_source_new(); |
216 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&masked); | 216 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(masked); |
217 gtk_icon_source_set_pixbuf(icon, pixbuf); | 217 gtk_icon_source_set_pixbuf(icon, pixbuf); |
218 g_object_unref(pixbuf); | 218 g_object_unref(pixbuf); |
219 | 219 |
220 gtk_icon_source_set_direction_wildcarded(icon, TRUE); | 220 gtk_icon_source_set_direction_wildcarded(icon, TRUE); |
221 gtk_icon_source_set_size_wildcarded(icon, TRUE); | 221 gtk_icon_source_set_size_wildcarded(icon, TRUE); |
222 | 222 |
223 gtk_icon_source_set_state(icon, state); | 223 gtk_icon_source_set_state(icon, state); |
224 // All fields default to wildcarding being on and setting a property doesn't | 224 // All fields default to wildcarding being on and setting a property doesn't |
225 // turn off wildcarding. You need to do this yourself. This is stated once in | 225 // turn off wildcarding. You need to do this yourself. This is stated once in |
226 // the documentation in the gtk_icon_source_new() function, and no where else. | 226 // the documentation in the gtk_icon_source_new() function, and no where else. |
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 cairo_new_path(cr); | 1149 cairo_new_path(cr); |
1150 cairo_set_line_width(cr, 1.0); | 1150 cairo_set_line_width(cr, 1.0); |
1151 cairo_move_to(cr, start_x, allocation.y); | 1151 cairo_move_to(cr, start_x, allocation.y); |
1152 cairo_line_to(cr, start_x, allocation.y + allocation.height); | 1152 cairo_line_to(cr, start_x, allocation.y + allocation.height); |
1153 cairo_stroke(cr); | 1153 cairo_stroke(cr); |
1154 cairo_destroy(cr); | 1154 cairo_destroy(cr); |
1155 cairo_pattern_destroy(pattern); | 1155 cairo_pattern_destroy(pattern); |
1156 | 1156 |
1157 return TRUE; | 1157 return TRUE; |
1158 } | 1158 } |
OLD | NEW |