* resrc.c (define_icon): Fix storage of color attributes 'planes' and 'bit
authorChristopher Faylor <me+cygwin@cgf.cx>
Thu, 2 Oct 2003 14:13:10 +0000 (14:13 +0000)
committerChristopher Faylor <me+cygwin@cgf.cx>
Thu, 2 Oct 2003 14:13:10 +0000 (14:13 +0000)
count' in icon groups.

binutils/ChangeLog
binutils/resrc.c

index f7c8337d0f362e596c9a6866ef7b912210e09c4c..10c2b30e7ada6cd914ecf4e6e6eed5af36f313cc 100644 (file)
@@ -1,3 +1,8 @@
+2003-10-01  Martin Fuchs  <martin-fuchs@gmx.net>
+
+       * resrc.c (define_icon): Fix storage of color attributes 'planes' and
+       'bit count' in icon groups.
+
 2003-09-30  Chris Demetriou  <cgd@broadcom.com>
 
        * NEWS: Add an indication of the cutoff for 2.14.
index 2613b396d5ec8c028e68a341b6be641f5b474d01..b8b69e6fea8d6f0ca1a7ccc30359144e209b38f7 100644 (file)
@@ -1040,10 +1040,20 @@ define_icon (struct res_id id, const struct res_res_info *resinfo,
       cg->height = icondirs[i].height;
       cg->colors = icondirs[i].colorcount;
 
-      cg->planes = 1;
-      cg->bits = 0;
-      while ((1 << cg->bits) < cg->colors)
-       ++cg->bits;
+      if (icondirs[i].u.icon.planes)
+       cg->planes = icondirs[i].u.icon.planes;
+      else
+       cg->planes = 1;
+
+      if (icondirs[i].u.icon.bits)
+       cg->bits = icondirs[i].u.icon.bits;
+      else
+       {
+         cg->bits = 0;
+
+         while ((1L << cg->bits) < cg->colors)
+           ++cg->bits;
+       }
 
       cg->bytes = icondirs[i].bytes;
       cg->index = first_icon + i + 1;