changeset 3031:229db6d72934

don't keep img
author Tomasz Mon <desowin@gmail.com>
date Wed, 11 Jul 2007 12:28:11 +0200
parents 1be4df6e4ae3
children 6e98eedead3a
files src/audacious/ui_skinned_button.c src/audacious/ui_skinned_number.c src/audacious/ui_skinned_number.h src/audacious/ui_skinned_textbox.c
diffstat 4 files changed, 27 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/ui_skinned_button.c	Tue Jul 10 20:16:54 2007 +0200
+++ b/src/audacious/ui_skinned_button.c	Wed Jul 11 12:28:11 2007 +0200
@@ -41,7 +41,6 @@
 
 struct _UiSkinnedButtonPrivate {
     //Skinned part
-    GdkPixmap        *img;
     GdkGC            *gc;
     gint             w;
     gint             h;
@@ -172,7 +171,6 @@
     button->type = TYPE_NOT_SET;
     priv->move_x = 0;
     priv->move_y = 0;
-    priv->img = NULL;
 }
 
 static void ui_skinned_button_destroy (GtkObject *object) {
@@ -290,28 +288,29 @@
             break;
     }
 
-    if (priv->img)
-        g_object_unref(priv->img);
-    priv->img = gdk_pixmap_new(NULL, priv->w*(1+priv->double_size),
-                               priv->h*(1+priv->double_size),
-                               gdk_rgb_get_visual()->depth);
+    GdkPixmap *image;
+    image = gdk_pixmap_new(NULL, priv->w*(1+priv->double_size),
+                                 priv->h*(1+priv->double_size),
+                                 gdk_rgb_get_visual()->depth);
 
     if (priv->double_size) {
         GdkImage *img, *img2x;
         img = gdk_drawable_get_image(obj, 0, 0, priv->w, priv->h);
         img2x = create_dblsize_image(img);
-        gdk_draw_image (priv->img, gc, img2x, 0, 0, 0, 0, priv->w*2, priv->h*2);
+        gdk_draw_image (image, gc, img2x, 0, 0, 0, 0, priv->w*2, priv->h*2);
         g_object_unref(img2x);
         g_object_unref(img);
     } else
-        gdk_draw_drawable (priv->img, gc, obj, 0, 0, 0, 0, priv->w, priv->h);
+        gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, priv->w, priv->h);
 
     g_object_unref(obj);
 
-    gdk_draw_drawable (widget->window, gc, priv->img, 0, 0, 0, 0,
+    gdk_draw_drawable (widget->window, gc, image, 0, 0, 0, 0,
                        priv->w*(1+priv->double_size), priv->h*(1+priv->double_size));
 
     g_object_unref(gc);
+    g_object_unref(image);
+
     return FALSE;
 }
 
--- a/src/audacious/ui_skinned_number.c	Tue Jul 10 20:16:54 2007 +0200
+++ b/src/audacious/ui_skinned_number.c	Wed Jul 11 12:28:11 2007 +0200
@@ -98,7 +98,6 @@
 static void ui_skinned_number_init(UiSkinnedNumber *number) {
     number->width = 9;
     number->height = 13;
-    number->img = NULL;
 }
 
 GtkWidget* ui_skinned_number_new(GtkWidget *fixed, gint x, gint y, SkinPixmapId si) {
@@ -198,27 +197,28 @@
                      number->skin_index, number->num * 9, 0,
                      0, 0, number->width, number->height);
 
-    if (number->img)
-        g_object_unref(number->img);
-    number->img = gdk_pixmap_new(NULL, number->width*(1+number->double_size),
-                                       number->height*(1+number->double_size),
-                                       gdk_rgb_get_visual()->depth);
+    GdkPixmap *image;
+    image = gdk_pixmap_new(NULL, number->width*(1+number->double_size),
+                                 number->height*(1+number->double_size),
+                                 gdk_rgb_get_visual()->depth);
 
     if (number->double_size) {
         GdkImage *img, *img2x;
         img = gdk_drawable_get_image(obj, 0, 0, number->width, number->height);
         img2x = create_dblsize_image(img);
-        gdk_draw_image (number->img, gc, img2x, 0, 0, 0, 0, number->width*2, number->height*2);
+        gdk_draw_image (image, gc, img2x, 0, 0, 0, 0, number->width*2, number->height*2);
         g_object_unref(img2x);
         g_object_unref(img);
     } else
