[cairo-commit] 7 commits - configure.in NEWS src/cairo-hull.c src/cairo-png.c test/cairo-test.c test/large-source-ref.c test/large-source-ref.png

Carl Worth cworth at kemper.freedesktop.org
Tue Apr 8 03:12:09 PDT 2008


 NEWS                      |   47 ++++++++++++++++++
 configure.in              |    4 -
 dev/null                  |binary
 src/cairo-hull.c          |    7 ++
 src/cairo-png.c           |    6 ++
 test/cairo-test.c         |  119 ++++++----------------------------------------
 test/large-source-ref.png |binary
 7 files changed, 77 insertions(+), 106 deletions(-)

New commits:
commit c7cd5b30c4ef3ecf5c1f21257fcfac51308b701d
Author: Carl Worth <cworth at cworth.org>
Date:   Tue Apr 8 03:11:50 2008 -0700

    Increment cairo version to 1.5.21 after the 1.5.20 snapshot

diff --git a/configure.in b/configure.in
index d691f5f..44efb45 100644
--- a/configure.in
+++ b/configure.in
@@ -7,7 +7,7 @@ dnl For the micro number: odd => in-progress development (from git)
 dnl			  even => tar-file snapshot or release
 m4_define(cairo_version_major, 1)
 m4_define(cairo_version_minor, 5)
