[cairo-commit] 3 commits - boilerplate/cairo-boilerplate.c boilerplate/cairo-boilerplate.h configure.in perf/cairo-perf.c perf/.gitignore test/cairo-test.c test/cairo-test.h

Carl Worth cworth at kemper.freedesktop.org
Thu Aug 31 08:54:10 PDT 2006


 boilerplate/cairo-boilerplate.c |   26 +++++++++++++++-----------
 boilerplate/cairo-boilerplate.h |    7 +++++++
 configure.in                    |   12 +++++++-----
 perf/.gitignore                 |    1 -
 perf/cairo-perf.c               |   37 +++++++++++++++++++++++++++++++++++++
 test/cairo-test.c               |   15 ---------------
 test/cairo-test.h               |    8 --------
 7 files changed, 66 insertions(+), 40 deletions(-)

New commits:
diff-tree 2c16aa63044afe75c00518c2cb7e5ba6288e905a (from 4915e0baa761f1179023f2ad5d5cd3dd6aeaba2f)
Author: Carl Worth <cworth at cworth.org>
Date:   Thu Aug 31 08:53:58 2006 -0700

    perf: Don't measure meta-surface-backed surface types.

diff --git a/boilerplate/cairo-boilerplate.h b/boilerplate/cairo-boilerplate.h
index f6abd60..7f8f0ed 100644
--- a/boilerplate/cairo-boilerplate.h
+++ b/boilerplate/cairo-boilerplate.h
@@ -30,7 +30,10 @@
 #include "config.h"
 #endif
 
+#include <stdio.h>
+#include <math.h>
 #include <cairo.h>
+#include <string.h>
 
 #include "xmalloc.h"
 
diff --git a/perf/.gitignore b/perf/.gitignore
index e219350..f2938f9 100644
--- a/perf/.gitignore
+++ b/perf/.gitignore
@@ -1,2 +1 @@
 cairo-perf
-*-out.ps
diff --git a/perf/cairo-perf.c b/perf/cairo-perf.c
index 0c64c3b..14f2d57 100644
--- a/perf/cairo-perf.c
+++ b/perf/cairo-perf.c
@@ -41,6 +41,41 @@ cairo_perf_t perfs[] = {
     { NULL }
 };
 
