]> Pileus Git - ~andy/gtk/commitdiff
Fix typo. The gtk.immodules file had never been included in my
authorTor Lillqvist <tml@iki.fi>
Sun, 15 Aug 2004 15:05:46 +0000 (15:05 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Sun, 15 Aug 2004 15:05:46 +0000 (15:05 +0000)
2004-08-15  Tor Lillqvist  <tml@iki.fi>

* gtk-zip.sh.in: Fix typo. The gtk.immodules file had never been
included in my zipfiles...!

* gtk/gtkfilesystemwin32.c (extract_icon): Improve handling of
icon alpha channel (on Windows XP) and mask (older Windows
versions). (#148641, Tim Evans)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk-zip.sh.in
gtk/gtkfilesystemwin32.c

index 13662d8819bb5776af334072077810bae455977b..8552f8cf22e7cf5724db4b5b637292277fabbc27 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2004-08-15  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk-zip.sh.in: Fix typo. The gtk.immodules file had never been
+       included in my zipfiles...!
+
+       * gtk/gtkfilesystemwin32.c (extract_icon): Improve handling of
+       icon alpha channel (on Windows XP) and mask (older Windows
+       versions). (#148641, Tim Evans)
+
 Sun Aug 15 02:31:55 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkfilesystemunix.c (get_icon_type_from_stat): Make 
index 13662d8819bb5776af334072077810bae455977b..8552f8cf22e7cf5724db4b5b637292277fabbc27 100644 (file)
@@ -1,3 +1,12 @@
+2004-08-15  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk-zip.sh.in: Fix typo. The gtk.immodules file had never been
+       included in my zipfiles...!
+
+       * gtk/gtkfilesystemwin32.c (extract_icon): Improve handling of
+       icon alpha channel (on Windows XP) and mask (older Windows
+       versions). (#148641, Tim Evans)
+
 Sun Aug 15 02:31:55 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkfilesystemunix.c (get_icon_type_from_stat): Make 
index 13662d8819bb5776af334072077810bae455977b..8552f8cf22e7cf5724db4b5b637292277fabbc27 100644 (file)
@@ -1,3 +1,12 @@
+2004-08-15  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk-zip.sh.in: Fix typo. The gtk.immodules file had never been
+       included in my zipfiles...!
+
+       * gtk/gtkfilesystemwin32.c (extract_icon): Improve handling of
+       icon alpha channel (on Windows XP) and mask (older Windows
+       versions). (#148641, Tim Evans)
+
 Sun Aug 15 02:31:55 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkfilesystemunix.c (get_icon_type_from_stat): Make 
index 13662d8819bb5776af334072077810bae455977b..8552f8cf22e7cf5724db4b5b637292277fabbc27 100644 (file)
@@ -1,3 +1,12 @@
+2004-08-15  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk-zip.sh.in: Fix typo. The gtk.immodules file had never been
+       included in my zipfiles...!
+
+       * gtk/gtkfilesystemwin32.c (extract_icon): Improve handling of
+       icon alpha channel (on Windows XP) and mask (older Windows
+       versions). (#148641, Tim Evans)
+
 Sun Aug 15 02:31:55 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/gtkfilesystemunix.c (get_icon_type_from_stat): Make 
index 16ed3cb71effac3a65e71ac2b752e8a23be90f41..fe2acfb392ec2ae1852e035d27f338149cbf7d07 100755 (executable)
@@ -14,7 +14,7 @@ zip $ZIP -@ <<EOF
 COPYING.LIB-2
 etc/gtk-2.0/gdk-pixbuf.loaders
 etc/gtk-2.0/gtkrc
-etc/gtk-2.0/gtk.immodues
+etc/gtk-2.0/gtk.immodules
 $DLLDIR/libgdk_pixbuf-@GTK_API_VERSION@-@LT_CURRENT_MINUS_AGE@.dll
 $DLLDIR/libgdk-win32-@GTK_API_VERSION@-@LT_CURRENT_MINUS_AGE@.dll
 $DLLDIR/libgtk-win32-@GTK_API_VERSION@-@LT_CURRENT_MINUS_AGE@.dll
index fd68a339ab6d373bf2b790aa7363bfccf8ba9d91..9062888df06041ae2fed6acf5c66ef7afa012871 100644 (file)
@@ -967,13 +967,14 @@ extract_icon (const char* filename)
           if (GetDIBits (hdc, ii.hbmColor, 0, 1, NULL, (BITMAPINFO *)&bmi, DIB_RGB_COLORS))
            {
                gchar *pixels, *bits;
-               gint    rowstride, x, y, w = bmi.bi.biWidth, h = bmi.bi.biHeight;
+               gint rowstride, x, y, w = bmi.bi.biWidth, h = bmi.bi.biHeight;
+               gboolean no_alpha;
 
-               bmi.bi.biBitCount = 24;
+               bmi.bi.biBitCount = 32;
                bmi.bi.biCompression = BI_RGB;
                bmi.bi.biHeight = -h;
                pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, w, h);
-               bits = g_malloc (4 * w * h);
+               bits = g_malloc0 (4 * w * h);
 
                /* color data */
                if (!GetDIBits (hdc, ii.hbmColor, 0, h, bits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS))
@@ -981,35 +982,40 @@ extract_icon (const char* filename)
 
                pixels = gdk_pixbuf_get_pixels (pixbuf);
                rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+               no_alpha = TRUE;
                for (y = 0; y < h; y++)
                  {
                    for (x = 0; x < w; x++)
                      {
-                         pixels[2] = bits[(x+y*w) * 3];
-                         pixels[1] = bits[(x+y*w) * 3 + 1];
-                         pixels[0] = bits[(x+y*w) * 3 + 2];
+                         pixels[2] = bits[(x+y*w) * 4];
+                         pixels[1] = bits[(x+y*w) * 4 + 1];
+                         pixels[0] = bits[(x+y*w) * 4 + 2];
+                         pixels[3] = bits[(x+y*w) * 4 + 3];
+                         if (no_alpha && pixels[3] > 0) no_alpha = FALSE;
                          pixels += 4;
                      }
                    pixels += (w * 4 - rowstride);
                  }
-               /* transparency */
-               if (!GetDIBits (hdc, ii.hbmMask, 0, h, bits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS))
-                 g_warning(G_STRLOC ": Failed to get dibits");
-               pixels = gdk_pixbuf_get_pixels (pixbuf);
-               for (y = 0; y < h; y++)
-                 {
-                   for (x = 0; x < w; x++)
-                     {
-                         pixels[3] = 255 - bits[(x + y * w) * 3];
+               /* mask */
+               if (no_alpha) {
+                 if (!GetDIBits (hdc, ii.hbmMask, 0, h, bits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS))
+                   g_warning(G_STRLOC ": Failed to get dibits");
+                 pixels = gdk_pixbuf_get_pixels (pixbuf);
+                 for (y = 0; y < h; y++)
+                   {
+                     for (x = 0; x < w; x++)
+                       {
+                         pixels[3] = 255 - bits[(x + y * w) * 4];
                          pixels += 4;
-                     }
-                   pixels += (w * 4 - rowstride);
-                 }
+                       }
+                     pixels += (w * 4 - rowstride);
+                   }
                
-               /* release temporary resources */
-               g_free (bits);
-               if (!DeleteObject (ii.hbmColor) || !DeleteObject (ii.hbmMask))
-                 g_warning(G_STRLOC ": Leaking Icon Bitmaps ?");
+                 /* release temporary resources */
+                 g_free (bits);
+                 if (!DeleteObject (ii.hbmColor) || !DeleteObject (ii.hbmMask))
+                   g_warning(G_STRLOC ": Leaking Icon Bitmaps ?");
+               }
            }
          else
            g_warning(G_STRLOC ": GetDIBits () failed, %s", g_win32_error_message (GetLastError ()));
@@ -1023,7 +1029,7 @@ extract_icon (const char* filename)
         g_warning(G_STRLOC ": DestroyIcon failed");
     }
   else
-    g_print ("ExtractAssociatedIcon(%s) failed: %s\n", filename, g_win32_error_message (GetLastError ()));
+    g_warning (G_STRLOC ":ExtractAssociatedIcon(%s) failed: %s", filename, g_win32_error_message (GetLastError ()));
 
   return pixbuf;
 }