summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2010-05-31 05:23:40 (GMT)
committerAaron McCarthy <aaron.mccarthy@nokia.com>2010-05-31 05:23:40 (GMT)
commitf587dfeaa9d369235d347af3d14339054ee59908 (patch)
tree3ac92f6a08d871099d8808e8d5fc59f50863bacb /src/plugins
parentfeb9949a11abbf244e0bfcdc128981596758de40 (diff)
parent9da305aedfaa5da5a3059c99ac5a5389dab42b10 (diff)
downloadQt-f587dfeaa9d369235d347af3d14339054ee59908.zip
Qt-f587dfeaa9d369235d347af3d14339054ee59908.tar.gz
Qt-f587dfeaa9d369235d347af3d14339054ee59908.tar.bz2
Merge remote branch 'staging/4.7' into HEAD
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp25
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h2
2 files changed, 11 insertions, 16 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index 80366d1..f704432 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -91,6 +91,7 @@ void QDirectFBPixmapData::resize(int width, int height)
setSerialNumber(++global_ser_no);
}
+#ifdef QT_DIRECTFB_OPAQUE_DETECTION
// mostly duplicated from qimage.cpp (QImageData::checkForAlphaPixels)
static bool checkForAlphaPixels(const QImage &img)
{
@@ -160,12 +161,16 @@ static bool checkForAlphaPixels(const QImage &img)
return false;
}
+#endif // QT_DIRECTFB_OPAQUE_DETECTION
-bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img)
+bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img, Qt::ImageConversionFlags flags)
{
-#ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION
- return checkForAlphaPixels(img);
+ if (img.depth() == 1)
+ return true;
+#ifdef QT_DIRECTFB_OPAQUE_DETECTION
+ return ((flags & Qt::NoOpaqueDetection) ? img.hasAlphaChannel() : checkForAlphaPixels(img));
#else
+ Q_UNUSED(flags);
return img.hasAlphaChannel();
#endif
}
@@ -287,19 +292,9 @@ bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescripti
#endif
-void QDirectFBPixmapData::fromImage(const QImage &img,
- Qt::ImageConversionFlags flags)
+void QDirectFBPixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags)
{
- if (img.depth() == 1) {
- alpha = true;
-#ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION
- } else if (flags & Qt::NoOpaqueDetection || QDirectFBPixmapData::hasAlphaChannel(img)) {
- alpha = true;
-#else
- } else if (img.hasAlphaChannel()) {
- alpha = true;
-#endif
- }
+ alpha = QDirectFBPixmapData::hasAlphaChannel(img, flags);
imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat();
QImage image;
if ((flags & ~Qt::NoOpaqueDetection) != Qt::AutoColor) {
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
index da6edc6..343b26e 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
@@ -86,8 +86,8 @@ public:
virtual int metric(QPaintDevice::PaintDeviceMetric m) const { return QDirectFBPaintDevice::metric(m); }
inline QImage::Format pixelFormat() const { return imageFormat; }
- static bool hasAlphaChannel(const QImage &img);
inline bool hasAlphaChannel() const { return alpha; }
+ static bool hasAlphaChannel(const QImage &img, Qt::ImageConversionFlags flags = Qt::AutoColor);
private:
#ifdef QT_DIRECTFB_IMAGEPROVIDER
bool fromDataBufferDescription(const DFBDataBufferDescription &dataBuffer);