diff src/audacious/util.c @ 4212:47352b34dbdf

introduce ui_skinned_widget_draw
author Tomasz Mon <desowin@gmail.com>
date Tue, 22 Jan 2008 22:40:48 +0100
parents e474286a4c23
children 41655c090c53
line wrap: on
line diff
--- a/src/audacious/util.c	Mon Jan 21 02:46:44 2008 +0200
+++ b/src/audacious/util.c	Tue Jan 22 22:40:48 2008 +0100
@@ -908,6 +908,19 @@
     return image;
 }
 
+void ui_skinned_widget_draw(GtkWidget *widget, GdkPixbuf *obj, gint width, gint height, gboolean scale) {
+    g_return_if_fail(widget != NULL);
+    g_return_if_fail(obj != NULL);
+
+    if (scale) {
+        GdkPixbuf *image = gdk_pixbuf_scale_simple(obj, width*2, height*2, GDK_INTERP_NEAREST);
+        gdk_draw_pixbuf(widget->window, NULL, image, 0, 0, 0, 0, width*2, height*2, GDK_RGB_DITHER_NONE, 0, 0);
+        g_object_unref(image);
+    } else {
+        gdk_draw_pixbuf(widget->window, NULL, obj, 0, 0, 0, 0, width, height, GDK_RGB_DITHER_NONE, 0, 0);
+    }
+}
+
 /**
  * xmms_show_message:
  * @title: The title of the message to show.