Add shortcut for QImage::applyColorTransform on indexed images

This also helps preserve bitmaps.

Pick-to: 6.2
Change-Id: I8aa1ea63dc7dfb948a9c8821f0fe1ddd07f1bc3a
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2021-06-09 14:14:15 +02:00
parent 0242be9060
commit f044f68e9f

View File

@ -5013,6 +5013,13 @@ QColorSpace QImage::colorSpace() const
*/
void QImage::applyColorTransform(const QColorTransform &transform)
{
if (!d)
return;
if (pixelFormat().colorModel() == QPixelFormat::Indexed) {
for (int i = 0; i < d->colortable.size(); ++i)
d->colortable[i] = transform.map(d->colortable[i]);
return;
}
QImage::Format oldFormat = format();
if (depth() > 32) {
if (format() != QImage::Format_RGBX64 && format() != QImage::Format_RGBA64