[gtk+] cssimage: Add a getter



commit b2e1b1124f4b5a5fcf83474aa3eed8fda547c66a
Author: Benjamin Otte <otte redhat com>
Date:   Sat Feb 2 01:11:25 2013 +0100

    cssimage: Add a getter
    
    This will be needed in the next commit.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=692934

 gtk/gtkcssimageurl.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkcssimageurl.c b/gtk/gtkcssimageurl.c
index 2b51d35..eb5d92b 100644
--- a/gtk/gtkcssimageurl.c
+++ b/gtk/gtkcssimageurl.c
@@ -26,12 +26,18 @@
 
 G_DEFINE_TYPE (GtkCssImageUrl, _gtk_css_image_url, GTK_TYPE_CSS_IMAGE)
 
+static GtkCssImage *
+gtk_css_image_url_load_image (GtkCssImageUrl *url)
+{
+  return url->loaded_image;
+}
+
 static int
 gtk_css_image_url_get_width (GtkCssImage *image)
 {
   GtkCssImageUrl *url = GTK_CSS_IMAGE_URL (image);
 
-  return _gtk_css_image_get_width (url->loaded_image);
+  return _gtk_css_image_get_width (gtk_css_image_url_load_image (url));
 }
 
 static int
@@ -39,7 +45,7 @@ gtk_css_image_url_get_height (GtkCssImage *image)
 {
   GtkCssImageUrl *url = GTK_CSS_IMAGE_URL (image);
 
-  return _gtk_css_image_get_height (url->loaded_image);
+  return _gtk_css_image_get_height (gtk_css_image_url_load_image (url));
 }
 
 static double
@@ -47,7 +53,7 @@ gtk_css_image_url_get_aspect_ratio (GtkCssImage *image)
 {
   GtkCssImageUrl *url = GTK_CSS_IMAGE_URL (image);
 
-  return _gtk_css_image_get_aspect_ratio (url->loaded_image);
+  return _gtk_css_image_get_aspect_ratio (gtk_css_image_url_load_image (url));
 }
 
 static void
@@ -58,7 +64,7 @@ gtk_css_image_url_draw (GtkCssImage        *image,
 {
   GtkCssImageUrl *url = GTK_CSS_IMAGE_URL (image);
 
-  _gtk_css_image_draw (url->loaded_image, cr, width, height);
+  _gtk_css_image_draw (gtk_css_image_url_load_image (url), cr, width, height);
 }
 
 static GtkCssImage *
@@ -71,7 +77,7 @@ gtk_css_image_url_compute (GtkCssImage             *image,
 {
   GtkCssImageUrl *url = GTK_CSS_IMAGE_URL (image);
 
-  return g_object_ref (url->loaded_image);
+  return g_object_ref (gtk_css_image_url_load_image (url));
 }
 
 static gboolean
@@ -130,7 +136,7 @@ gtk_css_image_url_print (GtkCssImage *image,
 {
   GtkCssImageUrl *url = GTK_CSS_IMAGE_URL (image);
 
-  _gtk_css_image_print (url->loaded_image, string);
+  _gtk_css_image_print (gtk_css_image_url_load_image (url), string);
 }
 
 static void



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