-m4_define(cairo_version_micro, 20)
+m4_define(cairo_version_micro, 21)
 
 AC_INIT([cairo],
       cairo_version_major.cairo_version_minor.cairo_version_micro,
commit aadbaf7d990d0d5cd7c25cc856dbcfcc357b44f1
Author: Carl Worth <cworth at cworth.org>
Date:   Tue Apr 8 02:45:56 2008 -0700

    Increment version to 1.5.20

diff --git a/configure.in b/configure.in
index d340060..d691f5f 100644
--- a/configure.in
+++ b/configure.in
@@ -7,7 +7,7 @@ dnl For the micro number: odd => in-progress development (from git)
 dnl			  even => tar-file snapshot or release
 m4_define(cairo_version_major, 1)
 m4_define(cairo_version_minor, 5)
-m4_define(cairo_version_micro, 19)
+m4_define(cairo_version_micro, 20)
 
 AC_INIT([cairo],
       cairo_version_major.cairo_version_minor.cairo_version_micro,
@@ -30,7 +30,7 @@ LT_CURRENT=19
 
 # Increment any time the source changes; set to
 # 0 if you increment CURRENT
-LT_REVISION=1
+LT_REVISION=2
 
 # Increment if any interfaces have been added; set to 0
 # if any interfaces have been removed. removal has
commit 8f123d035af0c02dc0a668a073410756edafbdd6
Author: Carl Worth <cworth at cworth.org>
Date:   Tue Apr 8 02:45:31 2008 -0700

    NEWS: Add notes for 1.5.20 snapshot

diff --git a/NEWS b/NEWS
index 186c4a6..1c7c7cd 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,50 @@
+Snapshot 1.5.20 (2008-04-04 Carl Worth <cworth at cworth.org>)
+===========================================================
+This is the tenth snapshot in cairo's unstable 1.5 series. It comes
+just two days (and only one working day) after the 1.5.18
+snapshot. The quick snapshot is due to two embarrassing bugs (both
+affecting cairo-xlib) that had been introduced in the 1.5.18
+snapshot. The fixes for these are described below along with a few
+other fixes, (which hopefully aren't introducing new bugs this time).
+
+cairo-xlib
+----------
+Revert fix from 1.5.18 to allow pattern expansion based on the filter
+mode. This fix seemed so boring, (the use case it addresses is almost
+never used in practice), that it didn't even get mentioned in the
+1.5.18 release notes. However, the "fix" happened to break rendering
+that is always used resulting in corrupt image rendering in mozilla,
+evolution, and probably everything else that uses cairo.
+
+Fix to avoid BadMatch errors in cairo_surface_create_similar. These
+were introduced, (inadvertently, of course), as part of the fix in
+1.5.18 for creating similar surfaces without the Render
+extension. Again, thanks to mozilla, (and Vladimir Vukicevic in
+particular), for noticing our mistake.
+
+general
+-------
+Correctly handle an in-error surface in
+cairo_surface_write_to_png. Previously this function would cause an
+assertion failure if you gave it a finished surface. Now it cleanly
+returns a CAIRO_STATUS_SURFACE_FINISHED result instead.
+
+Avoid potentially infinite wandering through memory inside
+_cairo_hull_prev_valid. Thanks to Jonathan Watt for noticing this
+problem:
+
+	https://bugzilla.mozilla.org/show_bug.cgi?id=306649#c21
+
+cairo-pdf
+---------
+Fix generation of "soft" masks made by drawing to a similar surface
+and then calling cairo_mask_surface() with it.
+
+cairo-svg
+---------
+Fix for code that uses cairo_mask() on an intermediate surface which
+is later passed to cairo_mask_surface().
+
 Snapshot 1.5.18 (2008-04-05 Carl Worth <cworth at cworth.org>)
 ===========================================================
 This is the ninth snapshot in cairo's unstable 1.5 series. It comes
commit f7dea9a8d3da7f57286db4b1b6300726483a0d76
Author: Carl Worth <cworth at cworth.org>
Date:   Tue Apr 8 02:28:52 2008 -0700

    Fix distcheck by renaming large-source-ref.c to large-source-ref.png (oops!)

diff --git a/test/large-source-ref.c b/test/large-source-ref.c
deleted file mode 100644
index 5d96dd3..0000000
Binary files a/test/large-source-ref.c and /dev/null differ
diff --git a/test/large-source-ref.png b/test/large-source-ref.png
new file mode 100644
index 0000000..5d96dd3
Binary files /dev/null and b/test/large-source-ref.png differ
commit c26a7de9707e26d0552b0fedcd4bf2e0ba6542b2
Author: Carl Worth <cworth at cworth.org>
Date:   Tue Apr 8 01:54:27 2008 -0700

    Prevent potentially infinite wandering through memeory in _cairo_hull_prev_valid
    
    It is possible for _cairo_hull_prev_valid to be called just once
    right before the calling loop is going to terminate. In this
    case we really don't want to walk off the beginning of the
    array and start wandering.
    
    Thanks to Jonathan Watt for noticing this problem:
    
    	https://bugzilla.mozilla.org/show_bug.cgi?id=306649#c21

diff --git a/src/cairo-hull.c b/src/cairo-hull.c
index 73d95c5..ccdb34d 100644
--- a/src/cairo-hull.c
+++ b/src/cairo-hull.c
@@ -125,8 +125,13 @@ _cairo_hull_vertex_compare (const void *av, const void *bv)
 static int
 _cairo_hull_prev_valid (cairo_hull_t *hull, int num_hull, int index)
 {
+    /* hull[0] is always valid, and we never need to wraparound, (if
+     * we are passed an index of 0 here, then the calling loop is just
+     * about to terminate). */
+    if (index == 0)
+	return 0;
+
     do {
-	/* hull[0] is always valid, so don't test and wraparound */
 	index--;
     } while (hull[index].discard);
 
commit c19133eb9ab31bbdc7e82573033e513e9eb867f2
Author: Carl Worth <cworth at cworth.org>
Date:   Tue Apr 8 01:34:37 2008 -0700

    Revert "[test] Repeat tests using cairo_push_group()."
    
    This reverts commit 07122e64fa9529e7ba9323988a5af1d1e7c2c55f.
    
    The extra testing did find a pdf bug, and that should be fixed,
    but the extra maintenance burden of running another iteration
    of all tests does not seem justfied at all---particularly since
    it looks like dozens of new reference images would be needed
    for the svg backend.
    
    Also, the new "failures" of the image backend with this new
    testing look like a misunderstanding of exactly what the new
    testing is actually drawing.

diff --git a/test/cairo-test.c b/test/cairo-test.c
index c4a8aba..61cbb31 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -226,40 +226,8 @@ cairo_test_target_has_similar (const cairo_test_t *test, cairo_boilerplate_targe
     cairo_surface_t *surface;
     cairo_bool_t has_similar = FALSE;
 
-    if (getenv ("CAIRO_TEST_IGNORE_SIMILAR"))
-	return FALSE;
-
-    surface = (target->create_surface) (test->name,
-					target->content,
-					test->width,
-					test->height,
-					CAIRO_BOILERPLATE_MODE_TEST,
-					&target->closure);
-    if (surface != NULL) {
-	cairo_t * cr = cairo_create (surface);
-	cairo_surface_t *similar;
-
-	cairo_push_group_with_content (cr, target->content);
-	similar = cairo_get_group_target (cr);
-	has_similar = cairo_surface_get_type (similar) == cairo_surface_get_type (surface);
-
-	cairo_destroy (cr);
-	cairo_surface_destroy (surface);
-
-	if (target->cleanup)
-	    target->cleanup (target->closure);
-    }
-
-    return has_similar;
-}
-
-static cairo_bool_t
-cairo_test_target_has_similar_alpha (const cairo_test_t *test, cairo_boilerplate_target_t *target)
-{
-    cairo_surface_t *surface;
-    cairo_bool_t has_similar = FALSE;
-
-    if (target->content == CAIRO_CONTENT_COLOR_ALPHA) /* already handled */
+    /* ignore image intermediate targets */
+    if (target->expected_type == CAIRO_SURFACE_TYPE_IMAGE)
 	return FALSE;
 
     if (getenv ("CAIRO_TEST_IGNORE_SIMILAR"))
@@ -274,8 +242,7 @@ cairo_test_target_has_similar_alpha (const cairo_test_t *test, cairo_boilerplate
     if (surface != NULL) {
 	cairo_t * cr = cairo_create (surface);
 	cairo_surface_t *similar;
-
-	cairo_push_group (cr);
+	cairo_push_group_with_content (cr, target->content);
 	similar = cairo_get_group_target (cr);
 	has_similar = cairo_surface_get_type (similar) == cairo_surface_get_type (surface);
 
@@ -293,7 +260,7 @@ static cairo_test_status_t
 cairo_test_for_target (cairo_test_t			 *test,
 		       cairo_boilerplate_target_t	 *target,
 		       int				  dev_offset,
-		       int				  similar)
+		       cairo_bool_t                       similar)
 {
     cairo_test_status_t status;
     cairo_surface_t *surface = NULL;
@@ -303,7 +270,6 @@ cairo_test_for_target (cairo_test_t			 *test,
     cairo_content_t expected_content;
     cairo_font_options_t *font_options;
     const char *format;
-    const char *similar_str;
 
     /* Get the strings ready that we'll need. */
     format = cairo_boilerplate_content_name (target->content);
@@ -312,25 +278,18 @@ cairo_test_for_target (cairo_test_t			 *test,
     else
 	offset_str = strdup("");
 
-    switch (similar) {
-    default:
-    case 0: similar_str = ""; break;
-    case 1: similar_str = "-similar"; break;
-    case 2: similar_str = "-similar+"; break;
-    }
-
     xasprintf (&png_name, "%s-%s-%s%s%s%s",
 	       test->name,
 	       target->name,
 	       format,
-	       similar_str,
+	       similar ? "-similar" : "",
 	       offset_str, CAIRO_TEST_PNG_SUFFIX);
     ref_name = cairo_ref_name_for_test_target_format (test->name, target->name, format);
     xasprintf (&diff_name, "%s-%s-%s%s%s%s",
 	       test->name,
 	       target->name,
 	       format,
-	       similar_str,
+	       similar ? "-similar" : "",
 	       offset_str, CAIRO_TEST_DIFF_SUFFIX);
 
     if (target->is_vector) {
@@ -397,19 +356,8 @@ cairo_test_for_target (cairo_test_t			 *test,
     cairo_surface_set_device_offset (surface, dev_offset, dev_offset);
 
     cr = cairo_create (surface);
-    switch (similar) {
-    default:
-    case 0:
-	break;
-
-    case 1:
+    if (similar)
 	cairo_push_group_with_content (cr, target->content);
-	break;
-
-    case 2:
-	cairo_push_group (cr);
-	break;
-    }
 
     /* Clear to transparent (or black) depending on whether the target
      * surface supports alpha. */
@@ -528,7 +476,7 @@ cairo_test_expecting (cairo_test_t *test,
 {
     /* we use volatile here to make sure values are not clobbered
      * by longjmp */
-    volatile size_t i, j, num_targets, similar;
+    volatile size_t i, j, num_targets, similar, has_similar;
     volatile cairo_bool_t limited_targets = FALSE, print_fail_on_stdout = TRUE;
 #ifdef HAVE_SIGNAL_H
     void (*old_segfault_handler)(int);
@@ -583,47 +531,16 @@ cairo_test_expecting (cairo_test_t *test,
      */
     status = ret = CAIRO_TEST_UNTESTED;
     for (i = 0; i < num_targets; i++) {
-	cairo_boilerplate_target_t * volatile target = targets_to_test[i];
-	volatile cairo_bool_t has_similar = cairo_test_target_has_similar (test, target);
-	volatile cairo_bool_t has_similar_alpha = cairo_test_target_has_similar_alpha (test, target);
-
 	for (j = 0; j < NUM_DEVICE_OFFSETS; j++) {
+	    cairo_boilerplate_target_t * volatile target = targets_to_test[i];
 	    volatile int dev_offset = j * 25;
-
-	    for (similar = 0; similar <= 2; similar++) {
-		const char * volatile similar_str;
-		cairo_bool_t skip;
-
-		switch (similar) {
-		default:
-		case 0:
-		    similar_str = "";
-		    skip = FALSE;
-		    break;
-
-		case 1:
-		    similar_str = "-similar";
-		    skip = ! has_similar;
-		    break;
-
-		case 2:
-		    similar_str = "-similar+";
-		    skip = ! has_similar_alpha;
-		    break;
-		}
-		if (skip)
-		    continue;
-
-		cairo_test_log ("Testing %s with %s%s target (dev offset %d)\n",
-			        test->name,
-				similar_str,
-				target->name,
-				dev_offset);
-		printf ("%s-%s-%s [%d]%s:\t",
-			test->name, target->name,
+	    has_similar = cairo_test_target_has_similar (test, target);
+	    for (similar = 0; similar <= has_similar ; similar++) {
+		cairo_test_log ("Testing %s with %s%s target (dev offset %d)\n", test->name, similar ? " (similar)" : "", target->name, dev_offset);
+		printf ("%s-%s-%s [%d]%s:\t", test->name, target->name,
 			cairo_boilerplate_content_name (target->content),
 			dev_offset,
-			similar_str);
+			similar ? " (similar)": "");
 
 #ifdef HAVE_SIGNAL_H
 		/* Set up a checkpoint to get back to in case of segfaults. */
@@ -664,9 +581,7 @@ cairo_test_expecting (cairo_test_t *test,
 		    cairo_test_log ("CRASHED\n");
 		    fprintf (stderr, "%s-%s-%s [%d]%s:\t%s!!!CRASHED!!!%s\n",
 			     test->name, target->name,
-			     cairo_boilerplate_content_name (target->content),
-			     dev_offset,
-			     similar_str,
+			     cairo_boilerplate_content_name (target->content), dev_offset, similar ? " (similar)" : "",
 			     fail_face, normal_face);
 		    ret = CAIRO_TEST_FAILURE;
 		    break;
@@ -685,9 +600,7 @@ cairo_test_expecting (cairo_test_t *test,
 			}
 			fprintf (stderr, "%s-%s-%s [%d]%s:\t%sFAIL%s\n",
 				 test->name, target->name,
-				 cairo_boilerplate_content_name (target->content),
-				 dev_offset,
-				 similar_str,
+				 cairo_boilerplate_content_name (target->content), dev_offset, similar ? " (similar)" : "",
 				 fail_face, normal_face);
 			cairo_test_log ("FAIL\n");
 		    }
commit c1f7655f2fd5373a74d3fbf5977ebbd84e401e25
Author: Carl Worth <cworth at cworth.org>
Date:   Tue Apr 8 00:40:58 2008 -0700

    Check surface->status and finished in cairo_surface_write_to_png
    
    Without these checks, a user could hit an assertion failure
    by passing a finished surface to cairo_surface_write_to_png.
    Now we return a nice CAIRO_STATUS_SURFACE_FINISHED error in
    that case instead.

diff --git a/src/cairo-png.c b/src/cairo-png.c
index f87ba2c..ad04570 100644
--- a/src/cairo-png.c
+++ b/src/cairo-png.c
@@ -285,6 +285,12 @@ cairo_surface_write_to_png (cairo_surface_t	*surface,
     FILE *fp;
     cairo_status_t status;
 
+    if (surface->status)
+	return surface->status;
+
+    if (surface->finished)
+	return _cairo_error (CAIRO_STATUS_SURFACE_FINISHED);
+
     fp = fopen (filename, "wb");
     if (fp == NULL) {
 	switch (errno) {


More information about the cairo-commit mailing list