changeset 16570:43e119f590ce

DennisR noticed that the idle icons were jagged on the sides. This is because I was subtracting 128 from the alpha value of each pixel, rather than halving them, causing anti-aliasing pixels to hit 0
author Sean Egan <seanegan@gmail.com>
date Sat, 28 Apr 2007 05:05:22 +0000
parents db7e68346e44
children 6f3585f8a027
files pidgin/pidginstock.c
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/pidginstock.c	Sat Apr 28 04:23:42 2007 +0000
+++ b/pidgin/pidginstock.c	Sat Apr 28 05:05:22 2007 +0000
@@ -237,7 +237,7 @@
 
 /* Altered from do_colorshift in gnome-panel */
 static void
-do_alphashift (GdkPixbuf *dest, GdkPixbuf *src, int shift)
+do_alphashift (GdkPixbuf *dest, GdkPixbuf *src)
 {
         gint i, j;
         gint width, height, has_alpha, srcrowstride, destrowstride;
@@ -245,7 +245,6 @@
         guchar *original_pixels;
         guchar *pixsrc;
         guchar *pixdest;
-        int val;
         guchar a;
 
         has_alpha = gdk_pixbuf_get_has_alpha (src);
@@ -267,8 +266,7 @@
                         *(pixdest++) = *(pixsrc++);
                         *(pixdest++) = *(pixsrc++);
                         a = *(pixsrc++);
-                        val = a - shift;
-                        *(pixdest++) = CLAMP(val, 0, 255);
+                        *(pixdest++) = a / 2;
                 }
         }
 }
@@ -286,7 +284,7 @@
 
 	filename = g_build_filename(DATADIR, "pixmaps", "pidgin", dir, size, file, NULL);
 	pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
-	do_alphashift(pixbuf, pixbuf, 128);
+	do_alphashift(pixbuf, pixbuf);
 
 	source = gtk_icon_source_new();
         gtk_icon_source_set_pixbuf(source, pixbuf);
@@ -314,7 +312,7 @@
        if (rtl) {
 		filename = g_build_filename(DATADIR, "pixmaps", "pidgin", dir, size, "rtl", file, NULL);
  		pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
-		do_alphashift(pixbuf, pixbuf, 128);
+		do_alphashift(pixbuf, pixbuf);
 		source = gtk_icon_source_new();
                 gtk_icon_source_set_pixbuf(source, pixbuf);
                 gtk_icon_source_set_direction(source, GTK_TEXT_DIR_RTL);