[cairo-commit] 2 commits - src/cairo-surface.c test/fallback-resolution.c test/reference

Chris Wilson ickle at kemper.freedesktop.org
Thu Mar 8 07:33:00 PST 2012


 src/cairo-surface.c                                   |    4 ++-
 test/fallback-resolution.c                            |   20 +++++++++++++++++-
 test/reference/fallback-resolution.ppi144x144.ref.png |binary
 test/reference/fallback-resolution.ppi144x72.ref.png  |binary
 test/reference/fallback-resolution.ppi288x72.ref.png  |binary
 test/reference/fallback-resolution.ppi576x72.ref.png  |binary
 test/reference/fallback-resolution.ppi72x144.ref.png  |binary
 test/reference/fallback-resolution.ppi72x288.ref.png  |binary
 test/reference/fallback-resolution.ppi72x576.ref.png  |binary
 test/reference/fallback-resolution.ppi72x72.ref.png   |binary
 10 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit c0eaaa1680ff95abb1b897cd98266a4ed5ce6287
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Mar 8 15:27:03 2012 +0000

    test: Refresh the fallback-resolution reference images
    
    Despite copying across the font options from the PDF backend, it still
    looks like the image surface is override the glyph placement... Odd.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/test/fallback-resolution.c b/test/fallback-resolution.c
index b14cc1e..bf83e31 100644
--- a/test/fallback-resolution.c
+++ b/test/fallback-resolution.c
@@ -32,6 +32,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <cairo.h>
+#include <cairo-pdf.h>
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
@@ -270,6 +271,23 @@ generate_reference (double ppi_x, double ppi_y, const char *filename)
     cr = cairo_create (surface);
     cairo_surface_destroy (surface);
 
+    /* As we wish to mimic a PDF surface, copy across the default font options
+     * from the PDF backend.
+     */
+    {
+	cairo_surface_t *pdf;
+	cairo_font_options_t *options;
+
+	options = cairo_font_options_create ();
+
+	pdf = cairo_pdf_surface_create ("tmp.pdf", 1, 1);
+	cairo_surface_get_font_options (pdf, options);
+	cairo_surface_destroy (pdf);
+
+	cairo_set_font_options (cr, options);
+	cairo_font_options_destroy (options);
+    }
+
 #if SET_TOLERANCE
     cairo_set_tolerance (cr, 3.0);
 #endif
@@ -351,7 +369,7 @@ preamble (cairo_test_context_t *ctx)
 #if GENERATE_REFERENCE
     for (n = 0; n < num_ppi; n++) {
 	char *ref_name;
-	xasprintf (&ref_name, "fallback-resolution.ppi%gx%g.ref.png",
+	xasprintf (&ref_name, "reference/fallback-resolution.ppi%gx%g.ref.png",
 		   ppi[n].x, ppi[n].y);
 	generate_reference (ppi[n].x, ppi[n].y, ref_name);
 	free (ref_name);
diff --git a/test/reference/fallback-resolution.ppi144x144.ref.png b/test/reference/fallback-resolution.ppi144x144.ref.png
index cbe93ca..fd0666a 100644
Binary files a/test/reference/fallback-resolution.ppi144x144.ref.png and b/test/reference/fallback-resolution.ppi144x144.ref.png differ
diff --git a/test/reference/fallback-resolution.ppi144x72.ref.png b/test/reference/fallback-resolution.ppi144x72.ref.png
index 4c16ca1..ec6685c 100644
Binary files a/test/reference/fallback-resolution.ppi144x72.ref.png and b/test/reference/fallback-resolution.ppi144x72.ref.png differ
diff --git a/test/reference/fallback-resolution.ppi288x72.ref.png b/test/reference/fallback-resolution.ppi288x72.ref.png
index b213587..969c04f 100644
Binary files a/test/reference/fallback-resolution.ppi288x72.ref.png and b/test/reference/fallback-resolution.ppi288x72.ref.png differ
diff --git a/test/reference/fallback-resolution.ppi576x72.ref.png b/test/reference/fallback-resolution.ppi576x72.ref.png
index b63e66e..bbab065 100644
Binary files a/test/reference/fallback-resolution.ppi576x72.ref.png and b/test/reference/fallback-resolution.ppi576x72.ref.png differ
diff --git a/test/reference/fallback-resolution.ppi72x144.ref.png b/test/reference/fallback-resolution.ppi72x144.ref.png
index 9d232c0..3f55629 100644
Binary files a/test/reference/fallback-resolution.ppi72x144.ref.png and b/test/reference/fallback-resolution.ppi72x144.ref.png differ
diff --git a/test/reference/fallback-resolution.ppi72x288.ref.png b/test/reference/fallback-resolution.ppi72x288.ref.png
index fdbc382..9d50b64 100644
Binary files a/test/reference/fallback-resolution.ppi72x288.ref.png and b/test/reference/fallback-resolution.ppi72x288.ref.png differ
diff --git a/test/reference/fallback-resolution.ppi72x576.ref.png b/test/reference/fallback-resolution.ppi72x576.ref.png
index c943f08..7b4d62e 100644
Binary files a/test/reference/fallback-resolution.ppi72x576.ref.png and b/test/reference/fallback-resolution.ppi72x576.ref.png differ
diff --git a/test/reference/fallback-resolution.ppi72x72.ref.png b/test/reference/fallback-resolution.ppi72x72.ref.png
index 5d1df2c..690c0af 100644
Binary files a/test/reference/fallback-resolution.ppi72x72.ref.png and b/test/reference/fallback-resolution.ppi72x72.ref.png differ
commit 1952fec8294b6473cb1c0719d1ef0fb0b864b6b6
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Mar 8 15:11:40 2012 +0000

    surface: Relax assertion about not rendering to a snapshot
    
    Recently I began using the surface->snapshot_of member of a subsurface
    to cache a target representation of the current subsurface. More
    recently, I discovered this caused an assertion failure in epiphany, and
    probably other GTK3 based programs.
    
    Throwaway the assertion and trust that the programmer doesn't make any
    mistakes...
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index d8f5b91..237a17c 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -387,9 +387,11 @@ _cairo_surface_begin_modification (cairo_surface_t *surface)
 {
     assert (surface->status == CAIRO_STATUS_SUCCESS);
     assert (! surface->finished);
-    assert (surface->snapshot_of == NULL);
 
     _cairo_surface_detach_snapshots (surface);
+    if (surface->snapshot_of != NULL)
+	_cairo_surface_detach_snapshot (surface);
+
     _cairo_surface_detach_mime_data (surface);
 }
 


More information about the cairo-commit mailing list