pixop-test: add small benchmark program to test gdk pixbuf scaling speed
authorKoen Kooi <koen@openembedded.org>
Tue, 13 Feb 2007 20:45:02 +0000 (20:45 +0000)
committerKoen Kooi <koen@openembedded.org>
Tue, 13 Feb 2007 20:45:02 +0000 (20:45 +0000)
packages/gtk+/pixops-test.bb [new file with mode: 0644]
packages/gtk+/pixops-test/.mtn2git_empty [new file with mode: 0644]
packages/gtk+/pixops-test/gtk-logo-rgb.gif [new file with mode: 0644]
packages/gtk+/pixops-test/pixops-test.c [new file with mode: 0644]

diff --git a/packages/gtk+/pixops-test.bb b/packages/gtk+/pixops-test.bb
new file mode 100644 (file)
index 0000000..b65f700
--- /dev/null
@@ -0,0 +1,25 @@
+DESCRIPTION = "Productive gtk+ devel prodder"
+DEPENDS = "gtk+"
+
+PR = "r1"
+
+inherit pkgconfig
+
+SRC_URI = "file://pixops-test.c \
+           file://gtk-logo-rgb.gif"
+
+do_configure() {
+       cp ${WORKDIR}/pixops-test.c ${S}
+       cp ${WORKDIR}/gtk-logo-rgb.gif ${S}
+}
+
+do_compile() {
+       ${CC} `pkg-config gtk+-2.0 --libs --cflags` `pkg-config pango --libs --cflags` -lXfixes -lz -lpangoft2-1.0 -lgpg-error -lXdmcp -lXcursor -lexpat -lXau -lgcrypt -lXext -lXinerama -lXrandr -o pixops-test pixops-test.c         
+}
+
+do_install() {
+       install -d ${D}${bindir}
+       install -d ${D}${datadir}/pixops-test
+       install -m 755 pixops-test ${D}${bindir}
+       install -m 644 gtk-logo-rgb.gif ${D}${datadir}/pixops-test
+}
diff --git a/packages/gtk+/pixops-test/.mtn2git_empty b/packages/gtk+/pixops-test/.mtn2git_empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/packages/gtk+/pixops-test/gtk-logo-rgb.gif b/packages/gtk+/pixops-test/gtk-logo-rgb.gif
new file mode 100644 (file)
index 0000000..f6e934d
Binary files /dev/null and b/packages/gtk+/pixops-test/gtk-logo-rgb.gif differ
diff --git a/packages/gtk+/pixops-test/pixops-test.c b/packages/gtk+/pixops-test/pixops-test.c
new file mode 100644 (file)
index 0000000..33a1126
--- /dev/null
@@ -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;
+}