-        gdk_draw_drawable (number->img, gc, obj, 0, 0, 0, 0, number->width, number->height);
+        gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, number->width, number->height);
 
     g_object_unref(obj);
 
-    gdk_draw_drawable (widget->window, gc, number->img, 0, 0, 0, 0,
+    gdk_draw_drawable (widget->window, gc, image, 0, 0, 0, 0,
                        number->width*(1+number->double_size), number->height*(1+number->double_size));
     g_object_unref(gc);
+    g_object_unref(image);
+
     return FALSE;
 }
 
--- a/src/audacious/ui_skinned_number.h	Tue Jul 10 20:16:54 2007 +0200
+++ b/src/audacious/ui_skinned_number.h	Wed Jul 11 12:28:11 2007 +0200
@@ -40,7 +40,6 @@
     gint             x, y, width, height;
     gint             num;
     gboolean         double_size;
-    GdkPixmap        *img;
     SkinPixmapId     skin_index;
     GtkWidget        *fixed;
 };
--- a/src/audacious/ui_skinned_textbox.c	Tue Jul 10 20:16:54 2007 +0200
+++ b/src/audacious/ui_skinned_textbox.c	Wed Jul 11 12:28:11 2007 +0200
@@ -52,7 +52,6 @@
 };
 
 struct _UiSkinnedTextboxPrivate {
-    GdkPixmap        *img;
     SkinPixmapId     skin_index;
     GtkWidget        *fixed;
     gboolean         double_size;
@@ -176,7 +175,6 @@
     priv->resize_height = 0;
     priv->move_x = 0;
     priv->move_y = 0;
-    priv->img = NULL;
 }
 
 GtkWidget* ui_skinned_textbox_new(GtkWidget *fixed, gint x, gint y, gint w, gboolean allow_scroll, SkinPixmapId si) {
@@ -335,28 +333,29 @@
             }
 
         }
-    if (priv->img)
-        g_object_unref(priv->img);
-    priv->img = gdk_pixmap_new(NULL, textbox->width*(1+priv->double_size),
-                               textbox->height*(1+priv->double_size),
-                               gdk_rgb_get_visual()->depth);
+
+    GdkPixmap *image;
+    image = gdk_pixmap_new(NULL, textbox->width*(1+priv->double_size),
+                                 textbox->height*(1+priv->double_size),
+                                 gdk_rgb_get_visual()->depth);
 
     if (priv->double_size) {
         GdkImage *img, *img2x;
         img = gdk_drawable_get_image(obj, 0, 0, textbox->width, textbox->height);
         img2x = create_dblsize_image(img);
-        gdk_draw_image (priv->img, gc, img2x, 0, 0, 0, 0, textbox->width*2, textbox->height*2);
+        gdk_draw_image (image, gc, img2x, 0, 0, 0, 0, textbox->width*2, textbox->height*2);
         g_object_unref(img2x);
         g_object_unref(img);
     } else
-        gdk_draw_drawable (priv->img, gc, obj, 0, 0, 0, 0, textbox->width, textbox->height);
+        gdk_draw_drawable (image, gc, obj, 0, 0, 0, 0, textbox->width, textbox->height);
 
 
         g_object_unref(obj);
 
-        gdk_draw_drawable (widget->window, gc, priv->img, 0, 0, 0, 0,
+        gdk_draw_drawable (widget->window, gc, image, 0, 0, 0, 0,
                            textbox->width*(1+priv->double_size), textbox->height*(1+priv->double_size));
         g_object_unref(gc);
+        g_object_unref(image);
     }
 
     return FALSE;