diff audacious/util.c @ 1851:aceb472cce6c trunk

[svn] - add audacious_pixmap_resize() for resizing a skin pixmap on demand.
author nenolod
date Mon, 09 Oct 2006 03:44:50 -0700
parents be1c5774f675
children 01103f911aa5
line wrap: on
line diff
--- a/audacious/util.c	Mon Oct 09 03:20:36 2006 -0700
+++ b/audacious/util.c	Mon Oct 09 03:44:50 2006 -0700
@@ -1542,3 +1542,28 @@
 	
 	return NULL;	/* if I have no idea, return NULL. */
 }
+
+/*
+ * Resizes a GDK pixmap.
+ */
+GdkPixmap *audacious_pixmap_resize(GdkWindow *src, GdkGC *src_gc, GdkPixmap *in, gint width, gint height)
+{
+	GdkPixmap *out;
+	gint owidth, oheight;
+
+	g_return_if_fail(src != NULL);
+	g_return_if_fail(src_gc != NULL);
+	g_return_if_fail(in != NULL);
+	g_return_if_fail(width > 0 && height > 0);
+
+	gdk_drawable_get_size(in, &owidth, &oheight);
+
+	out = gdk_pixmap_new(src, width, height, -1);
+
+	gdk_draw_rectangle(out, src_gc, TRUE, 0, 0, width, height);
+
+	gdk_window_copy_area(out, src_gc, 0, 0, in, 0, 0, owidth, oheight);
+	g_object_unref(src);
+
+	return out;
+}