diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-10-28 14:53:58 +0100 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-10-29 08:18:05 +0100 |
commit | ff6cf6764ded8c028f693da70b876a00fbff2a5f (patch) | |
tree | 10b48a840a0eada95e7a783eb48fb7248d364e36 /src/3rdparty/libtiff/libtiff/tif_pixarlog.c | |
parent | 2a10b412605a3f812de99f70ed0cb1bd92b633b2 (diff) |
Tiff: Align 16 to 8 bit colormap conversion to libtiff
For paletted images, tiff stores a color map with 16 bit deep
entries. When reading such images, the tiff handler tried to be clever
in the 16 to 8 bit mapping, but this resulted in slightly different
result than what libtiff itself produces if asked to read and convert
such an image (TIFFReadRGBAImageOriented()). libtiff simply ignores
the lower 8 bits, so we should do the same.
Importantly, this makes no difference when 8 bit original data is
stored in the orthodox 16 bit way, where e.g. 0xAB is stored as 0xABAB
- like we do. However, the alternative storages 0xAB00 and 0xABFF
exist in the wild, even in sample images in Qt repos.
Also, if we later should want to support proper 16 bit data here, the
previous code was anyway wrong: just dividing with 257 is highly
unorthodox. The correct way would be to use proper rounding like
QRgba64::toArgb32().
Fixes: QTBUG-79522
Change-Id: I7bd90ad7b89a923bd431781f4927b13ad0544407
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/3rdparty/libtiff/libtiff/tif_pixarlog.c')
0 files changed, 0 insertions, 0 deletions