summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Bakken <anders.bakken@nokia.com>2009-04-07 05:45:07 (GMT)
committerAnders Bakken <anders.bakken@nokia.com>2009-04-07 05:47:17 (GMT)
commit3923604b4390e613000f4c2b00db9e0a954f92ed (patch)
treec3e0d650325f012237af737926b018a51b35d2ac
parentbf3fdc3f6697cfaec689e8422b6c43cfe49bf9b4 (diff)
downloadQt-3923604b4390e613000f4c2b00db9e0a954f92ed.zip
Qt-3923604b4390e613000f4c2b00db9e0a954f92ed.tar.gz
Qt-3923604b4390e613000f4c2b00db9e0a954f92ed.tar.bz2
Better QDirectFBPixmapData::toImage()
This is essentially a return to the earlier version of toImage(). Use a preallocated surface that operates on the returned image to do the conversion. If this causes drawing bugs it is likely a bug in the directfb driver and can be worked around by compiling with QT_NO_DIRECTFB_PREALLOCATED. Reviewed-by: TrustMe
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index 923025a..45f0710 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -245,6 +245,17 @@ QImage QDirectFBPixmapData::toImage() const
if (!dfbSurface)
return QImage();
+#ifndef QT_NO_DIRECTFB_PREALLOCATED
+ QImage ret(size(), QDirectFBScreen::getImageFormat(dfbSurface));
+ if (IDirectFBSurface *imgSurface = screen->createDFBSurface(ret, QDirectFBScreen::DontTrackSurface)) {
+ imgSurface->SetBlittingFlags(imgSurface, hasAlphaChannel() ? DSBLIT_BLEND_ALPHACHANNEL : DSBLIT_NOFX);
+ imgSurface->Blit(imgSurface, dfbSurface, 0, 0, 0);
+ imgSurface->ReleaseSource(imgSurface);
+ imgSurface->Release(imgSurface);
+ return ret;
+ }
+#endif
+
QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this);
const QImage *img = that->buffer();
return img->copy();