gecko/image
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
..
build Backed out 1 changesets (bug 1160200) for causing R2 test failures 2015-09-29 11:48:53 +02:00
decoders Bug 1204394 (part 1) - Using StreamingLexer in the BMP decoder. r=seth. 2015-10-08 22:47:56 -07:00
encoders Bug 1204394 (part 1) - Using StreamingLexer in the BMP decoder. r=seth. 2015-10-08 22:47:56 -07:00
test Bug 1194555 - Part 3: Remove |getReportsForThisProcess| from the nsIMemoryReporterManager interface. r=njn 2015-10-14 16:52:55 -07:00
BMPFileHeaders.h Bug 1204394 (part 1) - Using StreamingLexer in the BMP decoder. r=seth. 2015-10-08 22:47:56 -07:00
ClippedImage.cpp Bug 1211324 (part 5) - Remove GraphicsFilter and gfxGraphicsFilter. r=mattwoodrow. 2015-10-05 17:18:10 -07:00
ClippedImage.h Bug 1211324 (part 5) - Remove GraphicsFilter and gfxGraphicsFilter. r=mattwoodrow. 2015-10-05 17:18:10 -07:00
CopyOnWrite.h Bug 1194912 (Part 1) - Add CopyOnWrite<T> to support automatic copy-on-write for recursive writes to data structures. r=tn 2015-08-25 16:26:39 -07:00
DecodePool.cpp Bug 1207183 - micro-optimize removing work items from DecodePool's queues; r=seth 2015-09-22 19:15:12 -04:00
DecodePool.h
Decoder.cpp Bug 1146663 (Part 5) - Require that all image decoders support downscale-during-decode. r=tn 2015-09-19 16:21:08 -07:00
Decoder.h Bug 1118926 (Part 1) - Remove remnants of -moz-resolution in C++ code. r=tn 2015-09-30 17:00:52 -07:00
DecoderFactory.cpp Bug 1118926 (Part 1) - Remove remnants of -moz-resolution in C++ code. r=tn 2015-09-30 17:00:52 -07:00
DecoderFactory.h Bug 1118926 (Part 1) - Remove remnants of -moz-resolution in C++ code. r=tn 2015-09-30 17:00:52 -07:00
DecoderFlags.h Bug 1185800 - Add DecoderFlags and SurfaceFlags enum classes and use them instead of imgIContainer flags in all decoder-related code. r=tn 2015-08-14 17:56:44 -07:00
Deinterlacer.cpp Bug 1208935 - Move Deinterlacer to a standalone file. r=seth 2015-09-28 20:40:00 +02:00
Deinterlacer.h Bug 1208935 - Move Deinterlacer to a standalone file. r=seth 2015-09-28 20:40:00 +02:00
Downscaler.cpp Bug 1208935 - Move Deinterlacer to a standalone file. r=seth 2015-09-28 20:40:00 +02:00
Downscaler.h Bug 1207378 - Add FrameRect to non-skia version of BeginFrame. r=seth 2015-09-30 19:58:00 +02:00
DrawResult.h Bug 1209715 - Add operator overloads for combining DrawResults. r=tn 2015-10-13 23:21:39 -07:00
DynamicImage.cpp Bug 1211324 (part 5) - Remove GraphicsFilter and gfxGraphicsFilter. r=mattwoodrow. 2015-10-05 17:18:10 -07:00
DynamicImage.h
FrameAnimator.cpp Bug 1185800 - Add DecoderFlags and SurfaceFlags enum classes and use them instead of imgIContainer flags in all decoder-related code. r=tn 2015-08-14 17:56:44 -07:00
FrameAnimator.h Bug 1194059 (Part 2) - Always detect IS_ANIMATED during the metadata decode. r=tn 2015-08-14 00:37:13 -07:00
FrozenImage.cpp Bug 1211324 (part 5) - Remove GraphicsFilter and gfxGraphicsFilter. r=mattwoodrow. 2015-10-05 17:18:10 -07:00
FrozenImage.h Bug 1211324 (part 5) - Remove GraphicsFilter and gfxGraphicsFilter. r=mattwoodrow. 2015-10-05 17:18:10 -07:00
ICOFileHeaders.h
Image.cpp
Image.h Bug 1146663 (Part 4) - Make all RasterImages support downscale-during-decode. r=tn 2015-09-19 16:21:05 -07:00
ImageCacheKey.cpp Bug 1118926 (Part 1) - Remove remnants of -moz-resolution in C++ code. r=tn 2015-09-30 17:00:52 -07:00
ImageCacheKey.h
ImageFactory.cpp Bug 1118926 (Part 1) - Remove remnants of -moz-resolution in C++ code. r=tn 2015-09-30 17:00:52 -07:00
ImageFactory.h
ImageLogging.h
ImageMetadata.h Bug 1194059 (Part 2) - Always detect IS_ANIMATED during the metadata decode. r=tn 2015-08-14 00:37:13 -07:00
ImageOps.cpp Bug 1185800 - Add DecoderFlags and SurfaceFlags enum classes and use them instead of imgIContainer flags in all decoder-related code. r=tn 2015-08-14 17:56:44 -07:00
ImageOps.h Bug 1181863 (Part 3) - Add tests for DecodeToSurface(). r=tn 2015-07-31 18:10:34 -07:00
ImageRegion.h
ImageURL.h
ImageWrapper.cpp Bug 1211324 (part 5) - Remove GraphicsFilter and gfxGraphicsFilter. r=mattwoodrow. 2015-10-05 17:18:10 -07:00
ImageWrapper.h
imgFrame.cpp Bug 1211324 (part 5) - Remove GraphicsFilter and gfxGraphicsFilter. r=mattwoodrow. 2015-10-05 17:18:10 -07:00
imgFrame.h Bug 1211324 (part 5) - Remove GraphicsFilter and gfxGraphicsFilter. r=mattwoodrow. 2015-10-05 17:18:10 -07:00
imgICache.idl
imgIContainer.idl Bug 1209715 - Add operator overloads for combining DrawResults. r=tn 2015-10-13 23:21:39 -07:00
imgIContainerDebug.idl
imgIEncoder.idl
imgILoader.idl
imgINotificationObserver.idl
imgIOnloadBlocker.idl
imgIRequest.idl
imgIScriptedNotificationObserver.idl
imgITools.idl
imgLoader.cpp Backed out 7 changesets (bug 1048048) for android crashes in various chunks CLOSED TREE 2015-09-21 09:08:34 -07:00
imgLoader.h
imgRequest.cpp Bug 1196476 - Replace ProgressTracker::FirstObserverIs() with a simpler mechanism on imgRequest. r=tn 2015-08-24 19:49:33 -07:00
imgRequest.h Bug 1196476 - Replace ProgressTracker::FirstObserverIs() with a simpler mechanism on imgRequest. r=tn 2015-08-24 19:49:33 -07:00
imgRequestProxy.cpp Bug 1191100 - Remove XPIDL signature comments in .cpp files. r=ehsan 2015-08-04 16:17:36 -07:00
imgRequestProxy.h
imgTools.cpp Bug 1201796 (Part 3) - Enable downscale-during-decode for imgITools::EncodeScaledImage(). r=tn 2015-09-19 13:34:12 -07:00
imgTools.h Bug 1151694 - Part 2 - imgTools should be inside mozilla::image namespace. r=bbirtles 2015-09-03 23:00:00 +02:00
IProgressObserver.h
LookupResult.h
moz.build Bug 1209715 - Add operator overloads for combining DrawResults. r=tn 2015-10-13 23:21:39 -07:00
MultipartImage.cpp
MultipartImage.h
nsIIconURI.idl Bug 1195415 - Add asciiHostPort field to nsIURI, and use it in the implementation of nsPrincipal::GetOriginForURI, r=bholley 2015-08-18 14:52:24 -04:00
Orientation.h
OrientedImage.cpp Bug 1211324 (part 5) - Remove GraphicsFilter and gfxGraphicsFilter. r=mattwoodrow. 2015-10-05 17:18:10 -07:00
OrientedImage.h Bug 1211324 (part 5) - Remove GraphicsFilter and gfxGraphicsFilter. r=mattwoodrow. 2015-10-05 17:18:10 -07:00
ProgressTracker.cpp Bug 1200413 - Part 2: Make lambdas in ProgressTracker.cpp capture strong references, r=seth 2015-09-01 18:20:48 -04:00
ProgressTracker.h Bug 1194912 (Part 2) - Store ProgressTracker observers in a copy-on-write hash table, and dispatch notifications to them using a template. r=tn 2015-08-25 16:26:43 -07:00
RasterImage.cpp Bug 1211324 (part 5) - Remove GraphicsFilter and gfxGraphicsFilter. r=mattwoodrow. 2015-10-05 17:18:10 -07:00
RasterImage.h Bug 1211324 (part 5) - Remove GraphicsFilter and gfxGraphicsFilter. r=mattwoodrow. 2015-10-05 17:18:10 -07:00
ScriptedNotificationObserver.cpp
ScriptedNotificationObserver.h
ShutdownTracker.cpp
ShutdownTracker.h
SourceBuffer.cpp Bug 1196065 - Add sanity tests for image decoders. r=tn 2015-08-19 14:04:01 -07:00
SourceBuffer.h Bug 1207245 - part 1 - move RefCounted<T> to its own file 2015-09-22 21:27:34 -04:00
StreamingLexer.h Bug 1196066 (Part 2) - Add a streaming lexing framework to ImageLib. r=tn 2015-09-18 23:12:27 -07:00
SurfaceCache.cpp Bug 1210553 - Remove the alternate flags arguments from SurfaceCache's Lookup functions. r=dholbert 2015-10-05 17:06:34 -07:00
SurfaceCache.h Bug 1210553 - Remove the alternate flags arguments from SurfaceCache's Lookup functions. r=dholbert 2015-10-05 17:06:34 -07:00
SurfaceFlags.h Bug 1195878 - If we detect animation during a full decode, drop the results of the full decode on the floor. r=tn 2015-09-23 16:53:40 -07:00
SVGDocumentWrapper.cpp Bug 968923 - part 3a - add core DOM use counter functionality; r=smaug 2015-06-03 12:39:18 -04:00
SVGDocumentWrapper.h
VectorImage.cpp Bug 594505 - Remove obsolete comment since this bug has now been fixed. r=me DONTBUILD 2015-10-12 18:45:19 -07:00
VectorImage.h Bug 968923 - part 5b - add nsIDOMWindowUtils::forceUseCounterFlush; r=bz 2015-03-17 15:25:35 -04:00