summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2009-08-31 05:19:23 (GMT)
committerGunnar Sletta <gunnar@trolltech.com>2009-08-31 11:07:58 (GMT)
commitb0295e82d08605a5a40803895544e57eeb6c8dc3 (patch)
tree8b21d5d7a5767375822a3e1bac30376b71facb70 /src/gui/image
parent6cf224de00ebf0681cd32a34866bdc3d16e0f45d (diff)
downloadQt-b0295e82d08605a5a40803895544e57eeb6c8dc3.zip
Qt-b0295e82d08605a5a40803895544e57eeb6c8dc3.tar.gz
Qt-b0295e82d08605a5a40803895544e57eeb6c8dc3.tar.bz2
Don't crash when convert Indexed8 without colortable to QPixmap
This implicitly adds "grayscale" support for indexed 8, but only for the conversion. The alternative would be leave the pixels uninitialized which would be less nice... Reviewed-by: Samuel
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qimage.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index d48d427..0358ba0 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -2904,6 +2904,12 @@ static void convert_Indexed8_to_X32(QImageData *dest, const QImageData *src, Qt:
Q_ASSERT(src->height == dest->height);
QVector<QRgb> colorTable = fix_color_table(src->colortable, dest->format);
+ if (colorTable.size() == 0) {
+ colorTable.resize(256);
+ for (int i=0; i<256; ++i)
+ colorTable[i] = qRgb(i, i, i);
+
+ }
int w = src->width;
const uchar *src_data = src->data;