From 67db479e83fd69f844c18df79c978a31904a8642 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 13 Aug 2004 02:26:57 +0000 Subject: [PATCH] Properly determine the number of colors in an OS/2 BMP file. (#150003, Thu Aug 12 22:19:12 2004 Matthias Clasen * io-bmp.c (DecodeHeader): Properly determine the number of colors in an OS/2 BMP file. (#150003, Jon-Kare Hellan) --- gdk-pixbuf/ChangeLog | 5 +++++ gdk-pixbuf/io-bmp.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index d57d372831..8ce859d84d 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,3 +1,8 @@ +Thu Aug 12 22:19:12 2004 Matthias Clasen + + * io-bmp.c (DecodeHeader): Properly determine the number of + colors in an OS/2 BMP file. (#150003, Jon-Kare Hellan) + 2004-08-12 Matthias Clasen * pixops/pixops.c: Remove C99-isms. (#149967, Vincent Noel) diff --git a/gdk-pixbuf/io-bmp.c b/gdk-pixbuf/io-bmp.c index d79e5be03c..82ddba1301 100644 --- a/gdk-pixbuf/io-bmp.c +++ b/gdk-pixbuf/io-bmp.c @@ -269,7 +269,11 @@ static gboolean DecodeHeader(unsigned char *BFH, unsigned char *BIH, return FALSE; } - clrUsed = (int) (BIH[35] << 24) + (BIH[34] << 16) + (BIH[33] << 8) + (BIH[32]); + if (State->Header.size == 12) + clrUsed = 1 << State->Header.depth; + else + clrUsed = (int) (BIH[35] << 24) + (BIH[34] << 16) + (BIH[33] << 8) + (BIH[32]); + if (clrUsed != 0) State->Header.n_colors = clrUsed; else