summaryrefslogtreecommitdiff
path: root/gtk/gtkcssstylefuncs.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2013-06-24 12:53:53 +0200
committerAlexander Larsson <alexl@redhat.com>2013-07-03 14:39:25 +0200
commit6cc5d2979290987582eb93de530be3cabcf5b22d (patch)
tree3d0185318f558f3c5d0b87cbc3ca6af1af59dbb7 /gtk/gtkcssstylefuncs.c
parentae43f9facbfa756915989dcd7ddd7b3497ffa323 (diff)
downloadgtk+-6cc5d2979290987582eb93de530be3cabcf5b22d.tar.gz
Use gdk_cairo_surface_create_from_pixbuf when possible
Diffstat (limited to 'gtk/gtkcssstylefuncs.c')
-rw-r--r--gtk/gtkcssstylefuncs.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/gtk/gtkcssstylefuncs.c b/gtk/gtkcssstylefuncs.c
index b6fefcab73..3a5e10c5a2 100644
--- a/gtk/gtkcssstylefuncs.c
+++ b/gtk/gtkcssstylefuncs.c
@@ -766,7 +766,6 @@ pattern_value_parse (GtkCssParser *parser,
GFile *file;
cairo_surface_t *surface;
cairo_pattern_t *pattern;
- cairo_t *cr;
cairo_matrix_t matrix;
file = _gtk_css_parser_read_url (parser);
@@ -784,21 +783,15 @@ pattern_value_parse (GtkCssParser *parser,
return FALSE;
}
- surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
- gdk_pixbuf_get_width (pixbuf),
- gdk_pixbuf_get_height (pixbuf));
- cr = cairo_create (surface);
- gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
- cairo_paint (cr);
+ surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, 1, NULL);
pattern = cairo_pattern_create_for_surface (surface);
+ cairo_surface_destroy (surface);
cairo_matrix_init_scale (&matrix,
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf));
cairo_pattern_set_matrix (pattern, &matrix);
- cairo_surface_destroy (surface);
- cairo_destroy (cr);
g_object_unref (pixbuf);
g_value_take_boxed (value, pattern);