diff options
author | Anders Bakken <anders.bakken@nokia.com> | 2009-04-07 03:28:38 (GMT) |
---|---|---|
committer | Anders Bakken <anders.bakken@nokia.com> | 2009-04-07 03:30:02 (GMT) |
commit | 3eb0951fa7664e39c74df8edfca51c2a1199209b (patch) | |
tree | 2ff5f4feb93fcf63eae17f87ba629b0cd1fbd49a /src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp | |
parent | f70dcb0ed48bb393d3e7ed8941e98f1e52fff80e (diff) | |
download | Qt-3eb0951fa7664e39c74df8edfca51c2a1199209b.zip Qt-3eb0951fa7664e39c74df8edfca51c2a1199209b.tar.gz Qt-3eb0951fa7664e39c74df8edfca51c2a1199209b.tar.bz2 |
Improve QDirectFBPixmapData::copy
Make sure we retain the alpha channel of the original surface.
Reviewed-by: TrustMe
Diffstat (limited to 'src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp')
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index ee60302..9df3051 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -109,7 +109,8 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect) } IDirectFBSurface *src = static_cast<const QDirectFBPixmapData*>(data)->directFBSurface(); - const QImage::Format format = (data->hasAlphaChannel() + const bool hasAlpha = data->hasAlphaChannel(); + const QImage::Format format = (hasAlpha ? QDirectFBScreen::instance()->alphaPixmapFormat() : QDirectFBScreen::instance()->pixelFormat()); @@ -122,7 +123,12 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect) } forceRaster = (format == QImage::Format_RGB32); - dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); + if (hasAlpha) { + dfbSurface->Clear(dfbSurface, 0, 0, 0, 0); + dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_BLEND_ALPHACHANNEL); + } else { + dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); + } const DFBRectangle blitRect = { rect.x(), rect.y(), rect.width(), rect.height() }; DFBResult result = dfbSurface->Blit(dfbSurface, src, &blitRect, 0, 0); |