summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2009-11-03 13:08:00 (GMT)
committerGunnar Sletta <gunnar@trolltech.com>2009-11-03 13:08:00 (GMT)
commit7b7c804723f1bbd71d436ab12f5e68a0f87c71d7 (patch)
treed8ce8756eddbb49e0947253be7c540714ed8aa42 /src/gui/image
parent4d0735b98a9bd6b440adf63725e6062b601ed442 (diff)
parent0a24f29a0f53716f9c9e000f5bb55ac5d925df5c (diff)
downloadQt-7b7c804723f1bbd71d436ab12f5e68a0f87c71d7.zip
Qt-7b7c804723f1bbd71d436ab12f5e68a0f87c71d7.tar.gz
Qt-7b7c804723f1bbd71d436ab12f5e68a0f87c71d7.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt-graphics-team into 4.6
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qpixmap_mac.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp
index 15350e8..9209d45 100644
--- a/src/gui/image/qpixmap_mac.cpp
+++ b/src/gui/image/qpixmap_mac.cpp
@@ -305,11 +305,15 @@ void QMacPixmapData::fromImage(const QImage &img,
}
break;
}
- case QImage::Format_Indexed8:
- for (int x = 0; x < w; ++x) {
- *(drow+x) = PREMUL(image.color(*(srow + x)));
+ case QImage::Format_Indexed8: {
+ int numColors = image.numColors();
+ if (numColors > 0) {
+ for (int x = 0; x < w; ++x) {
+ int index = *(srow + x);
+ *(drow+x) = PREMUL(image.color(qMin(index, numColors)));
+ }
}
- break;
+ } break;
case QImage::Format_RGB32:
for (int x = 0; x < w; ++x)
*(drow+x) = *(((quint32*)srow) + x) | 0xFF000000;