changeset 4207:15df056e7634

branch merge
author Cristi Magherusan <majeru@atheme.org>
date Mon, 21 Jan 2008 02:46:44 +0200
parents 36338afdd736 (diff) 6a4c8ad14256 (current diff)
children cc565360e405 47352b34dbdf
files
diffstat 1 files changed, 12 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/skin.c	Sun Jan 20 20:22:01 2008 +0100
+++ b/src/audacious/skin.c	Mon Jan 21 02:46:44 2008 +0200
@@ -1830,16 +1830,14 @@
 {
     gint i;
     GdkPixbuf *pixbuf;
-    GdkImage *img;
     SkinPixmap *eqmainpm;
-    GdkPixmap *pixmap;
-    GdkGC *gc;
-
+    guchar* pixels,*p;
+    guint rowstride, n_channels;
     g_return_if_fail(skin != NULL);
 
     eqmainpm = &skin->pixmaps[SKIN_EQMAIN];
     if (eqmainpm->pixbuf &&
-        eqmainpm->current_width >= 116 && eqmainpm->current_height >= 313)
+            eqmainpm->current_width >= 116 && eqmainpm->current_height >= 313)
         pixbuf = eqmainpm->pixbuf;
     else
         return;
@@ -1847,24 +1845,16 @@
     if (!GDK_IS_PIXBUF(pixbuf))
         return;
 
-    pixmap = gdk_pixmap_new(NULL, eqmainpm->current_width, eqmainpm->current_height,
-                            gdk_rgb_get_visual()->depth);
-    gc = gdk_gc_new(pixmap);
-    gdk_draw_pixbuf(pixmap, gc, pixbuf, 0, 0, 0, 0, eqmainpm->current_width, eqmainpm->current_height,
-                    GDK_RGB_DITHER_MAX, 0, 0);
-
-    if (!(img = gdk_drawable_get_image(pixmap, 115, 294, 1, 19))) {
-        g_object_unref(gc);
-        g_object_unref(pixmap);
-        return;
+    pixels = gdk_pixbuf_get_pixels (pixbuf);
+    rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+    n_channels = gdk_pixbuf_get_n_channels (pixbuf);
+    for (i = 0; i < 19; i++)
+    {
+        p = pixels + rowstride * (i + 294) + 115 * n_channels;
+        colors[i] = (p[0] << 16) | (p[1] << 8) | p[2]; 
+        if(n_channels == 4)       /* should we really treat the Alpha channel? */
+            colors[i]= (colors[i] << 8) | p[3];
     }
-
-    for (i = 0; i < 19; i++)
-        colors[i] = gdk_image_get_pixel(img, 0, i);
-
-    g_object_unref(img);
-    g_object_unref(gc);
-    g_object_unref(pixmap);
 }