summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAnders Bakken <anders.bakken@nokia.com>2009-09-03 21:03:26 (GMT)
committerAnders Bakken <anders.bakken@nokia.com>2009-09-04 00:54:34 (GMT)
commit9753f87080e1d0f850854bc63f10aca1f3652cce (patch)
tree21a071d97f50bad6561e44e6f090634a6a8f6126 /src
parentdbcd5955769f2a7b23b1b6f91211ed8160a66859 (diff)
downloadQt-9753f87080e1d0f850854bc63f10aca1f3652cce.zip
Qt-9753f87080e1d0f850854bc63f10aca1f3652cce.tar.gz
Qt-9753f87080e1d0f850854bc63f10aca1f3652cce.tar.bz2
Cache the DFBSurface for the cursor image
This surface is painted every time we move the mouse cursor (in NO_DIRECTFB_WM) and doesn't change all that often so caching it is relatively easy and beneficial. Reviewed-by: Donald Carr <donald.carr@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 5651506..520bb1a 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -95,6 +95,9 @@ public:
IDirectFBImageProvider *imageProvider;
#endif
QColor backgroundColor;
+ IDirectFBSurface *cursorSurface;
+ qint64 cursorImageKey;
+
QDirectFBScreen *q;
};
@@ -117,6 +120,8 @@ QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *qptr)
#if defined QT_DIRECTFB_IMAGEPROVIDER && defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
, imageProvider(0)
#endif
+ , cursorSurface(0)
+ , cursorImageKey(0)
, q(qptr)
{
#ifndef QT_NO_QWS_SIGNALHANDLER
@@ -1460,13 +1465,17 @@ void QDirectFBScreen::exposeRegion(QRegion r, int changing)
const QRect cursorRectangle = cursor->boundingRect();
if (cursor->isVisible() && !cursor->isAccelerated() && cursorRectangle.intersects(brect)) {
const QImage image = cursor->image();
- IDirectFBSurface *surface = createDFBSurface(image, image.format(), QDirectFBScreen::DontTrackSurface);
- d_ptr->primarySurface->SetBlittingFlags(d_ptr->primarySurface, DSBLIT_BLEND_ALPHACHANNEL);
- d_ptr->primarySurface->Blit(d_ptr->primarySurface, surface, 0, cursorRectangle.x(), cursorRectangle.y());
- surface->Release(surface);
-#if (Q_DIRECTFB_VERSION >= 0x010000)
- d_ptr->primarySurface->ReleaseSource(d_ptr->primarySurface);
-#endif
+ if (image.cacheKey() != d_ptr->cursorImageKey) {
+ if (d_ptr->cursorSurface) {
+ releaseDFBSurface(d_ptr->cursorSurface);
+ }
+ d_ptr->cursorSurface = createDFBSurface(image, image.format(), QDirectFBScreen::TrackSurface);
+ d_ptr->cursorImageKey = image.cacheKey();
+ }
+
+ Q_ASSERT(d_ptr->cursorSurface);
+ primary->SetBlittingFlags(primary, DSBLIT_BLEND_ALPHACHANNEL);
+ primary->Blit(primary, d_ptr->cursorSurface, 0, cursorRectangle.x(), cursorRectangle.y());
}
}
#endif