diff options
author | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2011-01-12 09:47:29 (GMT) |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@nokia.com> | 2011-01-12 10:20:06 (GMT) |
commit | a53e579a388c6bca6374b56328622bc8c1e0f138 (patch) | |
tree | 5ac6aa633dff674e098eb3c22f2d1fb03a2e2cf1 /src/gui/image/qpixmap_mac.cpp | |
parent | 6e16cc33983c9ed2c8362f0d31ef712df7949375 (diff) | |
download | Qt-a53e579a388c6bca6374b56328622bc8c1e0f138.zip Qt-a53e579a388c6bca6374b56328622bc8c1e0f138.tar.gz Qt-a53e579a388c6bca6374b56328622bc8c1e0f138.tar.bz2 |
Mac: pixmaps dont treat alpha exactly the same as other platforms
From fixing qwidget autotest, it seems to be the case that filling
a pixmap with a solid color on mac changes the hasAlpha status. This
is different from X11 (and raster engine). That is, the following
code will produce different result:
QPixmap pixmap(100, 100);
pixmap.setAlphaChannel(QPixmap(100, 100));
qDebug() << "Has alpha after setting channel?" << pixmap.hasAlpha();
pixmap.fill(Qt::red);
qDebug() << "Has alpha after fill?" << pixmap.hasAlpha();
So, this patch remove the possibility of converting an already alpha
supporting pixmap to non-alpha upon fill. NB: somewhat related, the
following code works the same on both x11, raster and mac (prints
'false'), but still seems wrong:
QPixmap pixmap2(pixmap);
qDebug() << "pixmap2 has alpha initially?" << pixmap2.hasAlpha();
Rev-By: Fabien Freling
Diffstat (limited to 'src/gui/image/qpixmap_mac.cpp')
-rw-r--r-- | src/gui/image/qpixmap_mac.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp index 31aa192..f152718 100644 --- a/src/gui/image/qpixmap_mac.cpp +++ b/src/gui/image/qpixmap_mac.cpp @@ -413,7 +413,11 @@ void QMacPixmapData::fill(const QColor &fillColor) *(dptr + i) = colr; } } - macSetHasAlpha(fillColor.alpha() != 255); + + // If we had an alpha channel from before, don't + // switch it off. Only go from no alpha to alpha: + if (fillColor.alpha() != 255) + macSetHasAlpha(true); } QPixmap QMacPixmapData::alphaChannel() const |