[cairo-commit] 3 commits - src/cairo-ps-surface.c test/cairo-test.c test/Makefile.am

Carl Worth cworth at kemper.freedesktop.org
Wed Apr 5 17:12:11 PDT 2006


 src/cairo-ps-surface.c |    3 +++
 test/Makefile.am       |   22 ++++++++++++++++++++--
 test/cairo-test.c      |   15 +++++++++------
 3 files changed, 32 insertions(+), 8 deletions(-)

New commits:
diff-tree 3b873c66be54522d6cc3f025572a78bbef0efba7 (from 6d5627ca2a5b96edf0b37fe6e16002726f72d86d)
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Apr 5 17:03:23 2006 -0700

    Use ghostscript's pngalpha rather than png16m target for PS->PNG
    
    This target allows the output files to actually be transparent where
    there is no PostScript "ink", which allows for much better testing.

diff --git a/test/cairo-test.c b/test/cairo-test.c
index 0d8a961..f946b3e 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -1185,7 +1185,7 @@ ps_surface_write_to_png (cairo_surface_t
     }
 
     cairo_surface_finish (surface);
-    sprintf (command, "gs -q -r72 -g%dx%d -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -sOutputFile=%s %s",
+    sprintf (command, "gs -q -r72 -g%dx%d -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pngalpha -sOutputFile=%s %s",
 	     ptc->width, ptc->height, filename, ptc->filename);
     if (system (command) == 0)
 	return CAIRO_STATUS_SUCCESS;
@@ -1414,11 +1414,14 @@ cairo_test_for_target (cairo_test_t *tes
 
     /* Clear to transparent (or black) depending on whether the target
      * surface supports alpha. */
-    cairo_save (cr);
-    cairo_set_source_rgba (cr, 0, 0, 0, 0);
-    cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
-    cairo_paint (cr);
-    cairo_restore (cr);
+    /* XXX: We're cheating by not clearing the PostScript surface. */
+    if (strcmp (target->name, "ps")) {
+	cairo_save (cr);
+	cairo_set_source_rgba (cr, 0, 0, 0, 0);
+	cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+	cairo_paint (cr);
+	cairo_restore (cr);
+    }
 
     status = (draw) (cr, test->width, test->height);
 
diff-tree 6d5627ca2a5b96edf0b37fe6e16002726f72d86d (from 341d61cda0247eebd26da1e3b71c43ee8f761833)
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Apr 5 17:00:13 2006 -0700

    Add a call to _cairo_ps_surface_start_page in _cairo_ps_surface_intersect_clip_path.
    
    If clipping occurs before any drawing, then we still need to issue a start page call.
    Otherwise, the clip ends up being inverted since the scaling
    transformation that puts PostScript into a cairo-oriented coordinate
    system only happens in start_page.

diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index c8f5925..a05fe40 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -1095,6 +1095,9 @@ _cairo_ps_surface_intersect_clip_path (v
     if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
 	return CAIRO_STATUS_SUCCESS;
 
+    if (surface->need_start_page)
+	_cairo_ps_surface_start_page (surface);
+
     _cairo_output_stream_printf (stream,
 				 "%% _cairo_ps_surface_intersect_clip_path\n");
 
diff-tree 341d61cda0247eebd26da1e3b71c43ee8f761833 (from 5baae7ff21a4236ebc9eaff087eb29fd1432c7ff)
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Apr 5 16:55:51 2006 -0700

    Disable show-glyphs-many test to avoid abusing ghostscript too badly.

diff --git a/test/Makefile.am b/test/Makefile.am
index f1fe6f5..d3e722a 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,4 +1,4 @@
-# All test cases go here
+# Here are all the tests that are run unconditionally
 TESTS = 			\
 a8-mask				\
 caps-joins			\
@@ -44,7 +44,6 @@ select-font-no-show-text	\
 self-copy			\
 self-intersecting		\
 set-source			\
-show-glyphs-many		\
 show-text-current-point		\
 source-clip			\
 source-surface-scale-paint	\
@@ -64,6 +63,8 @@ unbounded-operator		\
 user-data			\
 rel-path
 
+# Then we have a collection of tests that are only run if certain
+# features are compiled into cairo
 if HAVE_PTHREAD
 TESTS += pthread-show-text
 endif
@@ -84,6 +85,23 @@ if CAIRO_HAS_MULTI_PAGE_SURFACES
 TESTS += multi-page
 endif
 
+# XXX: Here are some existing tests that are currently disabled for
+# one reason or another.
+# 
+# show-glyphs-many - this stress test was exercising a particular bug
+#      in the xlib surface code (exceeding the X11 protocol request
+#      limit) when rendering several thousand glyphs at once. The
+#      original xlib-surface bug is fixed now, but the test continues
+#      to stress some other aspects of the test suite. For example,
+#      when doing text as paths, the resuilting PostScript file is one
+#      giant path that ghostscript has a particularly hard time
+#      with. I'm disabling this test for now, since I don't care about
+#      that performance problem in ghostscript. (But, there is a
+#      similar performance problem when using cairo to rasterize the
+#      equivalen giant path---from an SBG files say---so this might be
+#      a useful kind of test to bring back again for performance (not
+#      correctness) testing.
+
 # All tests which have a reference image go here.
 # I really don't like having to repeat this list. Anyone know a good
 # way to avoid it? Can I use a wildcard here?


More information about the cairo-commit mailing list