+/* Some targets just aren't that interesting for performance testing,
+ * (not least because many of these surface types use a meta-surface
+ * and as such defer the "real" rendering to later, so our timing
+ * loops wouldn't count the real work, just the recording by the
+ * meta-surface. */
+static cairo_bool_t
+target_is_measurable (cairo_test_target_t *target)
+{
+    switch (target->expected_type) {
+    case CAIRO_SURFACE_TYPE_IMAGE:
+	if (strcmp (target->name, "pdf") ||
+	    strcmp (target->name, "ps"))
+	{
+	    return FALSE;
+	}
+	else
+	{
+	    return TRUE;
+	}
+    case CAIRO_SURFACE_TYPE_XLIB:
+    case CAIRO_SURFACE_TYPE_XCB:
+    case CAIRO_SURFACE_TYPE_GLITZ:
+    case CAIRO_SURFACE_TYPE_QUARTZ:
+    case CAIRO_SURFACE_TYPE_WIN32:
+    case CAIRO_SURFACE_TYPE_BEOS:
+    case CAIRO_SURFACE_TYPE_DIRECTFB:
+	return TRUE;
+    case CAIRO_SURFACE_TYPE_PDF:
+    case CAIRO_SURFACE_TYPE_PS:
+    case CAIRO_SURFACE_TYPE_SVG:
+    default:
+	return FALSE;
+    }
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -53,6 +88,8 @@ main (int argc, char *argv[])
 
     for (i = 0; targets[i].name; i++) {
 	target = &targets[i];
+	if (! target_is_measurable (target))
+	    continue;
 	for (j = 0; perfs[j].name; j++) {
 	    perf = &perfs[j];
 	    for (size = perf->min_size; size <= perf->max_size; size *= 2) {
diff --git a/test/cairo-test.h b/test/cairo-test.h
index 75eadb4..381709d 100644
--- a/test/cairo-test.h
+++ b/test/cairo-test.h
@@ -26,14 +26,6 @@
 #ifndef _CAIRO_TEST_H_
 #define _CAIRO_TEST_H_
 
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-#include <math.h>
-#include <cairo.h>
-
 #define CAIRO_BOILERPLATE_LOG(...) cairo_test_log (__VA_ARGS__)
 #include "cairo-boilerplate.h"
 
diff-tree 4915e0baa761f1179023f2ad5d5cd3dd6aeaba2f (from 8d834c3a34a17de0e03841501ea107dee7b373d0)
Author: Carl Worth <cworth at cworth.org>
Date:   Thu Aug 31 08:36:29 2006 -0700

    boilerplate: Fix missing include of config.h which was preventing many backends from being tested

diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c
index eb4ab05..c37662f 100644
--- a/boilerplate/cairo-boilerplate.c
+++ b/boilerplate/cairo-boilerplate.c
@@ -43,6 +43,21 @@
 #include <fontconfig/fontconfig.h>
 #endif
 
+/* This is copied from cairoint.h. That makes it painful to keep in
+ * sync, but the slim stuff makes cairoint.h "hard" to include when
+ * not actually building the cairo library itself. Fortunately, since
+ * we're checking all these values, we do have a safeguard for keeping
+ * them in sync.
+ */
+typedef enum cairo_internal_surface_type {
+    CAIRO_INTERNAL_SURFACE_TYPE_META = 0x1000,
+    CAIRO_INTERNAL_SURFACE_TYPE_PAGINATED,
+    CAIRO_INTERNAL_SURFACE_TYPE_ANALYSIS,
+    CAIRO_INTERNAL_SURFACE_TYPE_TEST_META,
+    CAIRO_INTERNAL_SURFACE_TYPE_TEST_FALLBACK,
+    CAIRO_INTERNAL_SURFACE_TYPE_TEST_PAGINATED
+} cairo_internal_surface_type_t;
+
 static const char *vector_ignored_tests[] = {
     /* We can't match the results of tests that depend on
      * CAIRO_ANTIALIAS_NONE/SUBPIXEL for vector backends
@@ -365,8 +380,6 @@ create_cairo_glitz_glx_surface (const ch
 				int		  height,
 				void		**closure)
 {
-    int width = width;
-    int height = height;
     glitz_glx_target_closure_t *gxtc;
     glitz_surface_t  * glitz_surface;
     cairo_surface_t  * surface;
@@ -707,9 +720,6 @@ create_win32_surface (const char	 *name,
 		      int		  height,
 		      void		**closure)
 {
-    int width = width;
-    int height = height;
-
     BITMAPINFO bmpInfo;
     unsigned char *bits = NULL;
     win32_target_closure_t *data = malloc(sizeof(win32_target_closure_t));
@@ -853,8 +863,6 @@ create_xcb_surface (const char		 *name,
 		    int			  height,
 		    void		**closure)
 {
-    int width = width;
-    int height = height;
     XCBSCREEN *root;
     xcb_target_closure_t *xtc;
     cairo_surface_t *surface;
@@ -1136,8 +1144,6 @@ create_pdf_surface (const char		 *name,
 		    int			  height,
 		    void		**closure)
 {
-    int width = width;
-    int height = height;
     pdf_target_closure_t *ptc;
     cairo_surface_t *surface;
     int i;
@@ -1247,8 +1253,6 @@ create_svg_surface (const char		 *name,
 		    int			  height,
 		    void		**closure)
 {
-    int width = width;
-    int height = height;
     int i;
     svg_target_closure_t *ptc;
     cairo_surface_t *surface;
diff --git a/boilerplate/cairo-boilerplate.h b/boilerplate/cairo-boilerplate.h
index f91ebff..f6abd60 100644
--- a/boilerplate/cairo-boilerplate.h
+++ b/boilerplate/cairo-boilerplate.h
@@ -26,6 +26,10 @@
 #ifndef _CAIRO_BOILERPLATE_H_
 #define _CAIRO_BOILERPLATE_H_
 
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <cairo.h>
 
 #include "xmalloc.h"
diff --git a/test/cairo-test.c b/test/cairo-test.c
index fbb7aa6..cceed29 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -50,21 +50,6 @@
 #include "buffer-diff.h"
 #include "xmalloc.h"
 
-/* This is copied from cairoint.h. That makes it painful to keep in
- * sync, but the slim stuff makes cairoint.h "hard" to include when
- * not actually building the cairo library itself. Fortunately, since
- * we're checking all these values, we do have a safeguard for keeping
- * them in sync.
- */
-typedef enum cairo_internal_surface_type {
-    CAIRO_INTERNAL_SURFACE_TYPE_META = 0x1000,
-    CAIRO_INTERNAL_SURFACE_TYPE_PAGINATED,
-    CAIRO_INTERNAL_SURFACE_TYPE_ANALYSIS,
-    CAIRO_INTERNAL_SURFACE_TYPE_TEST_META,
-    CAIRO_INTERNAL_SURFACE_TYPE_TEST_FALLBACK,
-    CAIRO_INTERNAL_SURFACE_TYPE_TEST_PAGINATED
-} cairo_internal_surface_type_t;
-
 #ifdef _MSC_VER
 #define vsnprintf _vsnprintf
 #define access _access
diff-tree 8d834c3a34a17de0e03841501ea107dee7b373d0 (from e153c55dffca6b95a8ad9c731156a579f8979f42)
Author: Carl Worth <cworth at cworth.org>
Date:   Thu Aug 31 08:35:39 2006 -0700

    Require librsvg >= 2.14.0 to test SVG backend

diff --git a/configure.in b/configure.in
index dd06b8a..f151ca3 100644
--- a/configure.in
+++ b/configure.in
@@ -485,13 +485,14 @@ CAIRO_BACKEND_ENABLE(pdf, PDF, pdf, PDF_
     pdf_NONPKGCONFIG_LIBS=-lz
 ])
 
+POPPLER_VERSION_REQUIRED=0.4.1
 test_pdf=no
 if test "x$use_pdf" = "xyes"; then
-  PKG_CHECK_MODULES(POPPLER, poppler-glib >= 0.4.1 pango gtk+-2.0, [test_pdf=yes], [test_pdf=no])
+  PKG_CHECK_MODULES(POPPLER, poppler-glib >= $POPPLER_VERSION_REQUIRED pango gtk+-2.0, [test_pdf=yes], [test_pdf=no])
   if test "x$test_pdf" = "xyes"; then
     AC_DEFINE([CAIRO_CAN_TEST_PDF_SURFACE], 1, [Define to 1 if the PDF backend can be tested (need poppler and other dependencies for pdf2png)])
   else
-    AC_MSG_WARN([PDF backend will not be tested since poppler is not available])
+    AC_MSG_WARN([PDF backend will not be tested since poppler >= $POPPLER_VERSION_REQUIRED is not available])
   fi
 fi
 
@@ -509,12 +510,13 @@ CAIRO_BACKEND_ENABLE(svg, SVG, svg, SVG_
   fi
 ])
 
+LIBRSVG_VERSION_REQUIRED=2.14.0
 if test "x$use_svg" = "xyes"; then
-  PKG_CHECK_MODULES(LIBRSVG, librsvg-2.0 gdk-2.0, [test_svg=yes], [test_svg=no])
+  PKG_CHECK_MODULES(LIBRSVG, librsvg-2.0 >= $LIBRSVG_VERSION_REQUIRED gdk-2.0, [test_svg=yes], [test_svg=no])
   if test "x$test_svg" = "xyes"; then
-    AC_DEFINE([CAIRO_CAN_TEST_SVG_SURFACE], 1, [Define to 1 if the SVG backend can be tested (need librsvg)])
+    AC_DEFINE([CAIRO_CAN_TEST_SVG_SURFACE], 1, [Define to 1 if the SVG backend can be tested])
   else
-    AC_MSG_WARN([SVG backend will not be tested since a librsvg is not available])
+    AC_MSG_WARN([SVG backend will not be tested since librsvg >= $LIBRSVG_VERSION_REQUIRED is not available])
   fi
 fi
 


More information about the cairo-commit mailing list