From f9c97d3a4ab7bbd0ca2f4cf33a53025af23fc47c Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Tue, 23 Nov 2010 11:13:41 +0100 Subject: Fix QPixmap::fromImage() in the OpenVG pixmap backend. If QPixmap::fromImage() was called with a QImage that has an alpha channel and with the 'Qt::NoOpaqueDetection' image conversion flag set, then we would always create an opaque (RGB32) pixmap. This is incorrect. The fix is to check if the source QImage has an alpha channel and if so, use sourceFormat(), otherwise use RGB32. Task-number: QT-4278 Reviewed-by: Jani Hautakangas --- src/openvg/qpixmapdata_vg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index 509882b..c3c7def 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -214,7 +214,7 @@ void QVGPixmapData::createPixmapForImage(QImage &image, Qt::ImageConversionFlags else if (!(flags & Qt::NoOpaqueDetection) && const_cast(image).data_ptr()->checkForAlphaPixels()) format = sourceFormat(); else - format = QImage::Format_RGB32; + format = image.hasAlphaChannel() ? sourceFormat() : QImage::Format_RGB32; if (inPlace && image.data_ptr()->convertInPlace(format, flags)) source = image; -- cgit v0.12