[cairo-commit] Branch '1.12' - 27 commits - build/configure.ac.warnings configure.ac src/cairo-cff-subset.c src/cairo-clip-boxes.c src/cairo-image-compositor.c src/cairo-image-mask-compositor.c src/cairo-image-surface.c src/cairo-path-stroke-traps.c src/cairo-pdf-operators.c src/cairo-pdf-surface.c src/cairo-ps-surface.c src/cairo-scaled-font-subsets-private.h src/cairo-scaled-font-subsets.c src/cairo-svg-surface.c src/cairo-traps-compositor.c src/cairo-truetype-subset.c src/cairo-type1-subset.c src/cairo-xcb-surface-render.c src/check-doc-syntax.awk src/check-doc-syntax.sh

Uli Schlachter psychon at kemper.freedesktop.org
Wed Aug 27 02:07:59 PDT 2014


 build/configure.ac.warnings             |   11 ---
 configure.ac                            |    2 
 src/cairo-cff-subset.c                  |    2 
 src/cairo-clip-boxes.c                  |   11 ++-
 src/cairo-image-compositor.c            |   11 ++-
 src/cairo-image-mask-compositor.c       |    3 
 src/cairo-image-surface.c               |    2 
 src/cairo-path-stroke-traps.c           |    2 
 src/cairo-pdf-operators.c               |    4 -
 src/cairo-pdf-surface.c                 |   23 +++----
 src/cairo-ps-surface.c                  |   98 +++++++++++++++++++++++++-------
 src/cairo-scaled-font-subsets-private.h |   15 ++++
 src/cairo-scaled-font-subsets.c         |   40 +++++++++++++
 src/cairo-svg-surface.c                 |    3 
 src/cairo-traps-compositor.c            |   32 ++++++----
 src/cairo-truetype-subset.c             |   37 +-----------
 src/cairo-type1-subset.c                |   12 +--
 src/cairo-xcb-surface-render.c          |   40 ++++++++-----
 src/check-doc-syntax.awk                |    2 
 src/check-doc-syntax.sh                 |    2 
 20 files changed, 232 insertions(+), 120 deletions(-)

New commits:
commit 4b65497231d1859e03762949896da94ffde389b5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Aug 25 08:55:24 2014 +0100

    traps,xcb: Set the box count after filtering
    
    After converting, the number of boxes should only count the number of
    non-zero boxes and forget about the zero-sized boxes we skipped over.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81699
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-traps-compositor.c b/src/cairo-traps-compositor.c
index 1a04be1..fcf9750 100644
--- a/src/cairo-traps-compositor.c
+++ b/src/cairo-traps-compositor.c
@@ -1405,9 +1405,7 @@ boxes_for_traps (cairo_boxes_t *boxes,
 
     _cairo_boxes_init (boxes);
 
-    boxes->num_boxes    = traps->num_traps;
     boxes->chunks.base  = (cairo_box_t *) traps->traps;
-    boxes->chunks.count = traps->num_traps;
     boxes->chunks.size  = traps->num_traps;
 
     if (antialias != CAIRO_ANTIALIAS_NONE) {
@@ -1452,6 +1450,8 @@ boxes_for_traps (cairo_boxes_t *boxes,
 		  boxes->chunks.base[j].p1.y != boxes->chunks.base[j].p2.y);
 	}
     }
+    boxes->chunks.count = j;
+    boxes->num_boxes    = j;
 
     return CAIRO_INT_STATUS_SUCCESS;
 }
diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c
index 349f54e..b9e8a61 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -2909,9 +2909,7 @@ _boxes_for_traps (cairo_boxes_t *boxes,
 
     _cairo_boxes_init (boxes);
 
-    boxes->num_boxes    = traps->num_traps;
     boxes->chunks.base  = (cairo_box_t *) traps->traps;
-    boxes->chunks.count = traps->num_traps;
     boxes->chunks.size  = traps->num_traps;
 
     if (antialias != CAIRO_ANTIALIAS_NONE) {
@@ -2957,6 +2955,9 @@ _boxes_for_traps (cairo_boxes_t *boxes,
 		  boxes->chunks.base[j].p1.y != boxes->chunks.base[j].p2.y);
 	}
     }
+
+    boxes->num_boxes    = j;
+    boxes->chunks.count = j;
 }
 
 static cairo_status_t
