gecko/image/decoders
Nicholas Nethercote 7a382ecf62 Bug 1204394 (part 1) - Using StreamingLexer in the BMP decoder. r=seth.
This patch is a major overhaul of nsBMPDecoder.

The patch improves the code in the following ways.

- It converts nsBMPDecoder to use StreamingLexer, which makes it much easier to
  read.

- It adds a detailed comment about the BMP format at the top of
  nsBMPDecoder.cpp.

- It fixes lots of inconsistent indenting.

- It moves |bihsize| from |mBFH| to |mBIH| to match the file format and common
  sense. The avoids the need for the confusing LENGTH/INTERNAL_LENGTH
  distinction.

- It renames most of the types in BMPFileHeader.h, so they have better names,
  in StudlyCaps form, and within the new |bmp| namespace.

- It removes the BMP_HEADER_LENGTH struct and inlines its values directly into
  the two places they were used.

- It removes the MOZ_LOG logging done on some of the failure cases. (Most
  failure cases lacked logging so why bother with some?)

- It removes over 200 lines of code, despite the addition of the big format
  comment.

The patch changes the way BMPs are decoded as follows.

- It adds stricter testing of the InfoHeader length, rejecting files with bad
  values.

- It moves all header sanity checking that can lead to file rejection into the
  metadata decode phase. (Previously, bpp/compression consistency checking did
  not occur during a metadata decode.)

- It removes BMPINFOHEADER::ALPHABITFIELDS, which was (a) a weird WinCE-only
  thing, and (b) we didn't actually allow it, and (c) we used the value 4
  instead of 6(!).

- It rejects the previously-accepted compression==RLE4 && bpp=1 combination
  because it doesn't make sense.

- It removes a fudge in RLE absolute mode handling that permitted one pixel too
  many in a row but only if the row's width was odd(!)

- It now rejects a file with a negative gap between the color table and the
  pixel data.

The patch leaves the following problems unaddressed.

- If bpp==32 we totally ignore compression==BITFIELDS and treat it like
  compression=RGB.

- Transparency as specified in WinBMPv{4,5} isn't handled at all.

These will be fixed in follow-ups.

All these changes affect (for the better) the results of the following tests
that will be added in part 2:

- g/pal8v4.bmp
- g/pal8v5.bmp
- q/pal8os2sp.bmp
- q/pal8os2v2.bmp
- q/pal8os2v2-16.bmp
- b/badheadersize.bmp
- b/badpalettesize.bmp
- b/badrle.bmp
2015-10-08 22:47:56 -07:00
..
icon Bug 1207030 - Enable -Wshadow flag in more directories that have no -Wshadow warnings. r=glandium 2015-09-22 21:39:03 -07:00
EXIF.cpp
EXIF.h
GIF2.h
iccjpeg.c
iccjpeg.h
moz.build Bug 1198334 (part 1) - Replace the opt-in FAIL_ON_WARNINGS with the opt-out ALLOW_COMPILER_WARNINGS. r=glandium. 2015-08-27 20:44:53 -07:00
nsBMPDecoder.cpp Bug 1204394 (part 1) - Using StreamingLexer in the BMP decoder. r=seth. 2015-10-08 22:47:56 -07:00
nsBMPDecoder.h Bug 1204394 (part 1) - Using StreamingLexer in the BMP decoder. r=seth. 2015-10-08 22:47:56 -07:00
nsGIFDecoder2.cpp Bug 1207378 (Part 2) - Use Downscaler to remove first-frame padding when downscaling GIFs. r=tn 2015-09-26 01:36:23 -07:00
nsGIFDecoder2.h Bug 1208935 - Move Deinterlacer to a standalone file. r=seth 2015-09-28 20:40:00 +02:00
nsICODecoder.cpp Bug 1204394 (part 1) - Using StreamingLexer in the BMP decoder. r=seth. 2015-10-08 22:47:56 -07:00
nsICODecoder.h Bug 1206836 - When downscaling ICOs, downscale the AND mask as well. r=tn a=KWierso 2015-09-21 19:52:31 -07:00
nsIconDecoder.cpp Bug 1204393 (part 1) - Use StreamingLexer in the ICON decoder. r=seth. 2015-10-05 14:29:01 -07:00
nsIconDecoder.h Bug 1204393 (part 1) - Use StreamingLexer in the ICON decoder. r=seth. 2015-10-05 14:29:01 -07:00
nsJPEGDecoder.cpp Bug 1207378 (Part 1) - Add support for a frame rect to Downscaler. r=tn 2015-09-26 01:36:19 -07:00
nsJPEGDecoder.h Bug 1146663 (Part 5) - Require that all image decoders support downscale-during-decode. r=tn 2015-09-19 16:21:08 -07:00
nsPNGDecoder.cpp Bug 1207378 (Part 1) - Add support for a frame rect to Downscaler. r=tn 2015-09-26 01:36:19 -07:00
nsPNGDecoder.h Bug 1146663 (Part 5) - Require that all image decoders support downscale-during-decode. r=tn 2015-09-19 16:21:08 -07:00