summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJani Hautakangas <ext-jani.hautakangas@nokia.com>2009-10-28 09:13:08 (GMT)
committerJani Hautakangas <ext-jani.hautakangas@nokia.com>2009-10-28 09:21:59 (GMT)
commit680de3b4bf3c62b2df83797f8cee5789c121bf00 (patch)
tree3611c8ed52fc4bd7d8b3b8f229c1270190c54d29
parentc5671bcc033e6e519fe8f88b64c108e8d52371fe (diff)
downloadQt-680de3b4bf3c62b2df83797f8cee5789c121bf00.zip
Qt-680de3b4bf3c62b2df83797f8cee5789c121bf00.tar.gz
Qt-680de3b4bf3c62b2df83797f8cee5789c121bf00.tar.bz2
Fix EColor16M conversion in QPixmap::fromSymbianCFbsBitmap()
EColor16M is in BGR format so after conversion to QImage RGB values needs to be swapped. Reviewed-by: jbarron
-rw-r--r--src/gui/image/qpixmap_s60.cpp15
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp2
2 files changed, 11 insertions, 6 deletions
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp
index 666d608..c56e9b7 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_s60.cpp
@@ -935,18 +935,21 @@ void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType)
da.beginDataAccess(sourceBitmap);
uchar *bytes = (uchar*)sourceBitmap->DataAddress();
QImage img = QImage(bytes, size.iWidth, size.iHeight, format);
+ img = img.copy();
da.endDataAccess(sourceBitmap);
- fromImage(img, Qt::AutoColor);
-
- if(deleteSourceBitmap)
- delete sourceBitmap;
-
if(displayMode == EGray2) {
//Symbian thinks set pixels are white/transparent, Qt thinks they are foreground/solid
//So invert mono bitmaps so that masks work correctly.
- image.invertPixels();
+ img.invertPixels();
+ } else if(displayMode == EColor16M) {
+ img = img.rgbSwapped(); // EColor16M is BGR
}
+
+ fromImage(img, Qt::AutoColor);
+
+ if(deleteSourceBitmap)
+ delete sourceBitmap;
} else {
CFbsBitmap* duplicate = 0;
QT_TRAP_THROWING(duplicate = new (ELeave) CFbsBitmap);
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 53b6230..8e02c74 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -1134,6 +1134,8 @@ void tst_QPixmap::fromSymbianCFbsBitmap_data()
QTest::newRow("EColor4K big") << EColor4K << largeWidth << largeHeight << QColor(Qt::red);
QTest::newRow("EColor64K small") << EColor64K << smallWidth << smallHeight << QColor(Qt::green);
QTest::newRow("EColor64K big") << EColor64K << largeWidth << largeHeight << QColor(Qt::green);
+ QTest::newRow("EColor16M small") << EColor16M << smallWidth << smallHeight << QColor(Qt::yellow);
+ QTest::newRow("EColor16M big") << EColor16M << largeWidth << largeHeight << QColor(Qt::yellow);
QTest::newRow("EColor16MU small") << EColor16MU << smallWidth << smallHeight << QColor(Qt::red);
QTest::newRow("EColor16MU big") << EColor16MU << largeWidth << largeHeight << QColor(Qt::red);
QTest::newRow("EColor16MA small opaque") << EColor16MA << smallWidth << smallHeight << QColor(255, 255, 0);