commit 3bb80aa2c3f97c071f434e0fbb6704fbef963352
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Aug 23 14:16:55 2014 +0100

    traps,xcb: Prefilter zero-area boxes when converting traps
    
    The rectangular tesselation routines rely on the presuming that all the
    boxes it has to handle are already filtered to remove empty boxes.
    
    << /width 800 /height 600 >> surface context
    0.0848671 0 0 0.0848671 39.907812 5.608896 matrix transform
    8 0 m 12.417969 0 16 3.582031 16 8 c 16 12.417969 12.417969 16 8 16 c
    3.582031 16 0 12.417969 0 8 c 0 3.582031 3.582031 0 8 0 c h
    clip
    16 0 m 8 8 l 16 16 l h
    clip
    0 0 16 16 rectangle
    fill
    
    Triggers the error given a traps tesselator like cairo-xlib.
    
    Reported-by: Henrique Lengler <henriqueleng at openmailbox.org>
    Analyzed-by: Massimo <sixtysix at inwind.it>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81699
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-traps-compositor.c b/src/cairo-traps-compositor.c
index 988d23c..1a04be1 100644
--- a/src/cairo-traps-compositor.c
+++ b/src/cairo-traps-compositor.c
@@ -1381,7 +1381,7 @@ boxes_for_traps (cairo_boxes_t *boxes,
 		 cairo_traps_t *traps,
 		 cairo_antialias_t antialias)
 {
-    int i;
+    int i, j;
 
     /* first check that the traps are rectilinear */
     if (antialias == CAIRO_ANTIALIAS_NONE) {
@@ -1411,17 +1411,21 @@ boxes_for_traps (cairo_boxes_t *boxes,
     boxes->chunks.size  = traps->num_traps;
 
     if (antialias != CAIRO_ANTIALIAS_NONE) {
-	for (i = 0; i < traps->num_traps; i++) {
+	for (i = j = 0; i < traps->num_traps; i++) {
 	    /* Note the traps and boxes alias so we need to take the local copies first. */
 	    cairo_fixed_t x1 = traps->traps[i].left.p1.x;
 	    cairo_fixed_t x2 = traps->traps[i].right.p1.x;
 	    cairo_fixed_t y1 = traps->traps[i].top;
 	    cairo_fixed_t y2 = traps->traps[i].bottom;
 
-	    boxes->chunks.base[i].p1.x = x1;
-	    boxes->chunks.base[i].p1.y = y1;
-	    boxes->chunks.base[i].p2.x = x2;
-	    boxes->chunks.base[i].p2.y = y2;
+	    if (x1 == x2 || y1 == y2)
+		    continue;
+
+	    boxes->chunks.base[j].p1.x = x1;
+	    boxes->chunks.base[j].p1.y = y1;
+	    boxes->chunks.base[j].p2.x = x2;
+	    boxes->chunks.base[j].p2.y = y2;
+	    j++;
 
 	    if (boxes->is_pixel_aligned) {
 		boxes->is_pixel_aligned =
@@ -1432,7 +1436,7 @@ boxes_for_traps (cairo_boxes_t *boxes,
     } else {
 	boxes->is_pixel_aligned = TRUE;
 
-	for (i = 0; i < traps->num_traps; i++) {
+	for (i = j = 0; i < traps->num_traps; i++) {
 	    /* Note the traps and boxes alias so we need to take the local copies first. */
 	    cairo_fixed_t x1 = traps->traps[i].left.p1.x;
 	    cairo_fixed_t x2 = traps->traps[i].right.p1.x;
@@ -1440,10 +1444,12 @@ boxes_for_traps (cairo_boxes_t *boxes,
 	    cairo_fixed_t y2 = traps->traps[i].bottom;
 
 	    /* round down here to match Pixman's behavior when using traps. */
-	    boxes->chunks.base[i].p1.x = _cairo_fixed_round_down (x1);
-	    boxes->chunks.base[i].p1.y = _cairo_fixed_round_down (y1);
-	    boxes->chunks.base[i].p2.x = _cairo_fixed_round_down (x2);
-	    boxes->chunks.base[i].p2.y = _cairo_fixed_round_down (y2);
+	    boxes->chunks.base[j].p1.x = _cairo_fixed_round_down (x1);
+	    boxes->chunks.base[j].p1.y = _cairo_fixed_round_down (y1);
+	    boxes->chunks.base[j].p2.x = _cairo_fixed_round_down (x2);
+	    boxes->chunks.base[j].p2.y = _cairo_fixed_round_down (y2);
+	    j += (boxes->chunks.base[j].p1.x != boxes->chunks.base[j].p2.x &&
+		  boxes->chunks.base[j].p1.y != boxes->chunks.base[j].p2.y);
 	}
     }
 
diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c
index be4df35..349f54e 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -2905,7 +2905,7 @@ _boxes_for_traps (cairo_boxes_t *boxes,
 		  cairo_traps_t *traps,
 		  cairo_antialias_t antialias)
 {
-    int i;
+    int i, j;
 
     _cairo_boxes_init (boxes);
 
@@ -2915,17 +2915,21 @@ _boxes_for_traps (cairo_boxes_t *boxes,
     boxes->chunks.size  = traps->num_traps;
 
     if (antialias != CAIRO_ANTIALIAS_NONE) {
-	for (i = 0; i < traps->num_traps; i++) {
+	for (i = j = 0; i < traps->num_traps; i++) {
 	    /* Note the traps and boxes alias so we need to take the local copies first. */
 	    cairo_fixed_t x1 = traps->traps[i].left.p1.x;
 	    cairo_fixed_t x2 = traps->traps[i].right.p1.x;
 	    cairo_fixed_t y1 = traps->traps[i].top;
 	    cairo_fixed_t y2 = traps->traps[i].bottom;
 
-	    boxes->chunks.base[i].p1.x = x1;
-	    boxes->chunks.base[i].p1.y = y1;
-	    boxes->chunks.base[i].p2.x = x2;
-	    boxes->chunks.base[i].p2.y = y2;
+	    if (x1 == x2 || y1 == y2)
+		    continue;
+
+	    boxes->chunks.base[j].p1.x = x1;
+	    boxes->chunks.base[j].p1.y = y1;
+	    boxes->chunks.base[j].p2.x = x2;
+	    boxes->chunks.base[j].p2.y = y2;
+	    j++;
 
 	    if (boxes->is_pixel_aligned) {
 		boxes->is_pixel_aligned =
@@ -2936,7 +2940,7 @@ _boxes_for_traps (cairo_boxes_t *boxes,
     } else {
 	boxes->is_pixel_aligned = TRUE;
 
-	for (i = 0; i < traps->num_traps; i++) {
+	for (i = j = 0; i < traps->num_traps; i++) {
 	    /* Note the traps and boxes alias so we need to take the local copies first. */
 	    cairo_fixed_t x1 = traps->traps[i].left.p1.x;
 	    cairo_fixed_t x2 = traps->traps[i].right.p1.x;
@@ -2944,10 +2948,13 @@ _boxes_for_traps (cairo_boxes_t *boxes,
 	    cairo_fixed_t y2 = traps->traps[i].bottom;
 
 	    /* round down here to match Pixman's behavior when using traps. */
-	    boxes->chunks.base[i].p1.x = _cairo_fixed_round_down (x1);
-	    boxes->chunks.base[i].p1.y = _cairo_fixed_round_down (y1);
-	    boxes->chunks.base[i].p2.x = _cairo_fixed_round_down (x2);
-	    boxes->chunks.base[i].p2.y = _cairo_fixed_round_down (y2);
+	    boxes->chunks.base[j].p1.x = _cairo_fixed_round_down (x1);
+	    boxes->chunks.base[j].p1.y = _cairo_fixed_round_down (y1);
+	    boxes->chunks.base[j].p2.x = _cairo_fixed_round_down (x2);
+	    boxes->chunks.base[j].p2.y = _cairo_fixed_round_down (y2);
+
+	    j += (boxes->chunks.base[j].p1.x != boxes->chunks.base[j].p2.x &&
+		  boxes->chunks.base[j].p1.y != boxes->chunks.base[j].p2.y);
 	}
     }
 }
commit 826cda5974ca3f171ea0757368d7c5a97d5d556a
Author: Uli Schlachter <psychon at znc.in>
Date:   Sat Aug 23 14:38:36 2014 +0200

    xcb: Correctly check for image surface for inplace upload
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82987
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c
index 129185a..be4df35 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -37,6 +37,7 @@
 #include "cairo-clip-inline.h"
 #include "cairo-clip-private.h"
 #include "cairo-composite-rectangles-private.h"
+#include "cairo-image-surface-inline.h"
 #include "cairo-image-surface-private.h"
 #include "cairo-list-inline.h"
 #include "cairo-region-private.h"
@@ -2789,7 +2790,7 @@ _upload_image_inplace (cairo_xcb_surface_t *surface,
 	return CAIRO_INT_STATUS_UNSUPPORTED;
 
     pattern = (const cairo_surface_pattern_t *) source;
-    if (pattern->surface->type != CAIRO_SURFACE_TYPE_IMAGE)
+    if (! _cairo_surface_is_image (pattern->surface))
 	return CAIRO_INT_STATUS_UNSUPPORTED;
 
     /* Have we already upload this image to a pixmap? */
commit 213b3b9b8b92944506c712aa4d728903c547f879
Author: Uli Schlachter <psychon at znc.in>
Date:   Mon Jul 21 17:10:16 2014 +0200

    Remove LTO support
    
    This just never worked too well and caused too many issues. I don't think anyone
    will miss this.
    
    As mentioned in the below bug report, proper LTO support also requires using
    special versions of ranlib, nm and ar which support the LTO object files.
    Otherwise, calling the normal ranlib on an .a library breaks the list of
    exported symbols and thus completely breaks the static library.
    
    This (partly) reverts the following commits:
    
    c3645d97ebd24c6f7ad850785d585aebc706a11c configure.ac: Add a --disable-lto configure option
    d486ea30f1a58640a1178de74f705a73845b1cda configure: Conditionally include -flto
    0870c6fb5b39dcc04fa376123848adde2d06d2ce gcc-4.5 warnings and optimisation flags.
    
    (The last commit is the one which brought us -flto in the first place even
    though it doesn't talk about this. It's also the one which is only reverted
    partly.)
    
    Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=77060
    CC: Chris Wilson <chris at chris-wilson.co.uk>
    Signed-off-by: Uli Schlachter <psychon at znc.in>
    Reviewed-by: Bryce Harrington <b.harrington at samsung.com>

diff --git a/build/configure.ac.warnings b/build/configure.ac.warnings
index a72d948..2c4e34d 100644
--- a/build/configure.ac.warnings
+++ b/build/configure.ac.warnings
@@ -35,22 +35,6 @@ MAYBE_WARN="$MAYBE_WARN -erroff=E_ENUM_TYPE_MISMATCH_ARG \
 
 dnl We also abuse the warning-flag facility to enable other compiler
 dnl options.  Namely, the following:
-
-dnl -flto working really needs a test link, not just a compile
-
-AC_ARG_ENABLE(lto,
-  AS_HELP_STRING([--disable-lto],
-                 [Do not try to use Link-Time Optimization]))
-if test "x$enable_lto" != "xno"; then
-   safe_MAYBE_WARN="$MAYBE_WARN"
-   MAYBE_WARN="$MAYBE_WARN -flto"
-   AC_TRY_LINK([],[
-	int main(int argc, char **argv) { return 0; }
-   ],[],[
-	MAYBE_WARN="$safe_MAYBE_WARN"
-   ])
-fi
-
 MAYBE_WARN="$MAYBE_WARN -fno-strict-aliasing -fno-common"
 
 dnl Also to turn various gcc/glibc-specific preprocessor checks
commit ee69e744ee7333a5983f1a9158750bbd73556b55
Author: Bryce Harrington <b.harrington at samsung.com>
Date:   Tue Jul 8 13:14:20 2014 -0700

    configure.ac: Add a --disable-lto configure option
    
    Link-Time Optimization seems to be stable enough with gcc 4.8 and 4.9,
    but has proven to be an issue in the past for many cairo users (webkit,
    efl, ubuntu, opensuse, gentoo, arch...) who carry patches to disable it.
    
    Gentoo's patch[1] adds a --disable-lto option to leave it enabled by
    default but give users the ability to work around lto related build
    problems (c.f. fdo #77060).  Patch appears to have been authored by
    Alexandre Rostovtsev[2].
    
    1: sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/x11-libs/cairo/files/cairo-1.12.16-lto-optional.patch
    2: https://bugs.gentoo.org/show_bug.cgi?id=509552
    
    Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=60852
    Signed-off-by: Bryce Harrington <b.harrington at samsung.com>
    Reviewed-by: Uli Schlachter <psychon at znc.in>

diff --git a/build/configure.ac.warnings b/build/configure.ac.warnings
index f984eb2..a72d948 100644
--- a/build/configure.ac.warnings
+++ b/build/configure.ac.warnings
@@ -38,13 +38,18 @@ dnl options.  Namely, the following:
 
 dnl -flto working really needs a test link, not just a compile
 
-safe_MAYBE_WARN="$MAYBE_WARN"
-MAYBE_WARN="$MAYBE_WARN -flto"
-AC_TRY_LINK([],[
+AC_ARG_ENABLE(lto,
+  AS_HELP_STRING([--disable-lto],
+                 [Do not try to use Link-Time Optimization]))
+if test "x$enable_lto" != "xno"; then
+   safe_MAYBE_WARN="$MAYBE_WARN"
+   MAYBE_WARN="$MAYBE_WARN -flto"
+   AC_TRY_LINK([],[
 	int main(int argc, char **argv) { return 0; }
-],[],[
+   ],[],[
 	MAYBE_WARN="$safe_MAYBE_WARN"
-])
+   ])
+fi
 
 MAYBE_WARN="$MAYBE_WARN -fno-strict-aliasing -fno-common"
 
commit 3434b79281ba592e6b0a89a90ce42499607025f0
Author: Sylvestre Ledru <sylvestre at debian.org>
Date:   Wed May 7 17:16:09 2014 +0200

    Remove some potential double free
    
    Signed-off-by: Bryce Harrington <b.harrington at samsung.com>
    Reviewed-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-truetype-subset.c b/src/cairo-truetype-subset.c
index 3d55fef..645a89a 100644
--- a/src/cairo-truetype-subset.c
+++ b/src/cairo-truetype-subset.c
@@ -1564,12 +1564,12 @@ _cairo_truetype_read_font_name (cairo_scaled_font_t  	 *scaled_font,
 	    goto fail;
     }
 
-    free (name);
-
     status = _cairo_escape_ps_name (&ps_name);
     if (unlikely(status))
 	goto fail;
 
+    free (name);
+
     *ps_name_out = ps_name;
     *font_name_out = family_name;
 
commit 2be98be04e210318fbc73adef8722c19d288cd50
Author: Bryce Harrington <b.harrington at samsung.com>
Date:   Tue May 6 10:18:19 2014 -0700

    Fix segfault in firefox when scrolling on certain pages
    
    Bug discovered by thorsten <fly_a320 at gmx.de>
    
    Patch from Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c
index 2d52be9..129185a 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -3121,6 +3121,9 @@ _clip_and_composite_boxes (cairo_xcb_surface_t *dst,
 
 	clip = _cairo_clip_copy (extents->clip);
 	clip = _cairo_clip_intersect_boxes (clip, boxes);
+	if (_cairo_clip_is_all_clipped (clip))
+		return CAIRO_INT_STATUS_NOTHING_TO_DO;
+
 	status = _cairo_clip_get_polygon (clip, &polygon,
 					  &fill_rule, &antialias);
 	_cairo_clip_path_destroy (clip->path);
commit 5b083237f5201d85fa2468700e6b12a21a8787d4
Author: Uli Schlachter <psychon at znc.in>
Date:   Fri Mar 14 13:47:38 2014 +0100

    mask compositor: Set a check_composite method
    
    Commit 503b6b9e2ea6 added a check_composite method to the mask compositor, but
    only added it to one of the existing implementations. This commit fixes that.
    
    In cairo-image-compositor.c, there is already a check_composite method which
    just returns success for the traps compositor. This commit makes the mask
    compositor use that one.
    
    I don't want to say much about cairo-image-mask-compositor.c except that I
    wondered why this file and the file above both define a non-static function
    called _cairo_image_mask_compositor_get(). In my opinion, that file should just
    be deleted, since it confuses e.g. ctags, but I'll let someone else clean this
    up.
    
    Fixes 493 crashes in the test suite for the test-mask target.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>
    Tested-by: Bryce Harrington <b.harrington at samsung.com>

diff --git a/src/cairo-image-compositor.c b/src/cairo-image-compositor.c
index 03468a6..51ffc34 100644
--- a/src/cairo-image-compositor.c
+++ b/src/cairo-image-compositor.c
@@ -1257,7 +1257,7 @@ _cairo_image_mask_compositor_get (void)
 	compositor.draw_image_boxes = draw_image_boxes;
 	compositor.fill_rectangles = fill_rectangles;
 	compositor.fill_boxes = fill_boxes;
-	//compositor.check_composite = check_composite;
+	compositor.check_composite = check_composite;
 	compositor.composite = composite;
 	//compositor.lerp = lerp;
 	//compositor.check_composite_boxes = check_composite_boxes;
diff --git a/src/cairo-image-mask-compositor.c b/src/cairo-image-mask-compositor.c
index 33fd6dd..bb990dd 100644
--- a/src/cairo-image-mask-compositor.c
+++ b/src/cairo-image-mask-compositor.c
@@ -48,6 +48,8 @@
 #include "cairo-compositor-private.h"
 #include "cairo-region-private.h"
 
+#error This file isn't included in any Makefile
+
 static cairo_int_status_t
 acquire (void *abstract_dst)
 {
@@ -398,6 +400,7 @@ _cairo_image_mask_compositor_get (void)
 	compositor.draw_image = draw_image;
 	compositor.fill_rectangles = fill_rectangles;
 	compositor.fill_boxes = fill_boxes;
+#error check_composite must never be NULL, because it gets called without a NULL pointer check
 	//compositor.check_composite = check_composite;
 	compositor.composite = composite;
 	//compositor.check_composite_boxes = check_composite_boxes;
commit 17e14b62e06f65ce573df18505d7495debcaea11
Author: Uli Schlachter <psychon at znc.in>
Date:   Thu Mar 6 09:45:08 2014 +0100

    clip: Fix handling of special all-clipped cairo_clip_t
    
    _cairo_clip_intersect_box() wasn't checking if it was called with the special,
    read-only all-clipped clip and thus could have ended up writing to read-only
    memory.
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=75819
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-clip-boxes.c b/src/cairo-clip-boxes.c
index 352654f..7bcbeb1 100644
--- a/src/cairo-clip-boxes.c
+++ b/src/cairo-clip-boxes.c
@@ -258,6 +258,9 @@ _cairo_clip_intersect_box (cairo_clip_t *clip,
 {
     cairo_rectangle_int_t r;
 
+    if (_cairo_clip_is_all_clipped (clip))
+	return clip;
+
     _cairo_box_round_to_rectangle (box, &r);
     if (r.width == 0 || r.height == 0)
 	return _cairo_clip_set_all_clipped (clip);
commit 087b92f32b188734659e093799a67fd9be27b49a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Mar 6 08:34:10 2014 +0000

    clip: Do not modify the special all-clipped cairo_clip_t
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75819

diff --git a/src/cairo-clip-boxes.c b/src/cairo-clip-boxes.c
index bbb4197..352654f 100644
--- a/src/cairo-clip-boxes.c
+++ b/src/cairo-clip-boxes.c
@@ -173,7 +173,7 @@ _cairo_clip_intersect_rectangle_box (cairo_clip_t *clip,
 	    clip->extents = *r;
 	} else {
 	    if (! _cairo_rectangle_intersect (&clip->extents, r))
-		clip = _cairo_clip_set_all_clipped (clip);
+		return _cairo_clip_set_all_clipped (clip);
 	}
 	if (clip->path == NULL)
 	    clip->is_region = _cairo_box_is_pixel_aligned (box);
@@ -312,10 +312,12 @@ _cairo_clip_intersect_boxes (cairo_clip_t *clip,
     _cairo_boxes_extents (boxes, &limits);
 
     _cairo_box_round_to_rectangle (&limits, &extents);
-    if (clip->path == NULL)
+    if (clip->path == NULL) {
 	clip->extents = extents;
-    else if (! _cairo_rectangle_intersect (&clip->extents, &extents))
+    } else if (! _cairo_rectangle_intersect (&clip->extents, &extents)) {
 	clip = _cairo_clip_set_all_clipped (clip);
+	goto out;
+    }
 
     if (clip->region) {
 	cairo_region_destroy (clip->region);
commit 518c9e49924af9d6750dd638df719e5ebc722137
Author: Koji Egashira <Koji.Egashira at access-company.com>
Date:   Mon Apr 29 18:31:08 2013 +0900

    image: Add NULL checks for return value of _pixman_image_for_color()
    
    This fixes crash in pixman_image_composite32().
    
    Originally fixed by Yoshitaro Makise.
    
    Reviewed-by: Bryce Harrington <b.harrington at samsung.com>
    Signed-off-by: Bryce Harrington <b.harrington at samsung.com>

diff --git a/src/cairo-image-compositor.c b/src/cairo-image-compositor.c
index 0f47814..03468a6 100644
--- a/src/cairo-image-compositor.c
+++ b/src/cairo-image-compositor.c
@@ -308,6 +308,8 @@ fill_rectangles (void			*_dst,
 	}
     } else {
 	pixman_image_t *src = _pixman_image_for_color (color);
+	if (unlikely (src == NULL))
+	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 
 	op = _pixman_operator (op);
 	for (i = 0; i < num_rects; i++) {
@@ -355,6 +357,8 @@ fill_boxes (void		*_dst,
     else
     {
 	pixman_image_t *src = _pixman_image_for_color (color);
+	if (unlikely (src == NULL))
+	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 
 	op = _pixman_operator (op);
 	for (chunk = &boxes->chunks; chunk; chunk = chunk->next) {
@@ -507,6 +511,8 @@ composite_boxes (void			*_dst,
 	    op = PIXMAN_OP_LERP_CLEAR;
 #else
 	    free_src = src = _pixman_image_for_color (CAIRO_COLOR_WHITE);
+	    if (unlikely (src == NULL))
+		return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 	    op = PIXMAN_OP_OUT_REVERSE;
 #endif
 	} else if (op == CAIRO_OPERATOR_SOURCE) {
commit 91d245b204f559d19aaabb109f5604850e848d4b
Author: Bryce Harrington <b.harrington at samsung.com>
Date:   Wed Feb 26 18:36:15 2014 -0800

    image: Fix bad HTML generation in code docs for cairo-format-stride-for-width
    
    Patch from Simon KÃ¥gedal Reimer
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63257

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 824dbf3..eb2bb68 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -419,7 +419,7 @@ _cairo_image_surface_create_with_content (cairo_content_t	content,
  * <informalexample><programlisting>
  * int stride;
  * unsigned char *data;
- * #cairo_surface_t *surface;
+ * cairo_surface_t *surface;
  *
  * stride = cairo_format_stride_for_width (format, width);
  * data = malloc (stride * height);
commit 920247086c9ca1a8d801986ed93c0baa7985c35d
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Jan 11 20:49:05 2014 +1030

    type1: strip space from end of font name

diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
index ab108cb..3a1bcc7 100644
--- a/src/cairo-type1-subset.c
+++ b/src/cairo-type1-subset.c
@@ -420,6 +420,9 @@ cairo_type1_font_subset_get_fontname (cairo_type1_font_subset_t *font)
     if (end == NULL)
 	return CAIRO_INT_STATUS_UNSUPPORTED;
 
+    while (end > start && _cairo_isspace(end[-1]))
+	end--;
+
     s = malloc (end - start + 1);
     if (unlikely (s == NULL))
 	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
commit 15045aebebc07ad71477b44a700761d6e0340192
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Jan 11 20:57:44 2014 +1030

    ps: add font DSC comments

diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 960e2d1..3eb07d2 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -374,12 +374,11 @@ _cairo_ps_surface_emit_header (cairo_ps_surface_t *surface)
 
     _cairo_output_stream_printf (surface->final_stream,
 				 "%%%%EndProlog\n");
+    _cairo_output_stream_printf (surface->final_stream,
+				 "%%%%BeginSetup\n");
 
     num_comments = _cairo_array_num_elements (&surface->dsc_setup_comments);
     if (num_comments) {
-	_cairo_output_stream_printf (surface->final_stream,
-				     "%%%%BeginSetup\n");
-
 	comments = _cairo_array_index (&surface->dsc_setup_comments, 0);
 	for (i = 0; i < num_comments; i++) {
 	    _cairo_output_stream_printf (surface->final_stream,
@@ -387,9 +386,6 @@ _cairo_ps_surface_emit_header (cairo_ps_surface_t *surface)
 	    free (comments[i]);
 	    comments[i] = NULL;
 	}
-
-	_cairo_output_stream_printf (surface->final_stream,
-				     "%%%%EndSetup\n");
     }
 }
 
@@ -417,8 +413,13 @@ _cairo_ps_surface_emit_type1_font_subset (cairo_ps_surface_t		*surface,
 				 "%% _cairo_ps_surface_emit_type1_font_subset\n");
 #endif
 
+    _cairo_output_stream_printf (surface->final_stream,
+				 "%%%%BeginResource: font %s\n",
+				 subset.base_font);
     length = subset.header_length + subset.data_length + subset.trailer_length;
     _cairo_output_stream_write (surface->final_stream, subset.data, length);
+    _cairo_output_stream_printf (surface->final_stream,
+				 "%%%%EndResource\n");
 
     _cairo_type1_subset_fini (&subset);
 
@@ -441,15 +442,18 @@ _cairo_ps_surface_emit_type1_font_fallback (cairo_ps_surface_t		*surface,
     if (unlikely (status))
 	return status;
 
-    /* FIXME: Figure out document structure convention for fonts */
-
 #if DEBUG_PS
     _cairo_output_stream_printf (surface->final_stream,
 				 "%% _cairo_ps_surface_emit_type1_font_fallback\n");
 #endif
 
+    _cairo_output_stream_printf (surface->final_stream,
+				 "%%%%BeginResource: font %s\n",
+				 subset.base_font);
     length = subset.header_length + subset.data_length + subset.trailer_length;
     _cairo_output_stream_write (surface->final_stream, subset.data, length);
+    _cairo_output_stream_printf (surface->final_stream,
+				 "%%%%EndResource\n");
 
     _cairo_type1_fallback_fini (&subset);
 
@@ -478,6 +482,9 @@ _cairo_ps_surface_emit_truetype_font_subset (cairo_ps_surface_t		*surface,
 #endif
 
     _cairo_output_stream_printf (surface->final_stream,
+				 "%%%%BeginResource: font %s\n",
+				 subset.ps_name);
+    _cairo_output_stream_printf (surface->final_stream,
 				 "11 dict begin\n"
 				 "/FontType 42 def\n"
 				 "/FontName /%s def\n"
@@ -559,9 +566,11 @@ _cairo_ps_surface_emit_truetype_font_subset (cairo_ps_surface_t		*surface,
 				 "/f-%d-%d currentdict end definefont pop\n",
 				 font_subset->font_id,
 				 font_subset->subset_id);
-
+    _cairo_output_stream_printf (surface->final_stream,
+				 "%%%%EndResource\n");
     _cairo_truetype_subset_fini (&subset);
 
+
     return CAIRO_STATUS_SUCCESS;
 }
 
@@ -656,6 +665,8 @@ _cairo_ps_surface_emit_type3_font_subset (cairo_ps_surface_t		*surface,
 #endif
 
     _cairo_output_stream_printf (surface->final_stream,
+				 "%%%%BeginResource: font\n");
+    _cairo_output_stream_printf (surface->final_stream,
 				 "8 dict begin\n"
 				 "/FontType 3 def\n"
 				 "/FontMatrix [1 0 0 1 0 0] def\n"
@@ -735,6 +746,8 @@ _cairo_ps_surface_emit_type3_font_subset (cairo_ps_surface_t		*surface,
 				 - _cairo_fixed_to_double (font_bbox.p1.y),
 				 font_subset->font_id,
 				 font_subset->subset_id);
+    _cairo_output_stream_printf (surface->final_stream,
+				 "%%%%EndResource\n");
 
     return CAIRO_STATUS_SUCCESS;
 }
@@ -1598,6 +1611,9 @@ _cairo_ps_surface_finish (void *abstract_surface)
     if (unlikely (status))
 	goto CLEANUP;
 
+    _cairo_output_stream_printf (surface->final_stream,
+				 "%%%%EndSetup\n");
+
     status = _cairo_ps_surface_emit_body (surface);
     if (unlikely (status))
 	goto CLEANUP;
commit f5f09c9350e78b8d5503d99ed621eb6bdae93d55
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Jan 11 19:09:55 2014 +1030

    ps: cairo_set_page_size does not need to be in eps output

diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index f56228f..960e2d1 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -335,38 +335,42 @@ _cairo_ps_surface_emit_header (cairo_ps_surface_t *surface)
 				 "      cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def\n"
 				 "/g { setgray } bind def\n"
 				 "/rg { setrgbcolor } bind def\n"
-				 "/d1 { setcachedevice } bind def\n"
-				 "/cairo_set_page_size {\n"
-				 "  %% Change paper size, but only if different from previous paper size otherwise\n"
-				 "  %% duplex fails. PLRM specifies a tolerance of 5 pts when matching paper size\n"
-				 "  %% so we use the same when checking if the size changes.\n"
-				 "  /setpagedevice where {\n"
-				 "    pop currentpagedevice\n"
-				 "    /PageSize known {\n"
-				 "      2 copy\n"
-				 "      currentpagedevice /PageSize get aload pop\n"
-				 "      exch 4 1 roll\n"
-				 "      sub abs 5 gt\n"
-				 "      3 1 roll\n"
-				 "      sub abs 5 gt\n"
-				 "      or\n"
-				 "    } {\n"
-				 "      true\n"
-				 "    } ifelse\n"
-				 "    {\n"
-				 "      2 array astore\n"
-				 "      2 dict begin\n"
-				 "        /PageSize exch def\n"
-				 "        /ImagingBBox null def\n"
-				 "      currentdict end\n"
-				 "      setpagedevice\n"
-				 "    } {\n"
-				 "      pop pop\n"
-				 "    } ifelse\n"
-				 "  } {\n"
-				 "    pop\n"
-				 "  } ifelse\n"
-				 "} def\n");
+				 "/d1 { setcachedevice } bind def\n");
+
+    if (!surface->eps) {
+	_cairo_output_stream_printf (surface->final_stream,
+				     "/cairo_set_page_size {\n"
+				     "  %% Change paper size, but only if different from previous paper size otherwise\n"
+				     "  %% duplex fails. PLRM specifies a tolerance of 5 pts when matching paper size\n"
+				     "  %% so we use the same when checking if the size changes.\n"
+				     "  /setpagedevice where {\n"
+				     "    pop currentpagedevice\n"
+				     "    /PageSize known {\n"
+				     "      2 copy\n"
+				     "      currentpagedevice /PageSize get aload pop\n"
+				     "      exch 4 1 roll\n"
+				     "      sub abs 5 gt\n"
+				     "      3 1 roll\n"
+				     "      sub abs 5 gt\n"
+				     "      or\n"
+				     "    } {\n"
+				     "      true\n"
+				     "    } ifelse\n"
+				     "    {\n"
+				     "      2 array astore\n"
+				     "      2 dict begin\n"
+				     "        /PageSize exch def\n"
+				     "        /ImagingBBox null def\n"
+				     "      currentdict end\n"
+				     "      setpagedevice\n"
+				     "    } {\n"
+				     "      pop pop\n"
+				     "    } ifelse\n"
+				     "  } {\n"
+				     "    pop\n"
+				     "  } ifelse\n"
+				     "} def\n");
+    }
 
     _cairo_output_stream_printf (surface->final_stream,
 				 "%%%%EndProlog\n");
commit be03857b510a8dca44a94ef6112249d195c2a069
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Jan 11 10:42:33 2014 +1030

    ps: use setpagedevice to set page size
    
    https://bugs.freedesktop.org/show_bug.cgi?id=73452

diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 9b7bc3e..f56228f 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -335,7 +335,38 @@ _cairo_ps_surface_emit_header (cairo_ps_surface_t *surface)
 				 "      cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def\n"
 				 "/g { setgray } bind def\n"
 				 "/rg { setrgbcolor } bind def\n"
-				 "/d1 { setcachedevice } bind def\n");
+				 "/d1 { setcachedevice } bind def\n"
+				 "/cairo_set_page_size {\n"
+				 "  %% Change paper size, but only if different from previous paper size otherwise\n"
+				 "  %% duplex fails. PLRM specifies a tolerance of 5 pts when matching paper size\n"
+				 "  %% so we use the same when checking if the size changes.\n"
+				 "  /setpagedevice where {\n"
+				 "    pop currentpagedevice\n"
+				 "    /PageSize known {\n"
+				 "      2 copy\n"
+				 "      currentpagedevice /PageSize get aload pop\n"
+				 "      exch 4 1 roll\n"
+				 "      sub abs 5 gt\n"
+				 "      3 1 roll\n"
+				 "      sub abs 5 gt\n"
+				 "      or\n"
+				 "    } {\n"
+				 "      true\n"
+				 "    } ifelse\n"
+				 "    {\n"
+				 "      2 array astore\n"
+				 "      2 dict begin\n"
+				 "        /PageSize exch def\n"
+				 "        /ImagingBBox null def\n"
+				 "      currentdict end\n"
+				 "      setpagedevice\n"
+				 "    } {\n"
+				 "      pop pop\n"
+				 "    } ifelse\n"
+				 "  } {\n"
+				 "    pop\n"
+				 "  } ifelse\n"
+				 "} def\n");
 
     _cairo_output_stream_printf (surface->final_stream,
 				 "%%%%EndProlog\n");
@@ -4559,6 +4590,13 @@ _cairo_ps_surface_set_bounding_box (void		*abstract_surface,
 				     x1, y1, x2, y2);
     }
 
+    if (!surface->eps) {
+	_cairo_output_stream_printf (surface->stream,
+				     "%f %f cairo_set_page_size\n",
+				     ceil(surface->width),
+				     ceil(surface->height));
+    }
+
     _cairo_output_stream_printf (surface->stream,
                                  "%%%%EndPageSetup\n"
 				 "q %d %d %d %d rectclip q\n",
commit 0f943813229a357693d427924045581938a6130d
Author: Marek Kasik <mkasik at redhat.com>
Date:   Thu Jan 9 17:28:32 2014 +0100

    font: Generate PDFs with correct font names
    
    Escape PostScript names of loaded fonts. These can not
    contain white spaces and delimiter characters when saving
    them to a PostScript file or a PDF file.

diff --git a/src/cairo-cff-subset.c b/src/cairo-cff-subset.c
index c420bd4..1ae032c 100644
--- a/src/cairo-cff-subset.c
+++ b/src/cairo-cff-subset.c
@@ -899,6 +899,8 @@ cairo_cff_font_read_name (cairo_cff_font_t *font)
 
         memcpy (font->ps_name, p, len);
         font->ps_name[len] = 0;
+
+        status = _cairo_escape_ps_name (&font->ps_name);
     }
     cff_index_fini (&index);
 
diff --git a/src/cairo-scaled-font-subsets-private.h b/src/cairo-scaled-font-subsets-private.h
index dd19962..866e63d 100644
--- a/src/cairo-scaled-font-subsets-private.h
+++ b/src/cairo-scaled-font-subsets-private.h
@@ -715,6 +715,21 @@ _cairo_truetype_get_style (cairo_scaled_font_t  	 *scaled_font,
 			   cairo_bool_t			 *bold,
 			   cairo_bool_t			 *italic);
 
+/**
+ * _cairo_escape_ps_name:
+ * @ps_name: returns the PostScript name with all invalid characters escaped
+ *
+ * Ensure that PostSript name is a valid PDF/PostSript name object.
+ * In PDF names are treated as UTF8 and non ASCII bytes, ' ',
+ * and '#' are encoded as '#' followed by 2 hex digits that
+ * encode the byte.
+ *
+ * Return value: %CAIRO_STATUS_SUCCESS if successful. Possible errors include
+ * %CAIRO_STATUS_NO_MEMORY.
+ **/
+cairo_private cairo_int_status_t
+_cairo_escape_ps_name (char **ps_name);
+
 #endif /* CAIRO_HAS_FONT_SUBSET */
 
 #endif /* CAIRO_SCALED_FONT_SUBSETS_PRIVATE_H */
diff --git a/src/cairo-scaled-font-subsets.c b/src/cairo-scaled-font-subsets.c
index e78e0c2..2121761 100644
--- a/src/cairo-scaled-font-subsets.c
+++ b/src/cairo-scaled-font-subsets.c
@@ -1256,4 +1256,44 @@ CLEANUP_HASH:
     return status;
 }
 
+cairo_int_status_t
+_cairo_escape_ps_name (char **ps_name)
+{
+    cairo_status_t status = CAIRO_STATUS_SUCCESS;
+
+    /* Ensure PS name is a valid PDF/PS name object. In PDF names are
+     * treated as UTF8 and non ASCII bytes, ' ', and '#' are encoded
+     * as '#' followed by 2 hex digits that encode the byte. By also
+     * encoding the characters in the reserved string we ensure the
+     * name is also PS compatible. */
+    if (*ps_name) {
+	static const char *reserved = "()<>[]{}/%#\\";
+	char buf[128]; /* max name length is 127 bytes */
+	char *src = *ps_name;
+	char *dst = buf;
+
+	while (*src && dst < buf + 127) {
+	    unsigned char c = *src;
+	    if (c < 0x21 || c > 0x7e || strchr (reserved, c)) {
+		if (dst + 4 > buf + 127)
+		    break;
+
+		snprintf (dst, 4, "#%02X", c);
+		src++;
+		dst += 3;
+	    } else {
+		*dst++ = *src++;
+	    }
+	}
+	*dst = 0;
+	free (*ps_name);
+	*ps_name = strdup (buf);
+	if (*ps_name == NULL) {
+	    status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
+	}
+    }
+
+    return status;
+}
+
 #endif /* CAIRO_HAS_FONT_SUBSET */
diff --git a/src/cairo-truetype-subset.c b/src/cairo-truetype-subset.c
index 18ee685..3d55fef 100644
--- a/src/cairo-truetype-subset.c
+++ b/src/cairo-truetype-subset.c
@@ -1566,38 +1566,9 @@ _cairo_truetype_read_font_name (cairo_scaled_font_t  	 *scaled_font,
 
     free (name);
 
-    /* Ensure PS name is a valid PDF/PS name object. In PDF names are
-     * treated as UTF8 and non ASCII bytes, ' ', and '#' are encoded
-     * as '#' followed by 2 hex digits that encode the byte. By also
-     * encoding the characters in the reserved string we ensure the
-     * name is also PS compatible. */
-    if (ps_name) {
-	static const char *reserved = "()<>[]{}/%#\\";
-	char buf[128]; /* max name length is 127 bytes */
-	char *src = ps_name;
-	char *dst = buf;
-
-	while (*src && dst < buf + 127) {
-	    unsigned char c = *src;
-	    if (c < 0x21 || c > 0x7e || strchr (reserved, c)) {
-		if (dst + 4 > buf + 127)
-		    break;
-
-		snprintf (dst, 4, "#%02X", c);
-		src++;
-		dst += 3;
-	    } else {
-		*dst++ = *src++;
-	    }
-	}
-	*dst = 0;
-	free (ps_name);
-	ps_name = strdup (buf);
-	if (ps_name == NULL) {
-	    status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
-	    goto fail;
-	}
-    }
+    status = _cairo_escape_ps_name (&ps_name);
+    if (unlikely(status))
+	goto fail;
 
     *ps_name_out = ps_name;
     *font_name_out = family_name;
diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
index 4b64403..ab108cb 100644
--- a/src/cairo-type1-subset.c
+++ b/src/cairo-type1-subset.c
@@ -407,6 +407,7 @@ cairo_type1_font_subset_get_fontname (cairo_type1_font_subset_t *font)
     const char *start, *end, *segment_end;
     char *s;
     int i;
+    cairo_status_t status;
 
     segment_end = font->header_segment + font->header_segment_size;
     start = find_token (font->header_segment, segment_end, "/FontName");
@@ -447,13 +448,9 @@ cairo_type1_font_subset_get_fontname (cairo_type1_font_subset_t *font)
     if (unlikely (font->base.base_font == NULL))
 	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 
-    s = font->base.base_font;
-    while (*s && !is_ps_delimiter(*s))
-	s++;
-
-    *s = 0;
+    status = _cairo_escape_ps_name (&font->base.base_font);
 
-    return CAIRO_STATUS_SUCCESS;
+    return status;
 }
 
 static cairo_status_t
commit 990d384d9efa231eab65b1144305c82e7c262ff3
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Wed Jan 8 07:45:20 2014 +1030

    ps: fix imagemask with pattern source failure on some printers
    
    When /PaintProc is invoked the pattern dict is pushed onto the stack.
    Ensure this dict is removed.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=69485

diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 8d1627f..9b7bc3e 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -3403,7 +3403,7 @@ _cairo_ps_surface_emit_surface_pattern (cairo_ps_surface_t      *surface,
 	_cairo_output_stream_printf (surface->stream,
 				     "   /BBox [0 0 %d %d]\n"
 				     "   /PaintProc {\n"
-				     "      CairoPattern\n"
+				     "      pop CairoPattern\n"
 				     "      [-1 0 0  1 %d 0] concat CairoPattern\n"
 				     "      [ 1 0 0 -1 0 %d] concat CairoPattern\n"
 				     "      [-1 0 0  1 %d 0] concat CairoPattern\n"
@@ -3424,7 +3424,7 @@ _cairo_ps_surface_emit_surface_pattern (cairo_ps_surface_t      *surface,
 					 pattern_width, pattern_height);
 	}
 	_cairo_output_stream_printf (surface->stream,
-				     "   /PaintProc { CairoPattern }\n");
+				     "   /PaintProc { pop CairoPattern }\n");
     }
 
     _cairo_output_stream_printf (surface->stream,
commit 892e5643173ab659a97d9706c8435839fd7367c9
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Fri Jan 3 21:06:24 2014 +1030

    ps: remove duplicate /Interpolate from image dictionary
    
    http://lists.freedesktop.org/archives/poppler/2014-January/010748.html

diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index dfab4f7..8d1627f 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -2718,11 +2718,9 @@ _cairo_ps_surface_emit_image (cairo_ps_surface_t    *surface,
 	}
 
 	_cairo_output_stream_printf (surface->stream,
-				     "  /Interpolate %s def\n"
 				     "  /ImageMatrix [ 1 0 0 -1 0 %d ] def\n"
 				     "end\n"
 				     "%s\n",
-				     interpolate,
 				     ps_image->height,
 				     stencil_mask ? "imagemask" : "image");
     }
commit 51c2f018d71e72bd55f2b70bde5dfcde8fb07714
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Thu Dec 26 15:28:29 2013 +1030

    pdf: fix rectangle stroke with non rectilinear pen

diff --git a/src/cairo-pdf-operators.c b/src/cairo-pdf-operators.c
index fceaf1c..055368d 100644
--- a/src/cairo-pdf-operators.c
+++ b/src/cairo-pdf-operators.c
@@ -510,7 +510,9 @@ _cairo_pdf_operators_emit_path (cairo_pdf_operators_t	*pdf_operators,
     info.output = word_wrap;
     info.path_transform = path_transform;
     info.line_cap = line_cap;
-    if (_cairo_path_fixed_is_rectangle (path, &box)) {
+    if (_cairo_path_fixed_is_rectangle (path, &box) &&
+	((path_transform->xx == 0 && path_transform->yy == 0) ||
+	 (path_transform->xy == 0 && path_transform->yx == 0))) {
 	status = _cairo_pdf_path_rectangle (&info, &box);
     } else {
 	status = _cairo_path_fixed_interpret (path,
commit caf1b826da9eccb7c073044f08b4f86148ce334f
Author: egag <ed44 at xs4all.nl>
Date:   Wed Oct 9 14:14:02 2013 +0200

    Fixes stroke-clipped, i.c. of a dashed stroke
    
    Similar to 1f4d05b55c96347aa4240190fda27f951b00c539
     'Fix calling '_cairo_spline_intersect' for in-bounds checking of splines'
    
    Reviewed-by: Bryce Harrington <b.harrington at samsung.com>

diff --git a/src/cairo-path-stroke-traps.c b/src/cairo-path-stroke-traps.c
index 304dea7..8b6e30f 100644
--- a/src/cairo-path-stroke-traps.c
+++ b/src/cairo-path-stroke-traps.c
@@ -1019,7 +1019,7 @@ curve_to_dashed (void *closure,
     func = (cairo_spline_add_point_func_t)line_to_dashed;
 
     if (stroker->has_bounds &&
-	! _cairo_spline_intersects (&stroker->current_face.point, b, c, b,
+	! _cairo_spline_intersects (&stroker->current_face.point, b, c, d,
 				    &stroker->line_bounds))
 	return func (closure, d, NULL);
 
commit c553424a1da2593daffa07a3dbf60ee6489c2a67
Author: Uli Schlachter <psychon at znc.in>
Date:   Fri Sep 27 15:37:08 2013 +0200

    fill_reduces_to_source(): Handle failure of color_to_pixel()
    
    The function color_to_pixel() can fail for unsupported pixman image formats, but
    fill_reduces_to_source() ignored this possibility.
    
    Fix this by using the return value of color_to_pixel():
    
    Fixes the following compiler warnings:
    
    cairo-image-compositor.c: In function 'fill_boxes':
    cairo-image-compositor.c:349:15: warning: 'pixel' may be used uninitialized in this function [-Wmaybe-uninitialized]
    cairo-image-compositor.c: In function 'fill_rectangles':
    cairo-image-compositor.c:304:18: warning: 'pixel' may be used uninitialized in this function [-Wmaybe-uninitialized]
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-image-compositor.c b/src/cairo-image-compositor.c
index d0c4dd9..0f47814 100644
--- a/src/cairo-image-compositor.c
+++ b/src/cairo-image-compositor.c
@@ -279,8 +279,7 @@ fill_reduces_to_source (cairo_operator_t op,
 			uint32_t *pixel)
 {
     if (__fill_reduces_to_source (op, color, dst)) {
-	color_to_pixel (color, dst->pixman_format, pixel);
-	return TRUE;
+	return color_to_pixel (color, dst->pixman_format, pixel);
     }
 
     return FALSE;
commit 549129e306bef2f81f53a52904af8814e79e1440
Author: Uli Schlachter <psychon at znc.in>
Date:   Sun Sep 15 16:58:05 2013 +0200

    check-doc-syntax: Don't hardcode path to awk
    
    Instead of expecting awk in /usr/bin, this commit changes the code to call awk
    through a shell so that $PATH is searched.
    
    Since this awk script shouldn't really be called manually, this is done by
    removing the shebang from the awk script, marking it non-executable and fixing
    up the caller.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67674
    Reviewed-by: Bryce Harrington <b.harrington at samsung.com>
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/check-doc-syntax.awk b/src/check-doc-syntax.awk
old mode 100755
new mode 100644
index 5fdabda..1fa8b8d
--- a/src/check-doc-syntax.awk
+++ b/src/check-doc-syntax.awk
@@ -1,5 +1,3 @@
-#!/usr/bin/awk -f
-
 BEGIN {
     name_found = 1
     SECTION_DOC = 0
diff --git a/src/check-doc-syntax.sh b/src/check-doc-syntax.sh
index c74fb87..762a484 100755
--- a/src/check-doc-syntax.sh
+++ b/src/check-doc-syntax.sh
@@ -72,7 +72,7 @@ fi >&2
 
 # Only run the syntax checker on the source files (not doc/)
 if test -e ./check-doc-syntax.awk; then
-    if echo $FILES | xargs ./check-doc-syntax.awk ; then
+    if echo $FILES | xargs awk -f ./check-doc-syntax.awk ; then
 	    :
     else
 	    stat=1
commit 384878373d8bd63f10af1398614a662198a61ed8
Author: Uli Schlachter <psychon at znc.in>
Date:   Fri Sep 13 22:18:08 2013 +0200

    cairo-gobject: Require at least glib 2.14
    
    cairo-gobject uses g_once_init_enter() and g_once_init_leave(). These functions
    were added in glib 2.14 and thus cairo needs at least this version for its
    gobject helper functions.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69239
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/configure.ac b/configure.ac
index fd54ad1..4e35ba7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -704,7 +704,7 @@ dnl ===========================================================================
 dnl Build gobject integration library
 
 CAIRO_ENABLE_FUNCTIONS(gobject, gobject, auto, [
-  gobject_REQUIRES="gobject-2.0 glib-2.0"
+  gobject_REQUIRES="gobject-2.0 glib-2.0 >= 2.14"
   PKG_CHECK_MODULES(GOBJECT, $gobject_REQUIRES, ,
     [use_gobject="no (requires $gobject_REQUIRES http://download.gnome.org/pub/GNOME/sources/glib/)"])
   gobject_NONPKGCONFIG_EXTRA_LIBS="-L\${libdir} -lcairo-gobject"
commit 6369470f305f5e5f93b1b29a2c7615b19ce1083d
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Fri Sep 13 22:14:49 2013 +0930

    ps: fix embedding of mime data

diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 5e6206a..dfab4f7 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -3093,6 +3093,16 @@ _cairo_ps_surface_emit_surface (cairo_ps_surface_t      *surface,
 {
     cairo_int_status_t status;
 
+    if (source_pattern->type == CAIRO_PATTERN_TYPE_SURFACE &&
+	source_pattern->extend != CAIRO_EXTEND_PAD)
+    {
+	cairo_surface_t *surf = ((cairo_surface_pattern_t *) source_pattern)->surface;
+
+	status = _cairo_ps_surface_emit_jpeg_image (surface, surf, width, height);
+	if (status != CAIRO_INT_STATUS_UNSUPPORTED)
+	    return status;
+    }
+
     if (source_surface->type == CAIRO_SURFACE_TYPE_RECORDING) {
 	if (source_surface->backend->type == CAIRO_SURFACE_TYPE_SUBSURFACE) {
 	    cairo_surface_subsurface_t *sub = (cairo_surface_subsurface_t *) source_surface;
@@ -3102,12 +3112,6 @@ _cairo_ps_surface_emit_surface (cairo_ps_surface_t      *surface,
 	}
     } else {
 	cairo_image_surface_t *image = (cairo_image_surface_t *) source_surface;
-	if (source_pattern->extend != CAIRO_EXTEND_PAD) {
-	    status = _cairo_ps_surface_emit_jpeg_image (surface, source_surface,
-							width, height);
-	    if (status != CAIRO_INT_STATUS_UNSUPPORTED)
-		return status;
-	}
 
 	status = _cairo_ps_surface_emit_image (surface, image,
 					       op, source_pattern->filter, stencil_mask);
commit 35e0a2685134602671f7eda9595c3bb70781062c
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Fri Sep 13 21:32:42 2013 +0930

    pdf: fix embedding of mime data that has been broken since 0a10982f
    
    For some reason the mime-data test is not detecting this failure.

diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 6580d5b..8536b9f 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -2637,6 +2637,18 @@ _cairo_pdf_surface_emit_image_surface (cairo_pdf_surface_t        *surface,
     cairo_int_status_t status;
 
     if (source->type == CAIRO_PATTERN_TYPE_SURFACE) {
+	if (!source->hash_entry->stencil_mask) {
+	    status = _cairo_pdf_surface_emit_jpx_image (surface, source->surface, source->hash_entry->surface_res);
+	    if (status != CAIRO_INT_STATUS_UNSUPPORTED)
+		return status;
+
+	    status = _cairo_pdf_surface_emit_jpeg_image (surface, source->surface, source->hash_entry->surface_res);
+	    if (status != CAIRO_INT_STATUS_UNSUPPORTED)
+		return status;
+	}
+    }
+
+    if (source->type == CAIRO_PATTERN_TYPE_SURFACE) {
 	status = _cairo_surface_acquire_source_image (source->surface, &image, &image_extra);
     } else {
 	status = _cairo_pdf_surface_acquire_source_image_from_pattern (surface, source->raster_pattern,
@@ -2645,22 +2657,11 @@ _cairo_pdf_surface_emit_image_surface (cairo_pdf_surface_t        *surface,
     if (unlikely (status))
 	return status;
 
-    if (!source->hash_entry->stencil_mask) {
-	status = _cairo_pdf_surface_emit_jpx_image (surface, &image->base, source->hash_entry->surface_res);
-	if (status != CAIRO_INT_STATUS_UNSUPPORTED)
-	    goto release_source;
-
-	status = _cairo_pdf_surface_emit_jpeg_image (surface, &image->base, source->hash_entry->surface_res);
-	if (status != CAIRO_INT_STATUS_UNSUPPORTED)
-	    goto release_source;
-    }
-
     status = _cairo_pdf_surface_emit_image (surface, image,
 					    &source->hash_entry->surface_res,
 					    source->hash_entry->interpolate,
 					    source->hash_entry->stencil_mask);
 
-release_source:
     if (source->type == CAIRO_PATTERN_TYPE_SURFACE)
 	_cairo_surface_release_source_image (source->surface, image, image_extra);
     else
commit 3b3202dc0006dccafdb9310a83ce1fc586c4df88
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Fri Sep 6 08:00:46 2013 +0930

    svg: Don't embed CMYK Jpeg images
    
    None of the SVG viewers I tried (rsvg, firefox, inkscape) support CMYK
    Jpeg images.
    
    Bug 68965

diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 5ee2857..c901830 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -1118,6 +1118,9 @@ _cairo_surface_base64_encode_jpeg (cairo_surface_t       *surface,
     if (unlikely (status))
 	return status;
 
+    if (image_info.num_components == 4)
+	return CAIRO_INT_STATUS_UNSUPPORTED;
+
     _cairo_output_stream_printf (output, "data:image/jpeg;base64,");
 
     info.output = output;


More information about the cairo-commit mailing list