[gtk+] cssimage: Return the loaded image from compute()



commit e3cd958e369395c45d18ba1a3673dfb2d5247d95
Author: Benjamin Otte <otte redhat com>
Date:   Sat Feb 2 00:23:31 2013 +0100

    cssimage: Return the loaded image from compute()
    
    This way, we don't keep the indirection when actually rendering the
    image.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=692934

 gtk/gtkcssimageurl.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcssimageurl.c b/gtk/gtkcssimageurl.c
index 7462895..2b51d35 100644
--- a/gtk/gtkcssimageurl.c
+++ b/gtk/gtkcssimageurl.c
@@ -61,6 +61,19 @@ gtk_css_image_url_draw (GtkCssImage        *image,
   _gtk_css_image_draw (url->loaded_image, cr, width, height);
 }
 
+static GtkCssImage *
+gtk_css_image_url_compute (GtkCssImage             *image,
+                           guint                    property_id,
+                           GtkStyleProviderPrivate *provider,
+                           GtkCssComputedValues    *values,
+                           GtkCssComputedValues    *parent_values,
+                           GtkCssDependencies      *dependencies)
+{
+  GtkCssImageUrl *url = GTK_CSS_IMAGE_URL (image);
+
+  return g_object_ref (url->loaded_image);
+}
+
 static gboolean
 gtk_css_image_url_parse (GtkCssImage  *image,
                          GtkCssParser *parser)
@@ -140,6 +153,7 @@ _gtk_css_image_url_class_init (GtkCssImageUrlClass *klass)
   image_class->get_width = gtk_css_image_url_get_width;
   image_class->get_height = gtk_css_image_url_get_height;
   image_class->get_aspect_ratio = gtk_css_image_url_get_aspect_ratio;
+  image_class->compute = gtk_css_image_url_compute;
   image_class->draw = gtk_css_image_url_draw;
   image_class->parse = gtk_css_image_url_parse;
   image_class->print = gtk_css_image_url_print;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]