[cairo-commit] 3 commits - boilerplate/cairo-boilerplate.c boilerplate/cairo-boilerplate-test-surfaces.c boilerplate/cairo-boilerplate-test-surfaces-private.h build/configure.ac.features perf/cairo-perf-trace.c src/cairo-analysis-surface.c src/Makefile.sources src/test-null-surface.c test/cairo-test.c util/cairo-trace

Chris Wilson ickle at kemper.freedesktop.org
Mon Jun 15 04:04:18 PDT 2009


 boilerplate/cairo-boilerplate-test-surfaces-private.h |   10 +++
 boilerplate/cairo-boilerplate-test-surfaces.c         |   16 +++++
 boilerplate/cairo-boilerplate.c                       |    9 ++
 build/configure.ac.features                           |    6 -
 perf/cairo-perf-trace.c                               |    6 -
 src/Makefile.sources                                  |    2 
 src/cairo-analysis-surface.c                          |   56 ++++++++++++++++--
 src/test-null-surface.c                               |   48 +++++++++++++++
 test/cairo-test.c                                     |   14 +++-
 util/cairo-trace/Makefile.am                          |    3 
 util/cairo-trace/trace.c                              |   26 ++++++++
 11 files changed, 180 insertions(+), 16 deletions(-)

New commits:
commit e5727e20f52eb0308a8ad1c44a6eb4c7c65d7ff0
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jun 15 11:58:58 2009 +0100

    Expose _cairo_null_surface_create() via a test surface
    
    Using a null surface is a convenient method to measure the overhead of the
    performance testing framework, so export it although as a test-surface so
    that it will only be available in development builds and not pollute
    distributed libraries.

diff --git a/boilerplate/cairo-boilerplate-test-surfaces-private.h b/boilerplate/cairo-boilerplate-test-surfaces-private.h
index 24a1ae8..55134fe 100644
--- a/boilerplate/cairo-boilerplate-test-surfaces-private.h
+++ b/boilerplate/cairo-boilerplate-test-surfaces-private.h
@@ -61,6 +61,16 @@ _cairo_boilerplate_test_meta_create_surface (const char			 *name,
 					     int                          id,
 					     void			**closure);
 
