summaryrefslogtreecommitdiffstats
path: root/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp
diff options
context:
space:
mode:
authorAnders Bakken <anders.bakken@nokia.com>2009-04-04 00:34:09 (GMT)
committerAnders Bakken <anders.bakken@nokia.com>2009-04-04 00:36:10 (GMT)
commit11fdefebdd26e5cef4736384f2f3ad0cafc2db1e (patch)
treef6136beaf51e1327431c1e29a114012f000135b9 /src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp
parent3cfa6a8b5338c2490dda498ba4a27a2917675b72 (diff)
downloadQt-11fdefebdd26e5cef4736384f2f3ad0cafc2db1e.zip
Qt-11fdefebdd26e5cef4736384f2f3ad0cafc2db1e.tar.gz
Qt-11fdefebdd26e5cef4736384f2f3ad0cafc2db1e.tar.bz2
Add some timing capabilities
Add some frames-per-second output for debugging when QT_DIRECTFB_TIMING is defined. Reviewed-by: Donald <qt-info@nokia.com>
Diffstat (limited to 'src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp')
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp
index c495805..ef208af 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp
@@ -58,6 +58,10 @@ QDirectFBSurface::QDirectFBSurface(QDirectFBScreen* scr)
, engine(0)
{
setSurfaceFlags(Opaque | Buffered);
+#ifdef QT_DIRECTFB_TIMING
+ frames = 0;
+ timer.start();
+#endif
}
QDirectFBSurface::QDirectFBSurface(QDirectFBScreen* scr, QWidget *widget)
@@ -72,6 +76,10 @@ QDirectFBSurface::QDirectFBSurface(QDirectFBScreen* scr, QWidget *widget)
setSurfaceFlags(Opaque | RegionReserved);
else
setSurfaceFlags(Opaque | Buffered);
+#ifdef QT_DIRECTFB_TIMING
+ frames = 0;
+ timer.start();
+#endif
}
QDirectFBSurface::~QDirectFBSurface()
@@ -307,7 +315,6 @@ inline bool isWidgetOpaque(const QWidget *w)
return false;
}
-
void QDirectFBSurface::flush(QWidget *widget, const QRegion &region,
const QPoint &offset)
{
@@ -350,6 +357,15 @@ void QDirectFBSurface::flush(QWidget *widget, const QRegion &region,
dfbSurface->Flip(dfbSurface, &dfbReg, DSFLIP_ONSYNC);
}
#endif
+#ifdef QT_DIRECTFB_TIMING
+ enum { Secs = 3 };
+ ++frames;
+ if (timer.elapsed() >= Secs * 1000) {
+ qDebug("%d fps", int(double(frames) / double(Secs)));
+ frames = 0;
+ timer.restart();
+ }
+#endif
}