From 7b4e032559c7b226280e5c9229cd685e73d1e707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 28 Feb 2011 17:12:45 +0100 Subject: Added image conversion flag to prevent conversions. This is needed in the meego graphics system to support the shared image fallback path (when using the raster graphicssystem). The flag is internal. Reviewed-by: Gunnar Sletta --- src/corelib/global/qnamespace.h | 3 ++- src/corelib/global/qnamespace.qdoc | 4 ++++ src/gui/image/qpixmap_raster.cpp | 3 +++ src/plugins/graphicssystems/meego/qmeegographicssystem.cpp | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index e492345..6fa3360 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -574,7 +574,8 @@ public: PreferDither = 0x00000040, AvoidDither = 0x00000080, - NoOpaqueDetection = 0x00000100 + NoOpaqueDetection = 0x00000100, + NoFormatConversion = 0x00000200 }; Q_DECLARE_FLAGS(ImageConversionFlags, ImageConversionFlag) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 8440542..89e6f55 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -732,6 +732,10 @@ until a non-opaque pixel is found, or if you want the pixmap to retain an alpha channel for some other reason. If the image has no alpha channel this flag has no effect. + + \omitvalue NoFormatConversion Don't do any format conversions on the image. + Can be useful when converting a QImage to a QPixmap for a one-time + rendering operation for example. */ /*! \enum Qt::GUIStyle diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index 368600f..5e0ffa8 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -380,6 +380,9 @@ int QRasterPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const void QRasterPixmapData::createPixmapForImage(QImage &sourceImage, Qt::ImageConversionFlags flags, bool inPlace) { QImage::Format format; + if (flags & Qt::NoFormatConversion) + format = sourceImage.format(); + else #ifdef Q_WS_QWS if (pixelType() == BitmapType) { format = QImage::Format_Mono; diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp index a70d232..6b8d2b3 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp @@ -171,7 +171,7 @@ QPixmapData *QMeeGoGraphicsSystem::pixmapDataFromEGLSharedImage(Qt::HANDLE handl return QMeeGoGraphicsSystem::wrapPixmapData(pmd); } else { QRasterPixmapData *pmd = new QRasterPixmapData(QPixmapData::PixmapType); - pmd->fromImage(softImage, Qt::NoOpaqueDetection); + pmd->fromImage(softImage, Qt::NoFormatConversion); // Make sure that the image was not converted in any way if (pmd->buffer()->data_ptr()->data != -- cgit v0.12