+cairo_surface_t *
+_cairo_boilerplate_test_null_create_surface (const char			 *name,
+					     cairo_content_t		  content,
+					     int			  width,
+					     int			  height,
+					     int			  max_width,
+					     int			  max_height,
+					     cairo_boilerplate_mode_t	  mode,
+					     int                          id,
+					     void			**closure);
 
 cairo_surface_t *
 _cairo_boilerplate_test_paginated_create_surface (const char			 *name,
diff --git a/boilerplate/cairo-boilerplate-test-surfaces.c b/boilerplate/cairo-boilerplate-test-surfaces.c
index 644b278..0fc92e3 100644
--- a/boilerplate/cairo-boilerplate-test-surfaces.c
+++ b/boilerplate/cairo-boilerplate-test-surfaces.c
@@ -30,6 +30,7 @@
 #include <test-fallback-surface.h>
 #include <test-fallback16-surface.h>
 #include <test-meta-surface.h>
+#include <test-null-surface.h>
 #include <test-paginated-surface.h>
 
 #include <assert.h>
@@ -79,6 +80,21 @@ _cairo_boilerplate_test_meta_create_surface (const char			 *name,
     return _cairo_test_meta_surface_create (content, width, height);
 }
 
+cairo_surface_t *
+_cairo_boilerplate_test_null_create_surface (const char			 *name,
+					     cairo_content_t		  content,
+					     int			  width,
+					     int			  height,
+					     int			  max_width,
+					     int			  max_height,
+					     cairo_boilerplate_mode_t	  mode,
+					     int                          id,
+					     void			**closure)
+{
+    *closure = NULL;
+    return _cairo_test_null_surface_create (content);
+}
+
 static const cairo_user_data_key_t test_paginated_closure_key;
 
 typedef struct {
diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c
index e3d96a2..6da2822 100644
--- a/boilerplate/cairo-boilerplate.c
+++ b/boilerplate/cairo-boilerplate.c
@@ -374,6 +374,15 @@ static const cairo_boilerplate_target_t targets[] =
 	NULL,
 	FALSE, TRUE
     },
+    {
+	"null", "image", NULL,
+	CAIRO_INTERNAL_SURFACE_TYPE_NULL,
+	CAIRO_CONTENT_COLOR_ALPHA, 0,
+	_cairo_boilerplate_test_null_create_surface, NULL,
+	NULL, NULL, NULL,
+	NULL, NULL,
+	TRUE, FALSE
+    },
 #endif
 #ifdef CAIRO_HAS_GLITZ_SURFACE
 #if CAIRO_CAN_TEST_GLITZ_GLX_SURFACE
diff --git a/perf/cairo-perf-trace.c b/perf/cairo-perf-trace.c
index 6ef44a9..9b535df 100644
--- a/perf/cairo-perf-trace.c
+++ b/perf/cairo-perf-trace.c
@@ -35,6 +35,7 @@
 
 #include "cairo-boilerplate-getopt.h"
 #include <cairo-script-interpreter.h>
+#include <cairo-types-private.h> /* for INTERNAL_SURFACE_TYPE */
 
 /* For basename */
 #ifdef HAVE_LIBGEN_H
@@ -71,7 +72,7 @@ target_is_measurable (const cairo_boilerplate_target_t *target)
     if (target->content != CAIRO_CONTENT_COLOR_ALPHA)
 	return FALSE;
 
-    switch (target->expected_type) {
+    switch ((int) target->expected_type) {
     case CAIRO_SURFACE_TYPE_IMAGE:
 	if (strcmp (target->name, "pdf") == 0 ||
 	    strcmp (target->name, "ps") == 0)
@@ -97,9 +98,8 @@ target_is_measurable (const cairo_boilerplate_target_t *target)
     case CAIRO_SURFACE_TYPE_WIN32:
     case CAIRO_SURFACE_TYPE_BEOS:
     case CAIRO_SURFACE_TYPE_DIRECTFB:
-#if CAIRO_VERSION_MAJOR > 1 || (CAIRO_VERSION_MAJOR == 1 && CAIRO_VERSION_MINOR > 2)
     case CAIRO_SURFACE_TYPE_OS2:
-#endif
+    case CAIRO_INTERNAL_SURFACE_TYPE_NULL:
 	return TRUE;
     case CAIRO_SURFACE_TYPE_PDF:
     case CAIRO_SURFACE_TYPE_PS:
diff --git a/src/Makefile.sources b/src/Makefile.sources
index 534feec..ec58b2d 100644
--- a/src/Makefile.sources
+++ b/src/Makefile.sources
@@ -192,12 +192,14 @@ cairo_test_surfaces_private = \
 	test-fallback-surface.h \
 	test-fallback16-surface.h \
 	test-meta-surface.h \
+	test-null-surface.h \
 	test-paginated-surface.h \
 	$(NULL)
 cairo_test_surfaces_sources = \
 	test-fallback-surface.c \
 	test-fallback16-surface.c \
 	test-meta-surface.c \
+	test-null-surface.c \
 	test-paginated-surface.c \
 	$(NULL)
 
diff --git a/src/cairo-analysis-surface.c b/src/cairo-analysis-surface.c
index c767d07..b0cc54c 100644
--- a/src/cairo-analysis-surface.c
+++ b/src/cairo-analysis-surface.c
@@ -875,6 +875,12 @@ typedef cairo_int_status_t
 (*_set_clip_region_func)	(void			*surface,
 				 cairo_region_t		*region);
 typedef cairo_int_status_t
+(*_intersect_clip_path_func)	(void			*dst,
+				 cairo_path_fixed_t	*path,
+				 cairo_fill_rule_t	fill_rule,
+				 double			tolerance,
+				 cairo_antialias_t	antialias);
+typedef cairo_int_status_t
 (*_paint_func)			(void			*surface,
 			         cairo_operator_t	 op,
 				 const cairo_pattern_t	*source,
@@ -919,10 +925,50 @@ typedef cairo_int_status_t
 				 int			*remaining_glyphs,
 				 cairo_rectangle_int_t  *extents);
 
+typedef cairo_int_status_t
+(*_show_text_glyphs_func)	(void			    *surface,
+				 cairo_operator_t	     op,
+				 const cairo_pattern_t	    *source,
+				 const char		    *utf8,
+				 int			     utf8_len,
+				 cairo_glyph_t		    *glyphs,
+				 int			     num_glyphs,
+				 const cairo_text_cluster_t *clusters,
+				 int			     num_clusters,
+				 cairo_text_cluster_flags_t  cluster_flags,
+				 cairo_scaled_font_t	    *scaled_font,
+				 cairo_rectangle_int_t	    *extents);
+
+static cairo_surface_t *
+_cairo_null_surface_create_similar (void *other,
+				    cairo_content_t content,
+				    int width, int height)
+{
+    return _cairo_null_surface_create (content);
+}
+
+static cairo_int_status_t
+_cairo_null_surface_get_extents (void *surface,
+				 cairo_rectangle_int_t *extents)
+{
+    extents->x = 0;
+    extents->y = 0;
+    extents->width = 0;
+    extents->height = 0;
+
+    return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_bool_t
+_cairo_null_surface_has_show_text_glyphs (void *surface)
+{
+    return TRUE;
+}
+
 static const cairo_surface_backend_t cairo_null_surface_backend = {
     CAIRO_INTERNAL_SURFACE_TYPE_NULL,
 
-    NULL, /* create_similar */
+    _cairo_null_surface_create_similar,
     NULL, /* finish */
     NULL, /* acquire_source_image */
     NULL, /* release_source_image */
@@ -937,8 +983,8 @@ static const cairo_surface_backend_t cairo_null_surface_backend = {
     NULL, /* copy_page */
     NULL, /* show_page */
     (_set_clip_region_func) _return_success, /* set_clip_region */
-    NULL, /* intersect_clip_path */
-    NULL, /* get_extents */
+    (_intersect_clip_path_func) _return_success, /* intersect_clip_path */
+    _cairo_null_surface_get_extents,
     NULL, /* old_show_glyphs */
     NULL, /* get_font_options */
     NULL, /* flush */
@@ -956,8 +1002,8 @@ static const cairo_surface_backend_t cairo_null_surface_backend = {
     NULL, /* fill_stroke */
     NULL, /* create_solid_pattern_surface */
     NULL, /* can_repaint_solid_pattern_surface */
-    NULL, /* has_show_text_glyphs */
-    NULL  /* show_text_glyphs */
+    _cairo_null_surface_has_show_text_glyphs,
+    (_show_text_glyphs_func) _return_success,    /* show_text_glyphs */
 };
 
 cairo_surface_t *
diff --git a/src/test-null-surface.c b/src/test-null-surface.c
new file mode 100644
index 0000000..3e470c5
--- /dev/null
+++ b/src/test-null-surface.c
@@ -0,0 +1,48 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2009 Chris Wilson
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * Contributor(s):
+ *	Chris Wilson <chris at chris-wilson.co.uk>
+ */
+
+/* This isn't a "real" surface, but just something to be used by the
+ * test suite to test a mythical backend that does nothing, i.e. it
+ * solely useful for measuring the overhead of the cairo public API.
+ */
+
+#include "cairoint.h"
+
+#include "test-null-surface.h"
+#include "cairo-analysis-surface-private.h"
+
+cairo_surface_t *
+_cairo_test_null_surface_create (cairo_content_t content)
+{
+    return _cairo_null_surface_create (content);
+}
diff --git a/test/cairo-test.c b/test/cairo-test.c
index 758a352..87a5940 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -1217,6 +1217,9 @@ _cairo_test_context_run_for_target (cairo_test_context_t *ctx,
 {
     cairo_test_status_t status;
 
+    if (target->get_image_surface == NULL)
+	return CAIRO_TEST_UNTESTED;
+
     if (similar && ! cairo_test_target_has_similar (ctx, target))
 	return CAIRO_TEST_UNTESTED;
 
@@ -1413,8 +1416,10 @@ _cairo_test_context_run (cairo_test_context_t *ctx)
 	    for (similar = 0; similar <= has_similar ; similar++) {
 		cairo_status_t status;
 
-		status = _cairo_test_context_run_for_target (ctx, target,
-						    similar, dev_offset);
+		status = _cairo_test_context_run_for_target (ctx,
+							     target,
+							     similar,
+							     dev_offset);
 		if (ret == CAIRO_TEST_UNTESTED)
 		    ret = status;
 	    }
@@ -1617,7 +1622,8 @@ cairo_test_paint_checkered (cairo_t *cr)
 }
 
 cairo_bool_t
-cairo_test_is_target_enabled (const cairo_test_context_t *ctx, const char *target)
+cairo_test_is_target_enabled (const cairo_test_context_t *ctx,
+			      const char *target)
 {
     size_t i;
 
@@ -1628,7 +1634,7 @@ cairo_test_is_target_enabled (const cairo_test_context_t *ctx, const char *targe
 	     * e.g. the xlib backend could check whether it is able to connect
 	     * to the Display.
 	     */
-	    return TRUE;
+	    return t->get_image_surface != NULL;
 	}
     }
 
diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index 418908e..6964f50 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -4263,4 +4263,30 @@ _cairo_test_meta_surface_create (cairo_content_t	content,
 
     return ret;
 }
+
+#include <test-null-surface.h>
+cairo_surface_t *
+_cairo_test_null_surface_create (cairo_content_t	content)
+{
+    cairo_surface_t *ret;
+    long surface_id;
+
+    ret = DLCALL (_cairo_test_null_surface_create, content);
+    surface_id = _create_surface_id (ret);
+
+    _emit_line_info ();
+    if (_write_lock ()) {
+	_trace_printf ("dict\n"
+		       "  /type /test-null set\n"
+		       "  /content //%s set\n"
+		       "  surface dup /s%ld exch def\n",
+		       _content_to_string (content),
+		       surface_id);
+	_get_object (SURFACE, ret)->defined = true;
+	_push_operand (SURFACE, ret);
+	_write_unlock ();
+    }
+
+    return ret;
+}
 #endif
commit f2057061c67236a79c8bb69b84e44e151109629a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Jun 14 09:10:08 2009 +0100

    [trace] Add sticky bit to (system-wide) trace output dir
    
    Need to allow user programs to dump their traces into the common output
    directory, when using /etc/ld.so.preload to capture traces for the entire
    desktop.

diff --git a/util/cairo-trace/Makefile.am b/util/cairo-trace/Makefile.am
index 50bd255..6da0267 100644
--- a/util/cairo-trace/Makefile.am
+++ b/util/cairo-trace/Makefile.am
@@ -19,7 +19,8 @@ cairo_trace_la_LIBADD = -ldl -lz $(BFD_LIBS)
 
 
 system-install: install
-	mkdir -p $(cairooutdir)
+	-mkdir -p $(cairooutdir)
+	-chmod 01777 $(cairooutdir)
 	grep -sq $(cairolibdir)/cairo-trace.so /etc/ld.so.preload || echo $(cairolibdir)/cairo-trace.so >> /etc/ld.so.preload
 
 system-uninstall: uninstall
commit 3fe50a77ea21bcddb701a8640b5ecad9f6f5ab01
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Jun 13 22:27:17 2009 +0100

    [configure] Rephrase warning message for disabling core features.
    
    "strictly recommended" is an odd phrase and though the stern warning is
    appropriate as replacing a system library with a more limited version is
    likely to cause mayhem, we are but mere servants and should be reserved in
    our parlance.

diff --git a/build/configure.ac.features b/build/configure.ac.features
index eef98c2..1901a18 100644
--- a/build/configure.ac.features
+++ b/build/configure.ac.features
@@ -319,7 +319,7 @@ CAIRO_FEATURE_HOOK_REGISTER(yes,no,!,
 dnl Collect warning message for disabled recommended features
 CAIRO_FEATURE_HOOK_REGISTER(no,yes,*,
 [dnl
-	CAIRO_ACCUMULATE([WARNING_MESSAGE], CAIRO_TEXT_WRAP([It is strictly recommended that you do NOT disable the ]cr_feature_name[ feature.], [+++ ]))
+	CAIRO_ACCUMULATE([WARNING_MESSAGE], CAIRO_TEXT_WRAP([It is strongly recommended that you do NOT disable the ]cr_feature_name[ feature.], [+++ ]))
 ])dnl
 
 
@@ -340,11 +340,11 @@ AC_CONFIG_COMMANDS_PRE(dnl
 [dnl
 	AS_IF([test -z "$CAIRO_NATIVE_SURFACE_BACKENDS"],dnl
 	[dnl
-		CAIRO_ACCUMULATE([WARNING_MESSAGE], CAIRO_TEXT_WRAP([It is strictly recommended that you enable the native surface backend feature for your platform.], [*** ]))
+		CAIRO_ACCUMULATE([WARNING_MESSAGE], CAIRO_TEXT_WRAP([No native surface backends enabled for your platform. It is strongly recommended that you enable the native surface backend feature for your platform.], [*** ]))
 	])
 	AS_IF([test -z "$CAIRO_NATIVE_FONT_BACKENDS"],dnl
 	[dnl
-		CAIRO_ACCUMULATE([WARNING_MESSAGE], CAIRO_TEXT_WRAP([It is strictly recommended that you enable the native font backend feature for your platform.], [*** ]))
+		CAIRO_ACCUMULATE([WARNING_MESSAGE], CAIRO_TEXT_WRAP([No native font backends enabled for your platform. It is strongly recommended that you enable the native font backend feature for your platform.], [*** ]))
 	])
 ])dnl
 


More information about the cairo-commit mailing list