mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2026-11-18 12:08:48 -05:00
The palette was filled with 16 (1 bit, 4 planes) or 256 (8 bits) entries read with QImage::color(), reading past the end of the color table of images with fewer colors. Entries past the color table (all of them for an image without one) are now written as black, as the DDS plugin does. The 4-plane writer set BytesPerLine to width / 8, so for widths not a multiple of 8 the last pixels of each line were set one byte past the end of the line buffers (an assertion in debug builds) and dropped from the file, which the plugin then could not read back. Images narrower than 8 pixels could not be saved at all. It is now (width + 7) / 8. The 1-bit and 8-bit writers copied whole scanlines of the image into the file, including their uninitialized padding bytes. Only the bytes used by the pixels are copied now. Added indexed images with 3, 5, 16 and 40 colors (6, 13, 16 and 17 pixels wide) to autotests/write/basic, with the .qoi and .rgb files of the formats whose output is checked byte for byte. writetest now compares indexed images as RGB32 or ARGB32, since fuzzyeq() only takes 24, 32 and 64 bit images.
47 B
47 B