diff --git a/image/BMPHeaders.h b/image/BMPHeaders.h index c7638a03a3b1..544e334e1915 100644 --- a/image/BMPHeaders.h +++ b/image/BMPHeaders.h @@ -20,8 +20,6 @@ struct InfoHeaderLength { enum { WIN_V2 = 12, WIN_V3 = 40, - WIN_V3_NT = 52, - WIN_V3_NT_ALPHA = 56, WIN_V4 = 108, WIN_V5 = 124, diff --git a/image/decoders/nsBMPDecoder.cpp b/image/decoders/nsBMPDecoder.cpp index 9b4a64650527..2eb8e9075b85 100644 --- a/image/decoders/nsBMPDecoder.cpp +++ b/image/decoders/nsBMPDecoder.cpp @@ -36,7 +36,7 @@ // // WinBMPv3. This is the most widely used version. // - It changed the info header to 40 bytes by taking the WinBMPv2 info -// header, enlarging its width and height fields, and adding more fields +// header, enlargening its width and height fields, and adding more fields // including: a compression type (|mCompression|) and number of colors // (|mNumColors|). // - The semi-optional color table is now 4 bytes per value (BGR0), and its @@ -48,11 +48,7 @@ // - It did not change the info header layout from WinBMPv3. // - |mBpp| can now be 16 or 32, in which case |mCompression| can be RGB or the // new BITFIELDS value; in the latter case an additional 12 bytes of color -// bitfields follow the info header (52 bytes total). -// -// WinBMPv3-NT-Alpha. A variant of WinBMPv3-NT with support for alpha channels. -// Adds an additional 4 bytes in in the info header (now 56 bytes total), and -// supports an alpha channel in the BITFIELDS sections. +// bitfields follow the info header. // // WinBMPv4. // - It extended the info header to 108 bytes, including the 12 bytes of color @@ -498,8 +494,6 @@ LexerTransition nsBMPDecoder::ReadInfoHeaderSize( bool bihSizeOk = mH.mBIHSize == InfoHeaderLength::WIN_V2 || mH.mBIHSize == InfoHeaderLength::WIN_V3 || - mH.mBIHSize == InfoHeaderLength::WIN_V3_NT || - mH.mBIHSize == InfoHeaderLength::WIN_V3_NT_ALPHA || mH.mBIHSize == InfoHeaderLength::WIN_V4 || mH.mBIHSize == InfoHeaderLength::WIN_V5 || (mH.mBIHSize >= InfoHeaderLength::OS2_V2_MIN && @@ -617,8 +611,6 @@ LexerTransition nsBMPDecoder::ReadInfoHeaderRest( // For BITFIELDS compression we require an exact match for one of the // WinBMP BIH sizes; this clearly isn't an OS2 BMP. (mH.mBIHSize == InfoHeaderLength::WIN_V3 || - mH.mBIHSize == InfoHeaderLength::WIN_V3_NT || - mH.mBIHSize == InfoHeaderLength::WIN_V3_NT_ALPHA || mH.mBIHSize == InfoHeaderLength::WIN_V4 || mH.mBIHSize == InfoHeaderLength::WIN_V5) && (mH.mBpp == 16 || mH.mBpp == 32)); @@ -641,7 +633,7 @@ LexerTransition nsBMPDecoder::ReadInfoHeaderRest( size_t bitFieldsLengthStillToRead = 0; if (mH.mCompression == Compression::BITFIELDS) { // Need to read bitfields. - if (mH.mBIHSize >= InfoHeaderLength::WIN_V3_NT) { + if (mH.mBIHSize >= InfoHeaderLength::WIN_V4) { // Bitfields are present in the info header, so we can read them // immediately. mBitFields.ReadFromHeader(aData + 36, /* aReadAlpha = */ true); @@ -1047,7 +1039,8 @@ LexerTransition nsBMPDecoder::ReadPixelRow( break; case 32: - if (mH.mCompression == Compression::RGB && mIsWithinICO) { + if (mH.mCompression == Compression::RGB && mIsWithinICO && + mH.mBpp == 32) { // This is a special case only used for 32bpp WinBMPv3-ICO files, which // could be in either 0RGB or ARGB format. We start by assuming it's // an 0RGB image. If we hit a non-zero alpha value, then we know it's diff --git a/image/test/reftest/bmp/bmp-24bpp/24bpp-rgb-ref.png b/image/test/reftest/bmp/bmp-24bpp/24bpp-rgb-ref.png deleted file mode 100644 index 9de5fc22a23a..000000000000 Binary files a/image/test/reftest/bmp/bmp-24bpp/24bpp-rgb-ref.png and /dev/null differ diff --git a/image/test/reftest/bmp/bmp-24bpp/24bpp-rgb.bmp b/image/test/reftest/bmp/bmp-24bpp/24bpp-rgb.bmp deleted file mode 100644 index 65e2cf418ce5..000000000000 Binary files a/image/test/reftest/bmp/bmp-24bpp/24bpp-rgb.bmp and /dev/null differ diff --git a/image/test/reftest/bmp/bmp-24bpp/reftest.list b/image/test/reftest/bmp/bmp-24bpp/reftest.list index bfb576084e3e..83ec17563bad 100644 --- a/image/test/reftest/bmp/bmp-24bpp/reftest.list +++ b/image/test/reftest/bmp/bmp-24bpp/reftest.list @@ -19,4 +19,3 @@ == bmp-not-square-24bpp.bmp bmp-not-square-24bpp.png == os2bmp-size-32x32-24bpp.bmp bmp-size-32x32-24bpp.png == top-to-bottom-16x16-24bpp.bmp bmp-size-16x16-24bpp.png -== 24bpp-rgb.bmp 24bpp-rgb-ref.png diff --git a/image/test/reftest/bmp/bmp-32bpp/32bpp-rgb-ref.png b/image/test/reftest/bmp/bmp-32bpp/32bpp-rgb-ref.png deleted file mode 100644 index 9de5fc22a23a..000000000000 Binary files a/image/test/reftest/bmp/bmp-32bpp/32bpp-rgb-ref.png and /dev/null differ diff --git a/image/test/reftest/bmp/bmp-32bpp/32bpp-rgb.bmp b/image/test/reftest/bmp/bmp-32bpp/32bpp-rgb.bmp deleted file mode 100644 index 9dd5c28f5117..000000000000 Binary files a/image/test/reftest/bmp/bmp-32bpp/32bpp-rgb.bmp and /dev/null differ diff --git a/image/test/reftest/bmp/bmp-32bpp/reftest.list b/image/test/reftest/bmp/bmp-32bpp/reftest.list deleted file mode 100644 index 2a5feb10e2d9..000000000000 --- a/image/test/reftest/bmp/bmp-32bpp/reftest.list +++ /dev/null @@ -1,4 +0,0 @@ -# BMP 32BPP tests - -# Images of various odd size info header sizes -== 32bpp-rgb.bmp 32bpp-rgb-ref.png diff --git a/image/test/reftest/bmp/bmpsuite/q/reftest.list b/image/test/reftest/bmp/bmpsuite/q/reftest.list index 04a58825d1e0..cead5df00b3b 100644 --- a/image/test/reftest/bmp/bmpsuite/q/reftest.list +++ b/image/test/reftest/bmp/bmpsuite/q/reftest.list @@ -183,8 +183,9 @@ fuzzy(10-10,6590-6597) == rgb24prof2.bmp rgb24.png # BMP: bihsize=52, 127 x 64, bpp=32, compression=3, colors=0 # "Similar to g/rgb32bf.bmp, but with a 52-byte “BITMAPV2INFOHEADER”. This is -# an uncommon version of BMP." -== rgb32h52.bmp rgb32h52.png +# an uncommon version of BMP, and I can’t confirm that this file is correct." +# [We reject it. Chromium accepts it.] +== wrapper.html?rgb32h52.bmp about:blank # BMP: bihsize=124, 127 x 64, bpp=32, compression=3, colors=0 # "Color channels are the same size and order as rgb32bfdef.bmp, but they use @@ -245,5 +246,6 @@ fuzzy(0-1,0-1554) == rgba32-61754.bmp rgba32-61754.png # BMP: bihsize=56, 127 x 64, bpp=32, compression=3, colors=0 # "Similar to q/rgba32.bmp, but with a 56-byte “BITMAPV3INFOHEADER”. This is an # uncommon version of BMP, and I can’t confirm that this file is correct." -== rgba32h56.bmp rgba32h56.png +# [We reject it. Chromium accepts it.] +== wrapper.html?rgba32h56.bmp about:blank diff --git a/image/test/reftest/bmp/bmpsuite/q/rgb32h52.png b/image/test/reftest/bmp/bmpsuite/q/rgb32h52.png deleted file mode 100644 index 86a9c945b0bf..000000000000 Binary files a/image/test/reftest/bmp/bmpsuite/q/rgb32h52.png and /dev/null differ diff --git a/image/test/reftest/bmp/bmpsuite/q/rgba32h56.png b/image/test/reftest/bmp/bmpsuite/q/rgba32h56.png deleted file mode 100644 index 25e542a6551a..000000000000 Binary files a/image/test/reftest/bmp/bmpsuite/q/rgba32h56.png and /dev/null differ diff --git a/image/test/reftest/bmp/reftest.list b/image/test/reftest/bmp/reftest.list index c90b9e0b8fc7..87183e6b2fae 100644 --- a/image/test/reftest/bmp/reftest.list +++ b/image/test/reftest/bmp/reftest.list @@ -4,7 +4,6 @@ include bmp-1bpp/reftest.list include bmp-4bpp/reftest.list include bmp-8bpp/reftest.list include bmp-24bpp/reftest.list -include bmp-32bpp/reftest.list include bmp-corrupted/reftest.list include bmpsuite/reftest.list