gecko-dev/image/test/reftest/bmp/bmpsuite
Nicholas Nethercote c5432f6a1e Bug 1214072 (part 2) - Implement transparency properly for BMP images. r=seth.
Currently we don't implement transparency at all in BMP images except for an
odd-duck case of BMPs within ICOs.

This patch does the following.

- It implements transparency properly for 16bpp and 32bpp images via bitfield
  masking. (For 32bpp images this also requires handling colors via bitfield
  masking.) The patch maintains the existing BMP-within-ICO transparency
  handling.

- It also reworks BitFields::Value::Set().

  * It now works correctly if the run of 1s goes all the way to bit 31 (the
    old code didn't set mBitWidth).

  * If the mask is 0, will give an mRightShift of 0 (old code gave 32, and
    right-shifting by 32 is dodgy).

  * It's now easier to read.

- It renames transparent.bmp as transparent-if-within-ico.bmp. Ironically
  enough this file currently uses BITFIELDS compression and is WinBMPv5 format,
  which means it contains well-specified alpha data. In order to use it to test
  the hacky BMP-within-ICO transparency scheme the patch changes it to be
  WinBMPv3 format with RGB compression (i.e. no compression). I left the
  now-excess bytes (including the bitfields) in the info header in place
  because that's allowed -- thanks to the start of the pixel data being
  specified by the |dataoffset| field -- they'll just be ignored.

- It tweaks the naming of the relevant gtests and some of their finer details
  to work with the new way of doing things.

This fixes all four remaining failures in bmpsuite.

--HG--
rename : image/test/gtest/transparent.bmp => image/test/gtest/transparent-if-within-ico.bmp
extra : rebase_source : 2f4838d04bbae4fac00cc69e8d75469105a5de3b
2015-10-13 21:20:10 -07:00
..
b
g Bug 1214072 (part 2) - Implement transparency properly for BMP images. r=seth. 2015-10-13 21:20:10 -07:00
q Bug 1214072 (part 2) - Implement transparency properly for BMP images. r=seth. 2015-10-13 21:20:10 -07:00
COPYING.txt
README.mozilla
reftest.list

README.mozilla

bmpsuite, by Jason Summers, is an excellent BMP test suite that covers many
obscure corners of the BMP format. All the test images can be seen here:

  http://entropymine.com/jason/bmpsuite/bmpsuite/html/bmpsuite.html

The code used to generate the test images is available here:

  https://github.com/jsummers/bmpsuite/

The readme.txt file states that the code is GPLv3 and the generated image files
are in the public domain. We have not included the code, but we have included:
(a) some quotes from the documentation and (b) some of the reference PNG
images. However, (a) and (b) are for testing purposes only and are not included
in Firefox releases.

The BMP files within this directory were generated with bmpsuite v2.3 (git
revision 3adcc9e20c0b6d2d665966b7e047b6f9474cef12).

There are three sub-directories.
- g/: for "good" images.
- q/: for "questionable" images.
- b/: for "bad" images.

Each file listed in a reftest.list file is annotated with the following lines.

- The first line starts with "BMP:" and is the output of the MOZ_LOG call in
  nsBMPDecoder.cpp. It has basic image info.

- Next is a quote from the bmpsuite docs, which describes the particulars of
  the file.

- Some files also have additional notes in square brackets. These explain
  anything non-obvious about the file, such as how we handle things that are
  ambiguous, any shortcomings in our decoding, and how Chromium handles the
  image.

Some of the reference PNGs need a small amount of fuzziness to match the BMPs.
This might be due to PNG color correction.