diff src/audacious/util.c @ 3077:4b076ad636e6

use GdkPixmaps for doublesizing
author Tomasz Mon <desowin@gmail.com>
date Sat, 14 Jul 2007 12:45:03 +0200
parents 2c17b008a532
children 1faf842dea49
line wrap: on
line diff
--- a/src/audacious/util.c	Sat Jul 14 00:01:14 2007 +0200
+++ b/src/audacious/util.c	Sat Jul 14 12:45:03 2007 +0200
@@ -859,6 +859,25 @@
     return out;
 }
 
+GdkPixmap *create_dblsize_pixmap(GdkPixmap *pix) {
+    int w, h;
+    gdk_drawable_get_size(pix, &w, &h);
+    GdkGC* gc = gdk_gc_new(pix);
+    GdkPixbuf *img, *img2x;
+    GdkColormap *colormap = gdk_colormap_get_system();
+    img = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, w, h);
+    gdk_pixbuf_get_from_drawable(img, pix, colormap, 0, 0, 0, 0, w, h);
+    img2x = gdk_pixbuf_scale_simple(img, w*2, h*2, GDK_INTERP_NEAREST);
+
+    GdkPixmap *image;
+    image = gdk_pixmap_new(NULL, w*2, h*2, gdk_rgb_get_visual()->depth);
+    gdk_draw_pixbuf(image, gc, img2x, 0, 0, 0, 0, w*2, h*2, GDK_RGB_DITHER_NONE, 0, 0);
+    g_object_unref(img);
+    g_object_unref(img2x);
+    g_object_unref(gc);
+    return image;
+}
+
 GdkImage *create_dblsize_image(GdkImage * img)
 {
 #ifdef GDK_WINDOWING_X11