summaryrefslogtreecommitdiff
path: root/packages/gtk+/pixops-test
diff options
context:
space:
mode:
authorKoen Kooi <koen@openembedded.org>2007-02-13 20:45:02 +0000
committerKoen Kooi <koen@openembedded.org>2007-02-13 20:45:02 +0000
commita7d5f5476e29516c2e2a1ffe35b37fb067121d5e (patch)
treed5f44018671f212e4c24ee8493576f813dff6e8a /packages/gtk+/pixops-test
parent65d382a0e3d9610190c1a044dde520e725cdc75a (diff)
pixop-test: add small benchmark program to test gdk pixbuf scaling speed
Diffstat (limited to 'packages/gtk+/pixops-test')
-rw-r--r--packages/gtk+/pixops-test/.mtn2git_empty0
-rw-r--r--packages/gtk+/pixops-test/gtk-logo-rgb.gifbin0 -> 6459 bytes
-rw-r--r--packages/gtk+/pixops-test/pixops-test.c36
3 files changed, 36 insertions, 0 deletions
diff --git a/packages/gtk+/pixops-test/.mtn2git_empty b/packages/gtk+/pixops-test/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/gtk+/pixops-test/.mtn2git_empty
diff --git a/packages/gtk+/pixops-test/gtk-logo-rgb.gif b/packages/gtk+/pixops-test/gtk-logo-rgb.gif
new file mode 100644
index 0000000000..f6e934d5e6
--- /dev/null
+++ b/packages/gtk+/pixops-test/gtk-logo-rgb.gif
Binary files differ
diff --git a/packages/gtk+/pixops-test/pixops-test.c b/packages/gtk+/pixops-test/pixops-test.c
new file mode 100644
index 0000000000..33a11263de
--- /dev/null
+++ b/packages/gtk+/pixops-test/pixops-test.c
@@ -0,0 +1,36 @@
+#include <gtk/gtk.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+static gdouble total_seconds = 0.0;
+
+
+int
+main (int argc, char **argv)
+{
+ GTimer *timer;
+
+ gtk_init (&argc, &argv);
+
+
+ GdkPixbuf *pixbuf, *ret;
+ pixbuf = gdk_pixbuf_new_from_file("/usr/share/pixop-test/gtk-logo-rgb.gif", NULL);
+
+ timer = g_timer_new ();
+ g_timer_start (timer);
+
+ int i;
+
+ for (i = 1; i <= 100 ; i++) {
+ ret = gdk_pixbuf_scale_simple (pixbuf, 800, 600, GDK_INTERP_BILINEAR);
+ ret = gdk_pixbuf_scale_simple (pixbuf, 300, 400, GDK_INTERP_BILINEAR);
+ }
+ g_timer_stop (timer);
+
+ total_seconds += g_timer_elapsed (timer, NULL);
+
+ gtk_main ();
+
+ g_print ("time spent scaling (in seconds): %lf\n", total_seconds );
+
+ return 0;
+}