From fd4a62bfc18006b3c29918a65b60d9bacf22c9c0 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 6 Apr 2009 22:52:12 -0700 Subject: Call ReleaseSource where appropriate DirectFB caches the last source surface in the target surface after a Blit. This can cause a surface to be kept around longer than desired since the caching increases the ref-count. Unless it's likely that the blit will happen again soon we Release the source. Reviewed-by: TrustMe --- src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp | 2 ++ src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp | 3 ++- src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index 45f0710..c4144bd 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -132,6 +132,7 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect) const DFBRectangle blitRect = { rect.x(), rect.y(), rect.width(), rect.height() }; DFBResult result = dfbSurface->Blit(dfbSurface, src, &blitRect, 0, 0); + dfbSurface->ReleaseSource(dfbSurface); if (result != DFB_OK) { DirectFBError("QDirectFBPixmapData::copy()", result); setSerialNumber(0); @@ -236,6 +237,7 @@ QPixmap QDirectFBPixmapData::transformed(const QTransform &transform, const DFBRectangle destRect = { 0, 0, size.width(), size.height() }; data->dfbSurface->StretchBlit(data->dfbSurface, dfbSurface, 0, &destRect); + data->dfbSurface->ReleaseSource(data->dfbSurface); return QPixmap(data); } diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index cb40935..4ae64f7 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -195,7 +195,7 @@ IDirectFBSurface *QDirectFBScreen::copyDFBSurface(IDirectFBSurface *src, surface->SetBlittingFlags(surface, flags); surface->Blit(surface, src, 0, 0, 0); - surface->ReleaseSource(surface); // ??? Is this always right? + surface->ReleaseSource(surface); return surface; } @@ -1093,6 +1093,7 @@ void QDirectFBScreen::compose(const QRegion ®ion) blit(surface->image(), offset, r); } } + d_ptr->dfbSurface->ReleaseSource(d_ptr->dfbSurface); } // Normally, when using DirectFB to compose the windows (I.e. when diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp index 15c2f7c..592ad47 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp @@ -262,7 +262,7 @@ bool QDirectFBSurface::scroll(const QRegion ®ion, int dx, int dy) dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); dfbSurface->BatchBlit(dfbSurface, dfbSurface, dfbRects.data(), dfbPoints.data(), n); - + dfbSurface->ReleaseSource(dfbSurface); return true; } -- cgit v0.12