diff options
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index f2fd699..80366d1 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -290,27 +290,22 @@ bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescripti void QDirectFBPixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags) { - if (img.depth() == 1 || img.format() == QImage::Format_RGB32) { - fromImage(img.convertToFormat(screen->alphaPixmapFormat()), flags); - return; - } - - if (img.hasAlphaChannel() + if (img.depth() == 1) { + alpha = true; #ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION - && (flags & Qt::NoOpaqueDetection || QDirectFBPixmapData::hasAlphaChannel(img)) -#endif - ) { + } else if (flags & Qt::NoOpaqueDetection || QDirectFBPixmapData::hasAlphaChannel(img)) { alpha = true; - imageFormat = screen->alphaPixmapFormat(); - } else { - alpha = false; - imageFormat = screen->pixelFormat(); +#else + } else if (img.hasAlphaChannel()) { + alpha = true; +#endif } + imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat(); QImage image; if ((flags & ~Qt::NoOpaqueDetection) != Qt::AutoColor) { image = img.convertToFormat(imageFormat, flags); flags = Qt::AutoColor; - } else if (img.format() == QImage::Format_RGB32) { + } else if (img.format() == QImage::Format_RGB32 || img.depth() == 1) { image = img.convertToFormat(imageFormat, flags); } else { image = img; |