summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Bakken <anders.bakken@nokia.com>2010-01-22 21:15:21 (GMT)
committerAnders Bakken <anders.bakken@nokia.com>2010-01-22 21:20:08 (GMT)
commite5e6d9e7fe8f5c3baa5caf609198db1184f59ef9 (patch)
treecb0846556080cfa52e12e6cf6da8746be584a8f8
parent5f4af1b5b5a96875b42750a778dcf6695a844623 (diff)
downloadQt-e5e6d9e7fe8f5c3baa5caf609198db1184f59ef9.zip
Qt-e5e6d9e7fe8f5c3baa5caf609198db1184f59ef9.tar.gz
Qt-e5e6d9e7fe8f5c3baa5caf609198db1184f59ef9.tar.bz2
Implement QDirectFBPixmapData::scroll
This is a very operation in DirectFB and saves a fair bit of overhead. Reviewed-by: Donald Carr <donald.carr@nokia.com>
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp31
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h1
2 files changed, 29 insertions, 3 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index 1cbfdaf..f27440e 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -552,6 +552,34 @@ QImage *QDirectFBPixmapData::buffer()
return &lockedImage;
}
+
+bool QDirectFBPixmapData::scroll(int dx, int dy, const QRect &rect)
+{
+ if (!dfbSurface) {
+ return false;
+ }
+ unlockSurface();
+ DFBResult result = dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX);
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBPixmapData::scroll", result);
+ return false;
+ }
+ result = dfbSurface->SetPorterDuff(dfbSurface, DSPD_NONE);
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBPixmapData::scroll", result);
+ return false;
+ }
+
+ const DFBRectangle source = { rect.x(), rect.y(), rect.width(), rect.height() };
+ result = dfbSurface->Blit(dfbSurface, dfbSurface, &source, source.x + dx, source.y + dy);
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBPixmapData::scroll", result);
+ return false;
+ }
+
+ return true;
+}
+
void QDirectFBPixmapData::invalidate()
{
if (dfbSurface) {
@@ -568,6 +596,3 @@ void QDirectFBPixmapData::invalidate()
QT_END_NAMESPACE
#endif // QT_NO_QWS_DIRECTFB
-
-
-
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
index f9b14a9..da6edc6 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
@@ -81,6 +81,7 @@ public:
virtual QImage toImage() const;
virtual QPaintEngine *paintEngine() const;
virtual QImage *buffer();
+ virtual bool scroll(int dx, int dy, const QRect &rect);
// Pure virtual in QPixmapData, so re-implement here and delegate to QDirectFBPaintDevice
virtual int metric(QPaintDevice::PaintDeviceMetric m) const { return QDirectFBPaintDevice::metric(m); }