diff options
author | Jason Barron <jason.barron@nokia.com> | 2010-11-23 10:13:41 (GMT) |
---|---|---|
committer | Jason Barron <jason.barron@nokia.com> | 2010-11-23 10:22:33 (GMT) |
commit | f9c97d3a4ab7bbd0ca2f4cf33a53025af23fc47c (patch) | |
tree | 175d7d2ef25f1df28024d6143552bce7c2d8387d /src/openvg/qpixmapdata_vg.cpp | |
parent | 9d9ecb86b80a57e5dcfafb71dc289ca62f64371a (diff) | |
download | Qt-f9c97d3a4ab7bbd0ca2f4cf33a53025af23fc47c.zip Qt-f9c97d3a4ab7bbd0ca2f4cf33a53025af23fc47c.tar.gz Qt-f9c97d3a4ab7bbd0ca2f4cf33a53025af23fc47c.tar.bz2 |
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
Diffstat (limited to 'src/openvg/qpixmapdata_vg.cpp')
-rw-r--r-- | src/openvg/qpixmapdata_vg.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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<QImage &>(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; |