[cairo-commit] 3 commits - src/cairoint.h src/cairo-spans.c test/any2ppm.c

M. Joonas Pihlaja joonas at kemper.freedesktop.org
Mon Dec 22 17:32:43 PST 2008


 src/cairo-spans.c |   53 +++++++++++++++++++++++++++++++----------------------
 src/cairoint.h    |    2 +-
 test/any2ppm.c    |    2 ++
 3 files changed, 34 insertions(+), 23 deletions(-)

New commits:
commit 1f894033f077731485e1228f7e071e75c37a9947
Author: M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
Date:   Tue Dec 23 03:14:38 2008 +0200

    [spans] Close open subpaths when filling with a scan converter.
    
    As reported by Christian Persch, open subpaths weren't being
    closed when rendering to an image surface:
    
    http://bugs.freedesktop.org/show_bug.cgi?id=19240

diff --git a/src/cairo-spans.c b/src/cairo-spans.c
index 807eea9..a30da61 100644
--- a/src/cairo-spans.c
+++ b/src/cairo-spans.c
@@ -30,6 +30,7 @@ typedef struct {
     cairo_scan_converter_t *converter;
     cairo_point_t current_point;
     cairo_point_t first_point;
+    cairo_bool_t has_first_point;
 } scan_converter_filler_t;
 
 static void
@@ -40,6 +41,30 @@ scan_converter_filler_init (scan_converter_filler_t		*filler,
     filler->current_point.x = 0;
     filler->current_point.y = 0;
     filler->first_point = filler->current_point;
+    filler->has_first_point = FALSE;
+}
+
+static cairo_status_t
+scan_converter_filler_close_path (void *closure)
+{
+    scan_converter_filler_t *filler = closure;
+    cairo_status_t status;
+
+    filler->has_first_point = FALSE;
+
+    if (filler->first_point.x == filler->current_point.x &&
+	filler->first_point.y == filler->current_point.y)
+    {
+	return CAIRO_STATUS_SUCCESS;
+    }
+
+    status = filler->converter->add_edge (
+	filler->converter,
+	filler->current_point.x, filler->current_point.y,
+	filler->first_point.x, filler->first_point.y);
+
+    filler->current_point = filler->first_point;
+    return status;
 }
 
 static cairo_status_t
@@ -47,9 +72,15 @@ scan_converter_filler_move_to (void *closure,
 			       const cairo_point_t *p)
 {
     scan_converter_filler_t *filler = closure;
+    if (filler->has_first_point) {
+	cairo_status_t status = scan_converter_filler_close_path (closure);
+	if (status)
+	    return status;
+    }
     filler->current_point.x = p->x;
     filler->current_point.y = p->y;
     filler->first_point = filler->current_point;
+    filler->has_first_point = TRUE;
     return CAIRO_STATUS_SUCCESS;
 }
 
@@ -75,28 +106,6 @@ scan_converter_filler_line_to (void *closure,
 }
 
 static cairo_status_t
-scan_converter_filler_close_path (void *closure)
-{
-    scan_converter_filler_t *filler = closure;
-    cairo_status_t status;
-
-    if (filler->first_point.x == filler->current_point.x &&
-	filler->first_point.y == filler->current_point.y)
-    {
-	return CAIRO_STATUS_SUCCESS;
-    }
-
-    status = filler->converter->add_edge (
-	filler->converter,
-	filler->current_point.x, filler->current_point.y,
-	filler->first_point.x, filler->first_point.y);
-
-    filler->current_point = filler->first_point;
-
-    return status;
-}
-
-static cairo_status_t
 _cairo_path_fixed_fill_to_scan_converter (
     cairo_path_fixed_t			*path,
     double				 tolerance,
commit 0aa34c6435eaa260292cf10d270ebbf3314c7924
Author: M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
Date:   Tue Dec 23 02:18:14 2008 +0200

    [svg] Fix build when building only the svg vector surface.
    
    The SVG vector surface pulls in font subsetting and that in turns
    uses the PDF operators in cairo-type3-glyph-surface.c.

diff --git a/src/cairoint.h b/src/cairoint.h
index 8d5250d..6914b11 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -79,7 +79,7 @@
 #define CAIRO_HAS_FONT_SUBSET 1
 #endif
 
-#if CAIRO_HAS_PS_SURFACE || CAIRO_HAS_PDF_SURFACE
+#if CAIRO_HAS_PS_SURFACE || CAIRO_HAS_PDF_SURFACE || CAIRO_HAS_FONT_SUBSET
 #define CAIRO_HAS_PDF_OPERATORS 1
 #endif
 
commit 38ec6e302cdd703447f169d95121d434c7495501
Author: M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
Date:   Tue Dec 23 02:05:32 2008 +0200

    [test] Fix any2ppm build when building without the full complement of surfaces.
    
    It was complaining about g_init_type () being used without the proper includes
    which would have been pulled in by the svg or poppler includes.

diff --git a/test/any2ppm.c b/test/any2ppm.c
index ae5de32..7b3dabb 100644
--- a/test/any2ppm.c
+++ b/test/any2ppm.c
@@ -766,7 +766,9 @@ main (int argc, char **argv)
 {
     const char *err;
 
+#if CAIRO_CAN_TEST_PDF_SURFACE || CAIRO_CAN_TEST_SVG_SURFACE
     g_type_init ();
+#endif
 
 #if CAIRO_CAN_TEST_SVG_SURFACE
     rsvg_init ();


More information about the cairo-commit mailing list