Images are allocated without being initialized, so a reader must write
every pixel of every line. The PCX reader did not always:
- readImage2() and readImage4v2() decoded width / 4 and width / 2 bytes,
so the last pixels of lines whose width is not a multiple of 4 (2 bits)
or 2 (4 bits) were not set. They now decode every pixel.
- With a BytesPerLine smaller than a line of pixels, readImage1(),
readImage8() and readImage24() left the end of each line unset: such
headers are now refused by isSupported(), which replaces the check
readImage4() had.
Added the read tests indexed2_w13.pcx and indexed4_w13.pcx, which fail
without this change.
Added support for:
- (R/O) 1 bit, 3 planes (ICONDOC.pcx) -> test case from internet archive
- (R/O) 2 bits, 1 planes (CGA_FSD.pcx) -> test case from internet archive
- (R/W) 8 bits, 4 planes (dice_rgba.pcx) -> supported by ImageMagick and GIMP 3
Fix write support for:
- Grayscale 8/16-bits (saved as indexed)
- Alpha 8 (saved as indexed)
- RGB 16-bits depth (saved as RGB 24/32)
- 1-bit writer: checks where is black and use NOT operator only if needed
- Fix images with witdh == 65536(*)
- Checks result of disk writes and reads on all formats
(*) PCX formats support images with with of 65536 but only if the header field bytesPerLine is valid (no overflow). This means that the width 65536 is supported on 1bpp images only.
The previous version of the plugins wrote an image with width of 65536px in the wrong way and it was unable to read it (wrong image returned). I verified that Photoshop and Gimp weren't able to read the image either.
Two main tests: read the file and compare to a given image (loaded from
png), and write a file out and compare to a previously-written image.
The write test in particular is kind of fragile, but it should help
catch some errors where a code change was not intended to affect the
output of the plugin.
Tests are included for all the writable formats, as well as every
readable format that GIMP can write to (and so I could easily get an
example of).
REVIEW: 115430