diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-04-12 16:38:40 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-04-19 10:08:41 +0000 |
commit | ee3ac3a3bfb4c4a0802f6530f61995297c573646 (patch) | |
tree | e581e20e1c2949a1b7fb1b6d46db2b824152208d /src | |
parent | 288bfb0bbd778fdfa6ac9fdcdc1afc19ec13aeaf (diff) |
Fix PNGs saved from QImage transform of 8-bit images
Fixes two separate errors. QImage::transform was incorrectly adding
colors to the color-table of the returned image when the converted image
would not be indexed, and qpnghandler was looking at non-empty color-
table instead of color format.
Task-number: QTBUG-43708
Change-Id: Ife14b6428ca65ac7d3a0b36a89a73e56d64586b4
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/image/qimage.cpp | 2 | ||||
-rw-r--r-- | src/gui/image/qpnghandler.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 23b05fa874..9696584f36 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4671,7 +4671,7 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode } // initizialize the data - if (d->format == QImage::Format_Indexed8) { + if (target_format == QImage::Format_Indexed8) { if (dImage.d->colortable.size() < 256) { // colors are left in the color table, so pick that one as transparent dImage.d->colortable.append(0x0); diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index 1d19c165fc..9506a95506 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -830,7 +830,7 @@ bool QPNGImageWriter::writeImage(const QImage& image, volatile int quality_in, c int color_type = 0; - if (image.colorCount()) { + if (image.format() <= QImage::Format_Indexed8) { if (image.isGrayscale()) color_type = PNG_COLOR_TYPE_GRAY; else |