From ab13ed1624936638ee84b4053b43cefaca7bf8d0 Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Tue, 30 Aug 2011 01:44:04 -0400 Subject: [PATCH] Bug 682688 - FF6 Fix for moz-icon invalid generated icons. r=joe --- modules/libpr0n/decoders/icon/win/nsIconChannel.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/libpr0n/decoders/icon/win/nsIconChannel.cpp b/modules/libpr0n/decoders/icon/win/nsIconChannel.cpp index 14dcd2dd4d81..b9801e4c73c5 100644 --- a/modules/libpr0n/decoders/icon/win/nsIconChannel.cpp +++ b/modules/libpr0n/decoders/icon/win/nsIconChannel.cpp @@ -452,10 +452,15 @@ static int GetColorTableSize(BITMAPINFOHEADER* aHeader) } case 16: case 32: - if (aHeader->biCompression == BI_RGB) + // If we have BI_BITFIELDS compression, we would normally need 3 DWORDS for + // the bitfields mask which would be stored in the color table; However, + // we instead force the bitmap to request data of type BI_RGB so the color + // table should be of size 0. + // Setting aHeader->biCompression = BI_RGB forces the later call to + // GetDIBits to return to us BI_RGB data. + if (aHeader->biCompression == BI_BITFIELDS) + aHeader->biCompression = BI_RGB; colorTableSize = 0; - else if (aHeader->biCompression == BI_BITFIELDS) - colorTableSize = 3 * sizeof(DWORD); break; case 24: colorTableSize = 0;