commit dfc1460b99f49771169fc5ca253f246b830a1c67
Author: Matt Giuca <mgiuca@chromium.org>
Date:   Thu Sep 17 17:53:04 2015 +1000

    ICO plugin: Fix generation of the AND mask for 32-bit images.
    
    Previously, the mask would be transparent if the alpha was <50%.
    However, this causes pixels to become black in some places in Windows
    (notably, the taskbar on Windows 10). Therefore, always set the mask to
    opaque if a pixel is partially or fully opaque.

diff --git a/plug-ins/file-ico/ico-save.c b/plug-ins/file-ico/ico-save.c
index add4a32..9d90c67 100644
--- a/plug-ins/file-ico/ico-save.c
+++ b/plug-ins/file-ico/ico-save.c
@@ -826,6 +826,8 @@ ico_write_icon (FILE   *fp,
   guint32           *palette32 = NULL;
   gint               palette_len = 0;
 
+  guint8             alpha_threshold;
+
   D(("Creating data structures for icon %i ------------------------\n",
      num_icon));
 
@@ -873,6 +875,17 @@ ico_write_icon (FILE   *fp,
   /* Create and_map. It's padded out to 32 bits per line: */
   and_map = ico_alloc_map (width, height, 1, &and_len);
 
+  /* 32-bit bitmaps have an alpha channel as well as a mask. Any partially or
+   * fully opaque pixel should have an opaque mask (some ICO code in Windows
+   * draws pixels as black if they have a transparent mask but a non-transparent
+   * alpha value).
+   *
+   * For bitmaps without an alpha channel, we use the normal threshold to build
+   * the mask, so that the mask is as close as possible to the original alpha
+   * channel.
+   */
+  alpha_threshold = header.bpp < 32 ? ICO_ALPHA_THRESHOLD : 0;
+
   for (y = 0; y < height; y++)
     for (x = 0; x < width; x++)
       {
@@ -880,7 +893,7 @@ ico_write_icon (FILE   *fp,
 
         ico_set_bit_in_data (and_map, width,
                              (height - y -1) * width + x,
-                             (pixel[3] > ICO_ALPHA_THRESHOLD ? 0 : 1));
+                             (pixel[3] > alpha_threshold ? 0 : 1));
       }
 
   xor_map = ico_alloc_map (width, height, header.bpp, &xor_len);
