aboutsummaryrefslogtreecommitdiffstats
path: root/test/pugl_cairo_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/pugl_cairo_test.c')
-rw-r--r--test/pugl_cairo_test.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/test/pugl_cairo_test.c b/test/pugl_cairo_test.c
index 4219728..d3b157e 100644
--- a/test/pugl_cairo_test.c
+++ b/test/pugl_cairo_test.c
@@ -18,6 +18,8 @@
@file pugl_cairo_test.c A simple Pugl test that creates a top-level window.
*/
+#include "test_utils.h"
+
#include "pugl/pugl.h"
#include "pugl/pugl_cairo_backend.h"
@@ -216,10 +218,8 @@ main(int argc, char** argv)
puglShowWindow(view);
- float lastReportTime = (float)puglGetTime(view);
+ PuglFpsPrinter fpsPrinter = { puglGetTime(view) };
while (!quit) {
- const float thisTime = (float)puglGetTime(view);
-
if (continuous) {
puglPostRedisplay(view);
} else {
@@ -228,14 +228,8 @@ main(int argc, char** argv)
puglProcessEvents(view);
- if (continuous && thisTime > lastReportTime + 5) {
- const double fps = framesDrawn / (thisTime - lastReportTime);
- fprintf(stderr,
- "%u frames in %.0f seconds = %.3f FPS\n",
- framesDrawn, thisTime - lastReportTime, fps);
-
- lastReportTime = thisTime;
- framesDrawn = 0;
+ if (continuous) {
+ puglPrintFps(view, &fpsPrinter, &framesDrawn);
}
}