summaryrefslogtreecommitdiff
path: root/extra/cairo
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2013-02-10 01:12:52 -0800
committerroot <root@rshg054.dnsready.net>2013-02-10 01:12:52 -0800
commit1bb2648cde916ac27d3dd75d7b64a4ddc89787b7 (patch)
tree016bfa1969323404c37dbef29cfc7242a5a8e9f3 /extra/cairo
parente9c244cac8e5dc1c59c7e8b7bc885fef04224b70 (diff)
Sun Feb 10 01:12:35 PST 2013
Diffstat (limited to 'extra/cairo')
-rw-r--r--extra/cairo/cairo-1.10.0-buggy_gradients.patch13
-rw-r--r--extra/cairo/cairo-1.12.2-ignore-charset-for-non-cid-fonts.patch37
-rw-r--r--extra/cairo/cairo-1.12.2-reduce-broken-stopped-edge-continuation.patch275
-rw-r--r--extra/cairo/git_fixes.diff934
-rw-r--r--extra/cairo/git_fixes.patch1086
-rw-r--r--extra/cairo/revert-xlib-Simplify-source-creation-by-use-of-map-to-image.patch144
-rw-r--r--extra/cairo/revert-xlib-map-to-image-requires-an-extents.patch24
7 files changed, 0 insertions, 2513 deletions
diff --git a/extra/cairo/cairo-1.10.0-buggy_gradients.patch b/extra/cairo/cairo-1.10.0-buggy_gradients.patch
deleted file mode 100644
index 368e356d3..000000000
--- a/extra/cairo/cairo-1.10.0-buggy_gradients.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/src/cairo-xlib-display.c.ubuntu 2010-08-04 11:57:49.000000000 +0200
-+++ b/src/cairo-xlib-display.c 2010-08-04 11:58:28.000000000 +0200
-@@ -353,11 +353,7 @@
- /* Prior to Render 0.10, there is no protocol support for gradients and
- * we call function stubs instead, which would silently consume the drawing.
- */
--#if RENDER_MAJOR == 0 && RENDER_MINOR < 10
- display->buggy_gradients = TRUE;
--#else
-- display->buggy_gradients = FALSE;
--#endif
- display->buggy_pad_reflect = FALSE;
- display->buggy_repeat = FALSE;
diff --git a/extra/cairo/cairo-1.12.2-ignore-charset-for-non-cid-fonts.patch b/extra/cairo/cairo-1.12.2-ignore-charset-for-non-cid-fonts.patch
deleted file mode 100644
index e43a10312..000000000
--- a/extra/cairo/cairo-1.12.2-ignore-charset-for-non-cid-fonts.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 2f1d6b27e8b78c77346a5b603114b54400e57d83 Mon Sep 17 00:00:00 2001
-From: Adrian Johnson <ajohnson@redneon.com>
-Date: Thu, 07 Jun 2012 09:48:52 +0000
-Subject: cff-subsetting: Ignore charset for non cid fonts
-
-Fixes crash in https://bugzilla.gnome.org/show_bug.cgi?id=677422
----
-diff --git a/src/cairo-cff-subset.c b/src/cairo-cff-subset.c
-index db6fdf7..6f0cd66 100644
---- a/src/cairo-cff-subset.c
-+++ b/src/cairo-cff-subset.c
-@@ -1178,14 +1178,16 @@ cairo_cff_font_read_top_dict (cairo_cff_font_t *font)
- goto fail;
- font->num_glyphs = _cairo_array_num_elements (&font->charstrings_index);
-
-- operand = cff_dict_get_operands (font->top_dict, CHARSET_OP, &size);
-- if (font->is_cid && !operand)
-- return CAIRO_INT_STATUS_UNSUPPORTED;
-+ if (font->is_cid) {
-+ operand = cff_dict_get_operands (font->top_dict, CHARSET_OP, &size);
-+ if (!operand)
-+ return CAIRO_INT_STATUS_UNSUPPORTED;
-
-- decode_integer (operand, &offset);
-- font->charset = font->data + offset;
-- if (font->charset >= font->data_end)
-- return CAIRO_INT_STATUS_UNSUPPORTED;
-+ decode_integer (operand, &offset);
-+ font->charset = font->data + offset;
-+ if (font->charset >= font->data_end)
-+ return CAIRO_INT_STATUS_UNSUPPORTED;
-+ }
-
- if (!font->is_opentype)
- cairo_cff_font_read_font_metrics (font, font->top_dict);
---
-cgit v0.9.0.2-2-gbebe
diff --git a/extra/cairo/cairo-1.12.2-reduce-broken-stopped-edge-continuation.patch b/extra/cairo/cairo-1.12.2-reduce-broken-stopped-edge-continuation.patch
deleted file mode 100644
index e3bb30580..000000000
--- a/extra/cairo/cairo-1.12.2-reduce-broken-stopped-edge-continuation.patch
+++ /dev/null
@@ -1,275 +0,0 @@
-From f228769dfe5a8b5d73c49a41e95e31ed73a77fb3 Mon Sep 17 00:00:00 2001
-From: Chris Wilson <chris@chris-wilson.co.uk>
-Date: Fri, 08 Jun 2012 16:22:41 +0000
-Subject: polygon-reduce: Reduce broken stopped-edge continuation
-
-This is hopefully a lesser used path and the attempted optimisation to
-continue a stopped edge with a colinear stopped edge highly unlikely and
-lost in the noise of the general inefficiency of the routine. As it was
-broken, rather than attempt to rectify the "optimisation" remove it.
-
-Reported-by: Evangelos Foutras <evangelos@foutrelis.com>
-Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50852
-Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
----
-diff --git a/src/cairo-polygon-reduce.c b/src/cairo-polygon-reduce.c
-index 8758070..ea457fe 100644
---- a/src/cairo-polygon-reduce.c
-+++ b/src/cairo-polygon-reduce.c
-@@ -42,6 +42,8 @@
- #include "cairo-freelist-private.h"
- #include "cairo-combsort-inline.h"
-
-+#define DEBUG_POLYGON 0
-+
- typedef cairo_point_t cairo_bo_point32_t;
-
- typedef struct _cairo_bo_intersect_ordinate {
-@@ -114,7 +116,6 @@ typedef struct _cairo_bo_event_queue {
-
- typedef struct _cairo_bo_sweep_line {
- cairo_bo_edge_t *head;
-- cairo_bo_edge_t *stopped;
- int32_t current_y;
- cairo_bo_edge_t *current_edge;
- } cairo_bo_sweep_line_t;
-@@ -476,8 +477,8 @@ edges_compare_x_for_y (const cairo_bo_edge_t *a,
- static inline int
- _line_equal (const cairo_line_t *a, const cairo_line_t *b)
- {
-- return a->p1.x == b->p1.x && a->p1.y == b->p1.y &&
-- a->p2.x == b->p2.x && a->p2.y == b->p2.y;
-+ return (a->p1.x == b->p1.x && a->p1.y == b->p1.y &&
-+ a->p2.x == b->p2.x && a->p2.y == b->p2.y);
- }
-
- static int
-@@ -1024,7 +1025,6 @@ static void
- _cairo_bo_sweep_line_init (cairo_bo_sweep_line_t *sweep_line)
- {
- sweep_line->head = NULL;
-- sweep_line->stopped = NULL;
- sweep_line->current_y = INT32_MIN;
- sweep_line->current_edge = NULL;
- }
-@@ -1139,6 +1139,8 @@ edges_colinear (const cairo_bo_edge_t *a, const cairo_bo_edge_t *b)
- */
- if (a->edge.line.p1.y == b->edge.line.p1.y) {
- return a->edge.line.p1.x == b->edge.line.p1.x;
-+ } else if (a->edge.line.p2.y == b->edge.line.p2.y) {
-+ return a->edge.line.p2.x == b->edge.line.p2.x;
- } else if (a->edge.line.p1.y < b->edge.line.p1.y) {
- return edge_compare_for_y_against_x (b,
- a->edge.line.p1.y,
-@@ -1205,82 +1207,48 @@ _active_edges_to_polygon (cairo_bo_edge_t *left,
- cairo_polygon_t *polygon)
- {
- cairo_bo_edge_t *right;
-+ unsigned int mask;
-
-- if (fill_rule == CAIRO_FILL_RULE_WINDING) {
-- while (left != NULL) {
-- int in_out = left->edge.dir;
--
-- right = left->next;
-- if (left->deferred.right == NULL) {
-- while (right != NULL && right->deferred.right == NULL)
-- right = right->next;
--
-- if (right != NULL && edges_colinear (left, right)) {
-- /* continuation on left */
-- left->deferred = right->deferred;
-- right->deferred.right = NULL;
-- }
-- }
--
-- right = left->next;
-- while (right != NULL) {
-- if (right->deferred.right != NULL)
-- _cairo_bo_edge_end (right, top, polygon);
--
-- in_out += right->edge.dir;
-- if (in_out == 0) {
-- cairo_bo_edge_t *next;
-- cairo_bool_t skip = FALSE;
--
-- /* skip co-linear edges */
-- next = right->next;
-- if (next != NULL)
-- skip = edges_colinear (right, next);
-+ if (fill_rule == CAIRO_FILL_RULE_WINDING)
-+ mask = ~0;
-+ else
-+ mask = 1;
-
-- if (! skip)
-- break;
-- }
-+ while (left != NULL) {
-+ int in_out = left->edge.dir;
-
-+ right = left->next;
-+ if (left->deferred.right == NULL) {
-+ while (right != NULL && right->deferred.right == NULL)
- right = right->next;
-- }
--
-- _cairo_bo_edge_start_or_continue (left, right, top, polygon);
-
-- left = right;
-- if (left != NULL)
-- left = left->next;
-+ if (right != NULL && edges_colinear (left, right)) {
-+ /* continuation on left */
-+ left->deferred = right->deferred;
-+ right->deferred.right = NULL;
-+ }
- }
-- } else {
-- while (left != NULL) {
-- int in_out = 0;
-
-- right = left->next;
-- while (right != NULL) {
-- if (right->deferred.right != NULL)
-- _cairo_bo_edge_end (right, top, polygon);
-+ right = left->next;
-+ while (right != NULL) {
-+ if (right->deferred.right != NULL)
-+ _cairo_bo_edge_end (right, top, polygon);
-
-- if ((in_out++ & 1) == 0) {
-- cairo_bo_edge_t *next;
-- cairo_bool_t skip = FALSE;
--
-- /* skip co-linear edges */
-- next = right->next;
-- if (next != NULL)
-- skip = edges_colinear (right, next);
--
-- if (! skip)
-- break;
-- }
--
-- right = right->next;
-+ in_out += right->edge.dir;
-+ if ((in_out & mask) == 0) {
-+ /* skip co-linear edges */
-+ if (right->next == NULL || !edges_colinear (right, right->next))
-+ break;
- }
-
-- _cairo_bo_edge_start_or_continue (left, right, top, polygon);
--
-- left = right;
-- if (left != NULL)
-- left = left->next;
-+ right = right->next;
- }
-+
-+ _cairo_bo_edge_start_or_continue (left, right, top, polygon);
-+
-+ left = right;
-+ if (left != NULL)
-+ left = left->next;
- }
- }
-
-@@ -1303,12 +1271,6 @@ _cairo_bentley_ottmann_tessellate_bo_edges (cairo_bo_event_t **start_events,
-
- while ((event = _cairo_bo_event_dequeue (&event_queue))) {
- if (event->point.y != sweep_line.current_y) {
-- for (e1 = sweep_line.stopped; e1; e1 = e1->next) {
-- if (e1->deferred.right != NULL)
-- _cairo_bo_edge_end (e1, e1->edge.bottom, polygon);
-- }
-- sweep_line.stopped = NULL;
--
- _active_edges_to_polygon (sweep_line.head,
- sweep_line.current_y,
- fill_rule, polygon);
-@@ -1328,23 +1290,6 @@ _cairo_bentley_ottmann_tessellate_bo_edges (cairo_bo_event_t **start_events,
- if (unlikely (status))
- goto unwind;
-
-- /* check to see if this is a continuation of a stopped edge */
-- /* XXX change to an infinitesimal lengthening rule */
-- for (left = sweep_line.stopped; left; left = left->next) {
-- if (e1->edge.top <= left->edge.bottom &&
-- edges_colinear (e1, left))
-- {
-- e1->deferred = left->deferred;
-- if (left->prev != NULL)
-- left->prev = left->next;
-- else
-- sweep_line.stopped = left->next;
-- if (left->next != NULL)
-- left->next->prev = left->prev;
-- break;
-- }
-- }
--
- left = e1->prev;
- right = e1->next;
-
-@@ -1371,14 +1316,8 @@ _cairo_bentley_ottmann_tessellate_bo_edges (cairo_bo_event_t **start_events,
-
- _cairo_bo_sweep_line_delete (&sweep_line, e1);
-
-- /* first, check to see if we have a continuation via a fresh edge */
-- if (e1->deferred.right != NULL) {
-- e1->next = sweep_line.stopped;
-- if (sweep_line.stopped != NULL)
-- sweep_line.stopped->prev = e1;
-- sweep_line.stopped = e1;
-- e1->prev = NULL;
-- }
-+ if (e1->deferred.right != NULL)
-+ _cairo_bo_edge_end (e1, e1->edge.bottom, polygon);
-
- if (left != NULL && right != NULL) {
- status = _cairo_bo_event_queue_insert_if_intersect_below_current_y (&event_queue, left, right);
-@@ -1420,10 +1359,6 @@ _cairo_bentley_ottmann_tessellate_bo_edges (cairo_bo_event_t **start_events,
- }
- }
-
-- for (e1 = sweep_line.stopped; e1; e1 = e1->next) {
-- if (e1->deferred.right != NULL)
-- _cairo_bo_edge_end (e1, e1->edge.bottom, polygon);
-- }
- unwind:
- _cairo_bo_event_queue_fini (&event_queue);
-
-@@ -1447,6 +1382,12 @@ _cairo_polygon_reduce (cairo_polygon_t *polygon,
- if (unlikely (0 == num_events))
- return CAIRO_STATUS_SUCCESS;
-
-+ if (DEBUG_POLYGON) {
-+ FILE *file = fopen ("reduce_in.txt", "w");
-+ _cairo_debug_print_polygon (file, polygon);
-+ fclose (file);
-+ }
-+
- events = stack_events;
- event_ptrs = stack_event_ptrs;
- if (num_events > ARRAY_LENGTH (stack_events)) {
-@@ -1482,10 +1423,16 @@ _cairo_polygon_reduce (cairo_polygon_t *polygon,
- num_events,
- fill_rule,
- polygon);
-- polygon->num_limits = num_limits;
-+ polygon->num_limits = num_limits;
-
- if (events != stack_events)
- free (events);
-
-+ if (DEBUG_POLYGON) {
-+ FILE *file = fopen ("reduce_out.txt", "w");
-+ _cairo_debug_print_polygon (file, polygon);
-+ fclose (file);
-+ }
-+
- return status;
- }
---
-cgit v0.9.0.2-2-gbebe
diff --git a/extra/cairo/git_fixes.diff b/extra/cairo/git_fixes.diff
deleted file mode 100644
index 3fc7ff659..000000000
--- a/extra/cairo/git_fixes.diff
+++ /dev/null
@@ -1,934 +0,0 @@
-From e43f53bf7f3d371116f31f22ab9754b08b5abe7f Mon Sep 17 00:00:00 2001
-From: Chris Wilson <chris@chris-wilson.co.uk>
-Date: Mon, 22 Oct 2012 12:47:11 +0000
-Subject: version: Post release bump to 1.12.7
-
----
-diff --git a/cairo-version.h b/cairo-version.h
-index dc89a19..c685909 100644
---- a/cairo-version.h
-+++ b/cairo-version.h
-@@ -3,6 +3,6 @@
-
- #define CAIRO_VERSION_MAJOR 1
- #define CAIRO_VERSION_MINOR 12
--#define CAIRO_VERSION_MICRO 6
-+#define CAIRO_VERSION_MICRO 7
-
- #endif
---
-cgit v0.9.0.2-2-gbebe
-From 00feb8ce530a472abbde445b52d9ae8c99ec97f0 Mon Sep 17 00:00:00 2001
-From: Chris Wilson <chris@chris-wilson.co.uk>
-Date: Fri, 26 Oct 2012 09:51:31 +0000
-Subject: xlib/shm: Sanity check that the server handles XSendEvent with ShmCompletion
-
-Uli Schlachter suggested it would be wiser to complement our blacklist
-of known broken X/libXext with an explicit roundtrip to check for a
-BadValue error return when we try to use XSendEvent.
-
-Suggested-by: Uli Schlachter <psychon@znc.in>
-Reported-by: Martin Husemann <martin@duskware.de>
-Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
----
-diff --git a/src/cairo-xlib-surface-shm.c b/src/cairo-xlib-surface-shm.c
-index ec0d334..17594b1 100644
---- a/src/cairo-xlib-surface-shm.c
-+++ b/src/cairo-xlib-surface-shm.c
-@@ -1128,8 +1128,60 @@ _cairo_xlib_shm_surface_is_idle (cairo_surface_t *surface)
- (((major) * 10000000) + ((minor) * 100000) + ((patch) * 1000) + snap)
-
- static cairo_bool_t
--xorg_has_buggy_send_shm_completion_event(Display *dpy)
-+has_broken_send_shm_event (cairo_xlib_display_t *display,
-+ cairo_xlib_shm_display_t *shm)
- {
-+ Display *dpy = display->display;
-+ int (*old_handler) (Display *display, XErrorEvent *event);
-+ XShmCompletionEvent ev;
-+ XShmSegmentInfo info;
-+
-+ info.shmid = shmget (IPC_PRIVATE, 0x1000, IPC_CREAT | 0600);
-+ if (info.shmid == -1)
-+ return TRUE;
-+
-+ info.readOnly = FALSE;
-+ info.shmaddr = shmat (info.shmid, NULL, 0);
-+ if (info.shmaddr == (char *) -1) {
-+ shmctl (info.shmid, IPC_RMID, NULL);
-+ return TRUE;
-+ }
-+
-+ ev.type = shm->event;
-+ ev.drawable = shm->window;
-+ ev.major_code = shm->opcode;
-+ ev.minor_code = X_ShmPutImage;
-+
-+ ev.shmseg = info.shmid;
-+ ev.offset = 0;
-+
-+ assert (CAIRO_MUTEX_IS_LOCKED (_cairo_xlib_display_mutex));
-+ _x_error_occurred = FALSE;
-+
-+ XLockDisplay (dpy);
-+ XSync (dpy, False);
-+ old_handler = XSetErrorHandler (_check_error_handler);
-+
-+ XShmAttach (dpy, &info);
-+ XSendEvent (dpy, ev.drawable, False, 0, (XEvent *)&ev);
-+ XShmDetach (dpy, &info);
-+
-+ XSync (dpy, False);
-+ XSetErrorHandler (old_handler);
-+ XUnlockDisplay (dpy);
-+
-+ shmctl (info.shmid, IPC_RMID, NULL);
-+ shmdt (info.shmaddr);
-+
-+ return _x_error_occurred;
-+}
-+
-+static cairo_bool_t
-+xorg_has_buggy_send_shm_completion_event(cairo_xlib_display_t *display,
-+ cairo_xlib_shm_display_t *shm)
-+{
-+ Display *dpy = display->display;
-+
- /* As libXext sets the SEND_EVENT bit in the ShmCompletionEvent,
- * the Xserver may crash if it does not take care when processing
- * the event type. For instance versions of Xorg prior to 1.11.1
-@@ -1141,8 +1193,12 @@ xorg_has_buggy_send_shm_completion_event(Display *dpy)
- *
- * Remove the SendEvent bit (0x80) before doing range checks on event type.
- */
-- return (strstr (ServerVendor (dpy), "X.Org") != NULL &&
-- VendorRelease (dpy) < XORG_VERSION_ENCODE(1,11,0,1));
-+ if (strstr (ServerVendor (dpy), "X.Org") != NULL &&
-+ VendorRelease (dpy) < XORG_VERSION_ENCODE(1,11,0,1))
-+ return TRUE;
-+
-+ /* For everyone else check that no error is generated */
-+ return has_broken_send_shm_event (display, shm);
- }
-
- void
-@@ -1162,6 +1218,15 @@ _cairo_xlib_display_init_shm (cairo_xlib_display_t *display)
- if (unlikely (shm == NULL))
- return;
-
-+ codes = XInitExtension (display->display, SHMNAME);
-+ if (codes == NULL) {
-+ free (shm);
-+ return;
-+ }
-+
-+ shm->opcode = codes ->major_opcode;
-+ shm->event = codes->first_event;
-+
- if (unlikely (_pqueue_init (&shm->info))) {
- free (shm);
- return;
-@@ -1177,16 +1242,12 @@ _cairo_xlib_display_init_shm (cairo_xlib_display_t *display)
- DefaultVisual (display->display, scr),
- CWOverrideRedirect, &attr);
-
-- if (xorg_has_buggy_send_shm_completion_event(display->display))
-+ if (xorg_has_buggy_send_shm_completion_event(display, shm))
- has_pixmap = 0;
-
- shm->has_pixmaps = has_pixmap ? MIN_PIXMAP_SIZE : 0;
- cairo_list_init (&shm->pool);
-
-- codes = XInitExtension (display->display, SHMNAME);
-- shm->opcode = codes ->major_opcode;
-- shm->event = codes->first_event;
--
- cairo_list_init (&shm->surfaces);
-
- display->shm = shm;
---
-cgit v0.9.0.2-2-gbebe
-From fdd2082f923012a1354be7086d03f78fb166695b Mon Sep 17 00:00:00 2001
-From: Chris Wilson <chris@chris-wilson.co.uk>
-Date: Fri, 26 Oct 2012 09:51:31 +0000
-Subject: xlib: Check for both X.org and Xorg ServerVendors
-
-Martin Husemann reported that on his NetBSD machine the vendor was being
-reported as "The Xorg Foundation", a non-conformist separatist split of
-the Peoples' Liberation Army^W^W^W "The X.Org Foundation". Simply check
-for both during initialisation.
-
-Reported-by: Martin Husemann <martin@duskware.de>
-Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
----
-diff --git a/src/cairo-xlib-display.c b/src/cairo-xlib-display.c
-index 67c0673..04c89b2 100644
---- a/src/cairo-xlib-display.c
-+++ b/src/cairo-xlib-display.c
-@@ -315,7 +315,7 @@ _cairo_xlib_device_create (Display *dpy)
- * safest to just blacklist all old-versioning-scheme X servers,
- * (just using VendorRelease < 70000000), as buggy_repeat=TRUE.
- */
-- if (strstr (ServerVendor (dpy), "X.Org") != NULL) {
-+ if (_cairo_xlib_vendor_is_xorg (dpy)) {
- if (VendorRelease (dpy) >= 60700000) {
- if (VendorRelease (dpy) < 70000000)
- display->buggy_repeat = TRUE;
-diff --git a/src/cairo-xlib-private.h b/src/cairo-xlib-private.h
-index d2bd588..c328302 100644
---- a/src/cairo-xlib-private.h
-+++ b/src/cairo-xlib-private.h
-@@ -216,6 +216,13 @@ struct _cairo_xlib_proxy {
- cairo_surface_t *owner;
- };
-
-+inline static cairo_bool_t
-+_cairo_xlib_vendor_is_xorg (Display *dpy)
-+{
-+ const char *const vendor = ServerVendor (dpy);
-+ return strstr (vendor, "X.Org") || strstr (vendor, "Xorg");
-+}
-+
- cairo_private cairo_status_t
- _cairo_xlib_surface_get_gc (cairo_xlib_display_t *display,
- cairo_xlib_surface_t *surface,
-diff --git a/src/cairo-xlib-surface-shm.c b/src/cairo-xlib-surface-shm.c
-index 17594b1..89f51a9 100644
---- a/src/cairo-xlib-surface-shm.c
-+++ b/src/cairo-xlib-surface-shm.c
-@@ -1193,7 +1193,7 @@ xorg_has_buggy_send_shm_completion_event(cairo_xlib_display_t *display,
- *
- * Remove the SendEvent bit (0x80) before doing range checks on event type.
- */
-- if (strstr (ServerVendor (dpy), "X.Org") != NULL &&
-+ if (_cairo_xlib_vendor_is_xorg (dpy) &&
- VendorRelease (dpy) < XORG_VERSION_ENCODE(1,11,0,1))
- return TRUE;
-
---
-cgit v0.9.0.2-2-gbebe
-From d57e652f08f5ff7c334d01bc071962e6a131928f Mon Sep 17 00:00:00 2001
-From: Adrian Johnson <ajohnson@redneon.com>
-Date: Fri, 26 Oct 2012 12:30:01 +0000
-Subject: type1-subset: parse all operators
-
-The PDF at bug 56265 contained a Type 1 font that used the "div"
-operator to compute the glyph width. As the "div" operator was
-not handled by the charstring parser this resulted in an incorrect
-glyph width in the PDF output.
-
-Fix this by upgrading the charstring parsing to handle all Type 1
-operators.
----
-diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
-index 1bdb12b..c7f613a 100644
---- a/src/cairo-type1-subset.c
-+++ b/src/cairo-type1-subset.c
-@@ -137,13 +137,10 @@ typedef struct _cairo_type1_font_subset {
- int hex_column;
-
- struct {
-- int stack[TYPE1_STACKSIZE], sp, top_value;
-+ double stack[TYPE1_STACKSIZE];
-+ int sp;
- } build_stack;
-
-- struct {
-- int other_subr_args[TYPE1_STACKSIZE], num_other_subr_args, cur_other_subr_arg;
-- } ps_stack;
--
-
- } cairo_type1_font_subset_t;
-
-@@ -742,15 +739,33 @@ use_standard_encoding_glyph (cairo_type1_font_subset_t *font, int index)
- return CAIRO_INT_STATUS_UNSUPPORTED;
- }
-
--#define TYPE1_CHARSTRING_COMMAND_ESCAPE 0x0c
--#define TYPE1_CHARSTRING_COMMAND_SEAC 0x0c06
--#define TYPE1_CHARSTRING_COMMAND_SBW 0x0c07
--#define TYPE1_CHARSTRING_COMMAND_HSBW 0x0d
--#define TYPE1_CHARSTRING_COMMAND_CALLSUBR 0x0a
--#define TYPE1_CHARSTRING_COMMAND_CALLOTHERSUBR 0x0c10
--#define TYPE1_CHARSTRING_COMMAND_POP 0x0c11
--
-
-+#define TYPE1_CHARSTRING_COMMAND_HSTEM 0x01
-+#define TYPE1_CHARSTRING_COMMAND_VSTEM 0x03
-+#define TYPE1_CHARSTRING_COMMAND_VMOVETO 0x04
-+#define TYPE1_CHARSTRING_COMMAND_RLINETO 0x05
-+#define TYPE1_CHARSTRING_COMMAND_HLINETO 0x06
-+#define TYPE1_CHARSTRING_COMMAND_VLINETO 0x07
-+#define TYPE1_CHARSTRING_COMMAND_RRCURVETO 0x08
-+#define TYPE1_CHARSTRING_COMMAND_CLOSEPATH 0x09
-+#define TYPE1_CHARSTRING_COMMAND_CALLSUBR 0x0a
-+#define TYPE1_CHARSTRING_COMMAND_RETURN 0x0b
-+#define TYPE1_CHARSTRING_COMMAND_ESCAPE 0x0c
-+#define TYPE1_CHARSTRING_COMMAND_HSBW 0x0d
-+#define TYPE1_CHARSTRING_COMMAND_ENDCHAR 0x0e
-+#define TYPE1_CHARSTRING_COMMAND_RMOVETO 0x15
-+#define TYPE1_CHARSTRING_COMMAND_HMOVETO 0x16
-+#define TYPE1_CHARSTRING_COMMAND_VHCURVETO 0x1e
-+#define TYPE1_CHARSTRING_COMMAND_HVCURVETO 0x1f
-+#define TYPE1_CHARSTRING_COMMAND_DOTSECTION 0x0c00
-+#define TYPE1_CHARSTRING_COMMAND_VSTEM3 0x0c01
-+#define TYPE1_CHARSTRING_COMMAND_HSTEM3 0x0c02
-+#define TYPE1_CHARSTRING_COMMAND_SEAC 0x0c06
-+#define TYPE1_CHARSTRING_COMMAND_SBW 0x0c07
-+#define TYPE1_CHARSTRING_COMMAND_DIV 0x0c0c
-+#define TYPE1_CHARSTRING_COMMAND_CALLOTHERSUBR 0x0c10
-+#define TYPE1_CHARSTRING_COMMAND_POP 0x0c11
-+#define TYPE1_CHARSTRING_COMMAND_SETCURRENTPOINT 0x0c21
-
- /* Get glyph width and look for seac operatorParse charstring */
- static cairo_status_t
-@@ -765,7 +780,6 @@ cairo_type1_font_subset_parse_charstring (cairo_type1_font_subset_t *font,
- const unsigned char *p;
- cairo_bool_t last_op_was_integer;
- int command;
-- int subr_num, i;
-
- charstring = malloc (encrypted_charstring_length);
- if (unlikely (charstring == NULL))
-@@ -785,37 +799,60 @@ cairo_type1_font_subset_parse_charstring (cairo_type1_font_subset_t *font,
- if (*p < 32) {
- command = *p++;
- switch (command) {
-- case TYPE1_CHARSTRING_COMMAND_HSBW:
-- if (! last_op_was_integer)
-- return CAIRO_INT_STATUS_UNSUPPORTED;
--
-- font->glyphs[glyph].width = font->build_stack.stack[1]/font->base.units_per_em;
-+ case TYPE1_CHARSTRING_COMMAND_HSTEM:
-+ case TYPE1_CHARSTRING_COMMAND_VSTEM:
-+ case TYPE1_CHARSTRING_COMMAND_VMOVETO:
-+ case TYPE1_CHARSTRING_COMMAND_RLINETO:
-+ case TYPE1_CHARSTRING_COMMAND_HLINETO:
-+ case TYPE1_CHARSTRING_COMMAND_VLINETO:
-+ case TYPE1_CHARSTRING_COMMAND_RRCURVETO:
-+ case TYPE1_CHARSTRING_COMMAND_CLOSEPATH:
-+ case TYPE1_CHARSTRING_COMMAND_RMOVETO:
-+ case TYPE1_CHARSTRING_COMMAND_HMOVETO:
-+ case TYPE1_CHARSTRING_COMMAND_VHCURVETO:
-+ case TYPE1_CHARSTRING_COMMAND_HVCURVETO:
-+ case TYPE1_CHARSTRING_COMMAND_RETURN:
-+ case TYPE1_CHARSTRING_COMMAND_ENDCHAR:
-+ default:
- font->build_stack.sp = 0;
-- last_op_was_integer = FALSE;
- break;
-
- case TYPE1_CHARSTRING_COMMAND_CALLSUBR:
-- if (font->subset_subrs &&
-- last_op_was_integer &&
-- font->build_stack.top_value >= 0 &&
-- font->build_stack.top_value < font->num_subrs)
-- {
-- subr_num = font->build_stack.top_value;
-- font->build_stack.sp--;
-- font->subrs[subr_num].used = TRUE;
-- last_op_was_integer = FALSE;
-- status = cairo_type1_font_subset_parse_charstring (font,
-- glyph,
-- font->subrs[subr_num].subr_string,
-- font->subrs[subr_num].subr_length);
-- } else {
-- font->subset_subrs = FALSE;
-+ if (font->subset_subrs && font->build_stack.sp > 0) {
-+ int subr_num = font->build_stack.stack[--font->build_stack.sp];
-+ if (subr_num >= 0 && subr_num < font->num_subrs) {
-+ font->subrs[subr_num].used = TRUE;
-+ status = cairo_type1_font_subset_parse_charstring (
-+ font,
-+ glyph,
-+ font->subrs[subr_num].subr_string,
-+ font->subrs[subr_num].subr_length);
-+ break;
-+ }
- }
-+ font->subset_subrs = FALSE;
-+ break;
-+
-+ case TYPE1_CHARSTRING_COMMAND_HSBW:
-+ if (font->build_stack.sp < 2)
-+ return CAIRO_INT_STATUS_UNSUPPORTED;
-+
-+ font->glyphs[glyph].width = font->build_stack.stack[1]/font->base.units_per_em;
-+ font->build_stack.sp = 0;
- break;
-
- case TYPE1_CHARSTRING_COMMAND_ESCAPE:
- command = command << 8 | *p++;
- switch (command) {
-+ case TYPE1_CHARSTRING_COMMAND_DOTSECTION:
-+ case TYPE1_CHARSTRING_COMMAND_VSTEM3:
-+ case TYPE1_CHARSTRING_COMMAND_HSTEM3:
-+ case TYPE1_CHARSTRING_COMMAND_SETCURRENTPOINT:
-+ case TYPE1_CHARSTRING_COMMAND_CALLOTHERSUBR:
-+ default:
-+ font->build_stack.sp = 0;
-+ break;
-+
- case TYPE1_CHARSTRING_COMMAND_SEAC:
- /* The seac command takes five integer arguments. The
- * last two are glyph indices into the PS standard
-@@ -823,6 +860,9 @@ cairo_type1_font_subset_parse_charstring (cairo_type1_font_subset_t *font,
- * glyph is composed from. All we need to do is to
- * make sure those glyphs are present in the subset
- * under their standard names. */
-+ if (font->build_stack.sp < 5)
-+ return CAIRO_INT_STATUS_UNSUPPORTED;
-+
- status = use_standard_encoding_glyph (font, font->build_stack.stack[3]);
- if (unlikely (status))
- return status;
-@@ -832,55 +872,49 @@ cairo_type1_font_subset_parse_charstring (cairo_type1_font_subset_t *font,
- return status;
-
- font->build_stack.sp = 0;
-- last_op_was_integer = FALSE;
- break;
-
- case TYPE1_CHARSTRING_COMMAND_SBW:
-- if (! last_op_was_integer)
-+ if (font->build_stack.sp < 4)
- return CAIRO_INT_STATUS_UNSUPPORTED;
-
- font->glyphs[glyph].width = font->build_stack.stack[2]/font->base.units_per_em;
- font->build_stack.sp = 0;
-- last_op_was_integer = FALSE;
-- break;
--
-- case TYPE1_CHARSTRING_COMMAND_CALLOTHERSUBR:
-- for (i = 0; i < font->build_stack.sp; i++)
-- font->ps_stack.other_subr_args[i] = font->build_stack.stack[i];
-- font->ps_stack.num_other_subr_args = font->build_stack.sp;
-- font->ps_stack.cur_other_subr_arg = 0;
-- font->build_stack.sp = 0;
-- last_op_was_integer = FALSE;
- break;
-
-- case TYPE1_CHARSTRING_COMMAND_POP:
-- if (font->ps_stack.num_other_subr_args > font->ps_stack.cur_other_subr_arg) {
-- font->build_stack.top_value = font->ps_stack.other_subr_args[font->ps_stack.cur_other_subr_arg++];
-- last_op_was_integer = TRUE;
-+ case TYPE1_CHARSTRING_COMMAND_DIV:
-+ if (font->build_stack.sp < 2) {
-+ return CAIRO_INT_STATUS_UNSUPPORTED;
- } else {
-- font->subset_subrs = FALSE;
-+ double num1 = font->build_stack.stack[font->build_stack.sp - 2];
-+ double num2 = font->build_stack.stack[font->build_stack.sp - 1];
-+ font->build_stack.sp--;
-+ if (num2 == 0.0)
-+ return CAIRO_INT_STATUS_UNSUPPORTED;
-+
-+ font->build_stack.stack[font->build_stack.sp - 1] = num1/num2;
- }
- break;
-
-- default:
-- font->build_stack.sp = 0;
-- last_op_was_integer = FALSE;
-+ case TYPE1_CHARSTRING_COMMAND_POP:
-+ if (font->build_stack.sp < TYPE1_STACKSIZE) {
-+ /* use negative number to prevent it being used as a subr_num */
-+ font->build_stack.stack[font->build_stack.sp++] = -1.0;
-+ }
- break;
- }
- break;
--
-- default:
-- font->build_stack.sp = 0;
-- last_op_was_integer = FALSE;
-- break;
- }
-- } else {
-+ } else {
- /* integer argument */
-- p = cairo_type1_font_subset_decode_integer (p, &font->build_stack.top_value);
-- last_op_was_integer = TRUE;
-- if (font->build_stack.sp < TYPE1_STACKSIZE)
-- font->build_stack.stack[font->build_stack.sp++] = font->build_stack.top_value;
-- }
-+ if (font->build_stack.sp < TYPE1_STACKSIZE) {
-+ int val;
-+ p = cairo_type1_font_subset_decode_integer (p, &val);
-+ font->build_stack.stack[font->build_stack.sp++] = val;
-+ } else {
-+ return CAIRO_INT_STATUS_UNSUPPORTED;
-+ }
-+ }
- }
-
- free (charstring);
-@@ -1321,7 +1355,6 @@ skip_subrs:
- for (j = 0; j < font->num_glyphs; j++) {
- glyph = font->subset_index_to_glyphs[j];
- font->build_stack.sp = 0;
-- font->ps_stack.num_other_subr_args = 0;
- status = cairo_type1_font_subset_parse_charstring (font,
- glyph,
- font->glyphs[glyph].encrypted_charstring,
---
-cgit v0.9.0.2-2-gbebe
-From f18199fcfb3b052c198041fc05156ae3d9e6aee7 Mon Sep 17 00:00:00 2001
-From: Chris Wilson <chris@chris-wilson.co.uk>
-Date: Sun, 28 Oct 2012 10:04:12 +0000
-Subject: xlib/shm: Check for XShm headers
-
-Not all version of libXext ship the same set of headers, so play safe
-and check during configure that we have the headers we depend upon in
-the code.
-
-Reported-by: Sebastian Haas <sehaas@gmail.com>
-Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
----
-diff --git a/configure.ac b/configure.ac
-index 7adbeb1..021ec8e 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -105,6 +105,10 @@ CAIRO_ENABLE_SURFACE_BACKEND(xlib, Xlib, auto, [
- AC_MSG_RESULT(no),
- AC_MSG_RESULT(assuming no))
- fi
-+
-+ AC_CHECK_HEADERS([X11/extensions/XShm.h X11/extensions/shmproto.h], [], [],
-+ [#include <X11/Xlibint.h>
-+ #include <X11/Xproto.h>])
- ])
-
- CAIRO_ENABLE_SURFACE_BACKEND(xlib_xrender, Xlib Xrender, auto, [
-diff --git a/src/cairo-xlib-surface-shm.c b/src/cairo-xlib-surface-shm.c
-index 89f51a9..a3d4385 100644
---- a/src/cairo-xlib-surface-shm.c
-+++ b/src/cairo-xlib-surface-shm.c
-@@ -41,12 +41,105 @@
-
- #include "cairo-xlib-private.h"
- #include "cairo-xlib-surface-private.h"
--#include "cairo-image-surface-private.h"
--#include "cairo-mempool-private.h"
-+
-+#if !HAVE_X11_EXTENSIONS_XSHM_H || !HAVE_X11_EXTENSIONS_SHMPROTO_H
-+void _cairo_xlib_display_init_shm (cairo_xlib_display_t *display) {}
-+
-+cairo_surface_t *
-+_cairo_xlib_surface_get_shm (cairo_xlib_surface_t *surface,
-+ cairo_bool_t overwrite)
-+{
-+ return NULL;
-+}
-+
-+cairo_int_status_t
-+_cairo_xlib_surface_put_shm (cairo_xlib_surface_t *surface)
-+{
-+ ASSERT_NOT_REACHED;
-+ return CAIRO_INT_STATUS_SUCCESS;
-+}
-+
-+cairo_surface_t *
-+_cairo_xlib_surface_create_shm (cairo_xlib_surface_t *other,
-+ pixman_format_code_t format,
-+ int width, int height)
-+{
-+ return NULL;
-+}
-+
-+cairo_surface_t *
-+_cairo_xlib_surface_create_shm__image (cairo_xlib_surface_t *surface,
-+ pixman_format_code_t format,
-+ int width, int height)
-+{
-+ return NULL;
-+}
-+
-+cairo_surface_t *
-+_cairo_xlib_surface_create_similar_shm (void *other,
-+ cairo_format_t format,
-+ int width, int height)
-+{
-+ return cairo_image_surface_create (format, width, height);
-+}
-+
-+void
-+_cairo_xlib_shm_surface_mark_active (cairo_surface_t *_shm)
-+{
-+ ASSERT_NOT_REACHED;
-+}
-+
-+void
-+_cairo_xlib_shm_surface_get_ximage (cairo_surface_t *surface,
-+ XImage *ximage)
-+{
-+ ASSERT_NOT_REACHED;
-+}
-+
-+void *
-+_cairo_xlib_shm_surface_get_obdata (cairo_surface_t *surface)
-+{
-+ ASSERT_NOT_REACHED;
-+ return NULL;
-+}
-+
-+Pixmap
-+_cairo_xlib_shm_surface_get_pixmap (cairo_surface_t *surface)
-+{
-+ ASSERT_NOT_REACHED;
-+ return 0;
-+}
-+
-+XRenderPictFormat *
-+_cairo_xlib_shm_surface_get_xrender_format (cairo_surface_t *surface)
-+{
-+ ASSERT_NOT_REACHED;
-+ return NULL;
-+}
-+
-+cairo_bool_t
-+_cairo_xlib_shm_surface_is_active (cairo_surface_t *surface)
-+{
-+ ASSERT_NOT_REACHED;
-+ return FALSE;
-+}
-+
-+cairo_bool_t
-+_cairo_xlib_shm_surface_is_idle (cairo_surface_t *surface)
-+{
-+ ASSERT_NOT_REACHED;
-+ return TRUE;
-+}
-+
-+void _cairo_xlib_display_fini_shm (cairo_xlib_display_t *display) {}
-+
-+#else
-
- #include "cairo-damage-private.h"
- #include "cairo-default-context-private.h"
-+#include "cairo-image-surface-private.h"
- #include "cairo-list-inline.h"
-+#include "cairo-mempool-private.h"
-
- #include <X11/Xlibint.h>
- #include <X11/Xproto.h>
-@@ -1281,5 +1374,5 @@ _cairo_xlib_display_fini_shm (cairo_xlib_display_t *display)
- free (shm);
- display->shm = NULL;
- }
--
-+#endif
- #endif
---
-cgit v0.9.0.2-2-gbebe
-From 0e2458697848cf8c89c9d57fa9b64f0ea7bd0877 Mon Sep 17 00:00:00 2001
-From: Chris Wilson <chris@chris-wilson.co.uk>
-Date: Sun, 28 Oct 2012 10:08:39 +0000
-Subject: xlib/shm: Use shmstr.h instead of shmproto.h if available
-
-Before it was known as shmproto.h, the wire protocol definition was to
-be found in shmstr.h, so if we don't have the current version of libXext
-try to use the older includes.
-
-Reported-by: Sebastian Haas <sehaas@gmail.com>
-Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
----
-diff --git a/configure.ac b/configure.ac
-index 021ec8e..f523284 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -106,7 +106,7 @@ CAIRO_ENABLE_SURFACE_BACKEND(xlib, Xlib, auto, [
- AC_MSG_RESULT(assuming no))
- fi
-
-- AC_CHECK_HEADERS([X11/extensions/XShm.h X11/extensions/shmproto.h], [], [],
-+ AC_CHECK_HEADERS([X11/extensions/XShm.h X11/extensions/shmproto.h X11/extensions/shmstr.h], [], [],
- [#include <X11/Xlibint.h>
- #include <X11/Xproto.h>])
- ])
-diff --git a/src/cairo-xlib-surface-shm.c b/src/cairo-xlib-surface-shm.c
-index a3d4385..44e6284 100644
---- a/src/cairo-xlib-surface-shm.c
-+++ b/src/cairo-xlib-surface-shm.c
-@@ -42,7 +42,7 @@
- #include "cairo-xlib-private.h"
- #include "cairo-xlib-surface-private.h"
-
--#if !HAVE_X11_EXTENSIONS_XSHM_H || !HAVE_X11_EXTENSIONS_SHMPROTO_H
-+#if !HAVE_X11_EXTENSIONS_XSHM_H || !(HAVE_X11_EXTENSIONS_SHMPROTO_H || HAVE_X11_EXTENSIONS_SHMSTR_H)
- void _cairo_xlib_display_init_shm (cairo_xlib_display_t *display) {}
-
- cairo_surface_t *
-@@ -144,7 +144,11 @@ void _cairo_xlib_display_fini_shm (cairo_xlib_display_t *display) {}
- #include <X11/Xlibint.h>
- #include <X11/Xproto.h>
- #include <X11/extensions/XShm.h>
-+#if HAVE_X11_EXTENSIONS_SHMPROTO_H
- #include <X11/extensions/shmproto.h>
-+#elif HAVE_X11_EXTENSIONS_SHMSTR_H
-+#include <X11/extensions/shmstr.h>
-+#endif
- #include <sys/ipc.h>
- #include <sys/shm.h>
-
---
-cgit v0.9.0.2-2-gbebe
-From 5a6e1d680a5bf1c4091e74f999abd611abd92334 Mon Sep 17 00:00:00 2001
-From: Adrian Johnson <ajohnson@redneon.com>
-Date: Sun, 28 Oct 2012 10:28:52 +0000
-Subject: type1-subset: restore correct callothersub behavior
-
-that was removed in d57e652f. Without this subsetting of subroutines
-won't work for some fonts.
----
-diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
-index c7f613a..786055a 100644
---- a/src/cairo-type1-subset.c
-+++ b/src/cairo-type1-subset.c
-@@ -141,6 +141,11 @@ typedef struct _cairo_type1_font_subset {
- int sp;
- } build_stack;
-
-+ struct {
-+ int stack[TYPE1_STACKSIZE];
-+ int sp;
-+ } ps_stack;
-+
-
- } cairo_type1_font_subset_t;
-
-@@ -767,7 +772,9 @@ use_standard_encoding_glyph (cairo_type1_font_subset_t *font, int index)
- #define TYPE1_CHARSTRING_COMMAND_POP 0x0c11
- #define TYPE1_CHARSTRING_COMMAND_SETCURRENTPOINT 0x0c21
-
--/* Get glyph width and look for seac operatorParse charstring */
-+/* Parse the charstring, including recursing into subroutines. Find
-+ * the glyph width, subroutines called, and glyphs required by the
-+ * SEAC operator. */
- static cairo_status_t
- cairo_type1_font_subset_parse_charstring (cairo_type1_font_subset_t *font,
- int glyph,
-@@ -814,6 +821,7 @@ cairo_type1_font_subset_parse_charstring (cairo_type1_font_subset_t *font,
- case TYPE1_CHARSTRING_COMMAND_RETURN:
- case TYPE1_CHARSTRING_COMMAND_ENDCHAR:
- default:
-+ /* stack clearing operator */
- font->build_stack.sp = 0;
- break;
-
-@@ -848,8 +856,8 @@ cairo_type1_font_subset_parse_charstring (cairo_type1_font_subset_t *font,
- case TYPE1_CHARSTRING_COMMAND_VSTEM3:
- case TYPE1_CHARSTRING_COMMAND_HSTEM3:
- case TYPE1_CHARSTRING_COMMAND_SETCURRENTPOINT:
-- case TYPE1_CHARSTRING_COMMAND_CALLOTHERSUBR:
- default:
-+ /* stack clearing operator */
- font->build_stack.sp = 0;
- break;
-
-@@ -896,11 +904,25 @@ cairo_type1_font_subset_parse_charstring (cairo_type1_font_subset_t *font,
- }
- break;
-
-+ case TYPE1_CHARSTRING_COMMAND_CALLOTHERSUBR:
-+ if (font->build_stack.sp < 1)
-+ return CAIRO_INT_STATUS_UNSUPPORTED;
-+
-+ font->build_stack.sp--;
-+ font->ps_stack.sp = 0;
-+ while (font->build_stack.sp)
-+ font->ps_stack.stack[font->ps_stack.sp++] = font->build_stack.stack[--font->build_stack.sp];
-+
-+ break;
-+
- case TYPE1_CHARSTRING_COMMAND_POP:
-- if (font->build_stack.sp < TYPE1_STACKSIZE) {
-- /* use negative number to prevent it being used as a subr_num */
-- font->build_stack.stack[font->build_stack.sp++] = -1.0;
-- }
-+ if (font->ps_stack.sp < 1)
-+ return CAIRO_INT_STATUS_UNSUPPORTED;
-+
-+ /* T1 spec states that if the interpreter does not
-+ * support executing the callothersub, the results
-+ * must be taken from the callothersub arguments. */
-+ font->build_stack.stack[font->build_stack.sp++] = font->ps_stack.stack[--font->ps_stack.sp];
- break;
- }
- break;
-@@ -1355,6 +1377,7 @@ skip_subrs:
- for (j = 0; j < font->num_glyphs; j++) {
- glyph = font->subset_index_to_glyphs[j];
- font->build_stack.sp = 0;
-+ font->ps_stack.sp = 0;
- status = cairo_type1_font_subset_parse_charstring (font,
- glyph,
- font->glyphs[glyph].encrypted_charstring,
---
-cgit v0.9.0.2-2-gbebe
-From 0c800dc3f64ee030df1cd0a6a1dcd6df71502dea Mon Sep 17 00:00:00 2001
-From: Adrian Johnson <ajohnson@redneon.com>
-Date: Tue, 30 Oct 2012 08:53:30 +0000
-Subject: type1-subset: ensure subroutine numnber is an integer
-
----
-diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
-index 786055a..dff4a95 100644
---- a/src/cairo-type1-subset.c
-+++ b/src/cairo-type1-subset.c
-@@ -827,15 +827,18 @@ cairo_type1_font_subset_parse_charstring (cairo_type1_font_subset_t *font,
-
- case TYPE1_CHARSTRING_COMMAND_CALLSUBR:
- if (font->subset_subrs && font->build_stack.sp > 0) {
-- int subr_num = font->build_stack.stack[--font->build_stack.sp];
-- if (subr_num >= 0 && subr_num < font->num_subrs) {
-- font->subrs[subr_num].used = TRUE;
-- status = cairo_type1_font_subset_parse_charstring (
-- font,
-- glyph,
-- font->subrs[subr_num].subr_string,
-- font->subrs[subr_num].subr_length);
-- break;
-+ double int_val;
-+ if (modf(font->build_stack.stack[--font->build_stack.sp], &int_val) == 0.0) {
-+ int subr_num = int_val;
-+ if (subr_num >= 0 && subr_num < font->num_subrs) {
-+ font->subrs[subr_num].used = TRUE;
-+ status = cairo_type1_font_subset_parse_charstring (
-+ font,
-+ glyph,
-+ font->subrs[subr_num].subr_string,
-+ font->subrs[subr_num].subr_length);
-+ break;
-+ }
- }
- }
- font->subset_subrs = FALSE;
---
-cgit v0.9.0.2-2-gbebe
-From 65176b7380f0d633da514be1febe16f17b99d876 Mon Sep 17 00:00:00 2001
-From: Kevin Tardif <kiyoka@gmail.com>
-Date: Tue, 30 Oct 2012 04:27:27 +0000
-Subject: type1-subset, cff-subset: Plugged 2 memory leaks
-
-- _cairo_type1_font_subset_fini doesn't free font->cleartext
-- _cairo_cff_font_create can exit without freeing font->font_name and/or
- font->data; _cairo_cff_font_load_opentype_cff is called to allocate
- font_name, then _cairo_cff_font_load_cff is called to allocate
- font->data, then _cairo_cff_font_load_cff's return status is checked
- and if it failed, it jumps to fail1. This can cause font_name to leak
- since the fail1 target only frees the font variable. In addition,
- _cairo_cff_font_load_cff can fail -after- allocating data, and then
- data won't be freed either.
-
-Bug 56566
----
-diff --git a/src/cairo-cff-subset.c b/src/cairo-cff-subset.c
-index e3040fc..bd8d5b5 100644
---- a/src/cairo-cff-subset.c
-+++ b/src/cairo-cff-subset.c
-@@ -2787,7 +2787,7 @@ _cairo_cff_font_create (cairo_scaled_font_subset_t *scaled_font_subset,
- if (backend->is_synthetic && backend->is_synthetic (scaled_font_subset->scaled_font))
- return CAIRO_INT_STATUS_UNSUPPORTED;
-
-- font = malloc (sizeof (cairo_cff_font_t));
-+ font = calloc (1, sizeof (cairo_cff_font_t));
- if (unlikely (font == NULL))
- return _cairo_error (CAIRO_STATUS_NO_MEMORY);
-
-@@ -2862,11 +2862,11 @@ fail4:
- fail3:
- free (font->subset_font_name);
- fail2:
-- free (font->data);
-- free (font->font_name);
- free (font->ps_name);
- _cairo_array_fini (&font->output);
- fail1:
-+ free (font->data);
-+ free (font->font_name);
- free (font);
-
- return status;
-diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
-index dff4a95..2ec56f1 100644
---- a/src/cairo-type1-subset.c
-+++ b/src/cairo-type1-subset.c
-@@ -1670,6 +1670,8 @@ _cairo_type1_font_subset_fini (cairo_type1_font_subset_t *font)
-
- free (font->subset_index_to_glyphs);
-
-+ free (font->cleartext);
-+
- return status;
- }
-
---
-cgit v0.9.0.2-2-gbebe
-From 66625cb46c985321c46b79d2163a4d676d6700ba Mon Sep 17 00:00:00 2001
-From: Chris Wilson <chris@chris-wilson.co.uk>
-Date: Tue, 30 Oct 2012 12:40:41 +0000
-Subject: xlib: Apply the image offsets to the destination rather the source
-
-So that we can specify the entire source surface as the region to copy
-and not introduce clipping errors.
-
-Fixes regression from
-commit c068691ff57c2f6cd750a54db17393c0e132cb00
-Author: Chris Wilson <chris@chris-wilson.co.uk>
-Date: Fri Aug 17 21:33:54 2012 +0100
-
- xlib/shm: Use an impromptu upload ShmSegment
-
-Reported-by: John Lindgren <john.lindgren@aol.com>
-Reported-by: Kalev Lember <kalevlember@gmail.com>
-Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=56547
-Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
----
-diff --git a/src/cairo-xlib-render-compositor.c b/src/cairo-xlib-render-compositor.c
-index e325382..74c43e9 100644
---- a/src/cairo-xlib-render-compositor.c
-+++ b/src/cairo-xlib-render-compositor.c
-@@ -179,22 +179,19 @@ copy_image_boxes (void *_dst,
- int x2 = _cairo_fixed_integer_part (chunk->base[i].p2.x);
- int y2 = _cairo_fixed_integer_part (chunk->base[i].p2.y);
-
-- rects[j].x = x1;
-- rects[j].y = y1;
-- rects[j].width = x2 - x1;
-- rects[j].height = y2 - y1;
-- j++;
-+ if (x2 > x1 && y2 > y1) {
-+ rects[j].x = x1;
-+ rects[j].y = y1;
-+ rects[j].width = x2 - x1;
-+ rects[j].height = y2 - y1;
-+ j++;
-+ }
- }
- }
-- assert (j == boxes->num_boxes);
-
- XSetClipRectangles (dst->dpy, gc, 0, 0, rects, j, Unsorted);
--
- XCopyArea (dst->dpy, src, dst->drawable, gc,
-- dx, dy,
-- image->width, image->height,
-- 0, 0);
--
-+ 0, 0, image->width, image->height, -dx, -dy);
- XSetClipMask (dst->dpy, gc, None);
-
- if (rects != stack_rects)
-@@ -337,7 +334,8 @@ draw_image_boxes (void *_dst,
-
- if (_cairo_xlib_shm_surface_get_pixmap (&image->base)) {
- status = copy_image_boxes (dst, image, boxes, dx, dy);
-- goto out;
-+ if (status != CAIRO_INT_STATUS_UNSUPPORTED)
-+ goto out;
- }
- }
- }
---
-cgit v0.9.0.2-2-gbebe
diff --git a/extra/cairo/git_fixes.patch b/extra/cairo/git_fixes.patch
deleted file mode 100644
index 6ad8979eb..000000000
--- a/extra/cairo/git_fixes.patch
+++ /dev/null
@@ -1,1086 +0,0 @@
-From ede11b2954db19e3ca9d31cef7d04a7bf0e42ddc Mon Sep 17 00:00:00 2001
-From: Behdad Esfahbod <behdad@behdad.org>
-Date: Sun, 25 Mar 2012 18:37:14 +0000
-Subject: Fix math in comments
-
----
-diff --git a/src/cairo-arc.c b/src/cairo-arc.c
-index dc07fee..6977e88 100644
---- a/src/cairo-arc.c
-+++ b/src/cairo-arc.c
-@@ -139,7 +139,7 @@ _arc_segments_needed (double angle,
-
- From that paper, a very practical value of h is:
-
-- h = 4/3 * tan(angle/4)
-+ h = 4/3 * R * tan(angle/4)
-
- This value does not give the spline with minimal error, but it does
- provide a very good approximation, (6th-order convergence), and the
---
-cgit v0.9.0.2-2-gbebe
-From fba21ef2a4c4eb343668267fda713aedbb6af2a4 Mon Sep 17 00:00:00 2001
-From: Henry (Yu) Song <hsong@sisa.samsung.com>
-Date: Tue, 27 Mar 2012 21:25:37 +0000
-Subject: gl: use font's antialias option to check whether it needs mask
-
-There is need to loop over number of glyphs to check wether the glyph
-image is a ARGB32 as the font's antialias option can be used for checking.
-If antialias is SUBPIXEL or BEST, the glyph surface will be ARGB32,
-otherwise it will be A8 format. Therefore we will only be using
-component-alpha at SUBPIXEL (or better) font quality and only then need
-a mask for multiple pass glyph composition.
----
-diff --git a/src/cairo-gl-glyphs.c b/src/cairo-gl-glyphs.c
-index 832956f..9756ea4 100644
---- a/src/cairo-gl-glyphs.c
-+++ b/src/cairo-gl-glyphs.c
-@@ -427,23 +427,15 @@ _cairo_gl_composite_glyphs (void *_dst,
-
- TRACE ((stderr, "%s\n", __FUNCTION__));
-
-- /* If any of the glyphs are component alpha, we have to go through a mask,
-- * since only _cairo_gl_surface_composite() currently supports component
-- * alpha.
-+ /* If any of the glyphs require component alpha, we have to go through
-+ * a mask, since only _cairo_gl_surface_composite() currently supports
-+ * component alpha.
- */
-- if (!dst->base.is_clear && ! info->use_mask && op != CAIRO_OPERATOR_OVER) {
-- for (i = 0; i < info->num_glyphs; i++) {
-- cairo_scaled_glyph_t *scaled_glyph;
--
-- if (_cairo_scaled_glyph_lookup (info->font, info->glyphs[i].index,
-- CAIRO_SCALED_GLYPH_INFO_SURFACE,
-- &scaled_glyph) == CAIRO_INT_STATUS_SUCCESS &&
-- scaled_glyph->surface->format == CAIRO_FORMAT_ARGB32)
-- {
-- info->use_mask = TRUE;
-- break;
-- }
-- }
-+ if (!dst->base.is_clear && ! info->use_mask && op != CAIRO_OPERATOR_OVER &&
-+ (info->font->options.antialias == CAIRO_ANTIALIAS_SUBPIXEL ||
-+ info->font->options.antialias == CAIRO_ANTIALIAS_BEST))
-+ {
-+ info->use_mask = TRUE;
- }
-
- if (info->use_mask) {
---
-cgit v0.9.0.2-2-gbebe
-From d304f0e57be8036719c3709e2419487326369105 Mon Sep 17 00:00:00 2001
-From: Chris Wilson <chris@chris-wilson.co.uk>
-Date: Wed, 28 Mar 2012 23:32:36 +0000
-Subject: composite-rectangles: Trim extents for SOURCE and CLEAR to the mask
-
-The SOURCE and CLEAR are the odd pair in Cairo's range of operators that
-are bound by the shape/mask, but are unbound by the source. This
-regularly leads to bugs as only track the bound/unbound rectangles and
-confuse the meaning when bound only by the mask.
-
-What is required is that the unbound extents in this case is only
-trimmed by the mask (the bounded extents are still the intersection of
-all).
-
-Fixes bug-source-cu
-
-Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
----
-diff --git a/src/cairo-composite-rectangles.c b/src/cairo-composite-rectangles.c
-index 106571e..8c5cd5a 100644
---- a/src/cairo-composite-rectangles.c
-+++ b/src/cairo-composite-rectangles.c
-@@ -147,8 +147,12 @@ _cairo_composite_rectangles_intersect (cairo_composite_rectangles_t *extents,
- if (! ret && extents->is_bounded & CAIRO_OPERATOR_BOUND_BY_MASK)
- return CAIRO_INT_STATUS_NOTHING_TO_DO;
-
-- if (extents->is_bounded == (CAIRO_OPERATOR_BOUND_BY_MASK | CAIRO_OPERATOR_BOUND_BY_SOURCE))
-+ if (extents->is_bounded == (CAIRO_OPERATOR_BOUND_BY_MASK | CAIRO_OPERATOR_BOUND_BY_SOURCE)) {
- extents->unbounded = extents->bounded;
-+ } else if (extents->is_bounded & CAIRO_OPERATOR_BOUND_BY_MASK) {
-+ if (!_cairo_rectangle_intersect (&extents->unbounded, &extents->mask))
-+ return CAIRO_INT_STATUS_NOTHING_TO_DO;
-+ }
-
- extents->clip = _cairo_clip_reduce_for_composite (clip, extents);
- if (_cairo_clip_is_all_clipped (extents->clip))
-@@ -199,8 +203,12 @@ _cairo_composite_rectangles_intersect_source_extents (cairo_composite_rectangles
- rect.height == extents->bounded.height)
- return CAIRO_INT_STATUS_SUCCESS;
-
-- if (extents->is_bounded == (CAIRO_OPERATOR_BOUND_BY_MASK | CAIRO_OPERATOR_BOUND_BY_SOURCE))
-+ if (extents->is_bounded == (CAIRO_OPERATOR_BOUND_BY_MASK | CAIRO_OPERATOR_BOUND_BY_SOURCE)) {
- extents->unbounded = extents->bounded;
-+ } else if (extents->is_bounded & CAIRO_OPERATOR_BOUND_BY_MASK) {
-+ if (!_cairo_rectangle_intersect (&extents->unbounded, &extents->mask))
-+ return CAIRO_INT_STATUS_NOTHING_TO_DO;
-+ }
-
- clip = extents->clip;
- extents->clip = _cairo_clip_reduce_for_composite (clip, extents);
-@@ -253,8 +261,12 @@ _cairo_composite_rectangles_intersect_mask_extents (cairo_composite_rectangles_t
- mask.height == extents->bounded.height)
- return CAIRO_INT_STATUS_SUCCESS;
-
-- if (extents->is_bounded == (CAIRO_OPERATOR_BOUND_BY_MASK | CAIRO_OPERATOR_BOUND_BY_SOURCE))
-+ if (extents->is_bounded == (CAIRO_OPERATOR_BOUND_BY_MASK | CAIRO_OPERATOR_BOUND_BY_SOURCE)) {
- extents->unbounded = extents->bounded;
-+ } else if (extents->is_bounded & CAIRO_OPERATOR_BOUND_BY_MASK) {
-+ if (!_cairo_rectangle_intersect (&extents->unbounded, &extents->mask))
-+ return CAIRO_INT_STATUS_NOTHING_TO_DO;
-+ }
-
- clip = extents->clip;
- extents->clip = _cairo_clip_reduce_for_composite (clip, extents);
---
-cgit v0.9.0.2-2-gbebe
-From af6e084dd78fcbb8ecce46c57f655f5e24343b8c Mon Sep 17 00:00:00 2001
-From: Chris Wilson <chris@chris-wilson.co.uk>
-Date: Thu, 29 Mar 2012 13:48:24 +0000
-Subject: cairoint: Mark PDF surface as requiring the deflate stream output
-
-Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
----
-diff --git a/src/cairoint.h b/src/cairoint.h
-index 9a8003e..9f20d51 100644
---- a/src/cairoint.h
-+++ b/src/cairoint.h
-@@ -73,7 +73,10 @@
- #include "cairo-compiler-private.h"
- #include "cairo-error-private.h"
-
--#if CAIRO_HAS_PS_SURFACE || CAIRO_HAS_SCRIPT_SURFACE || CAIRO_HAS_XML_SURFACE
-+#if CAIRO_HAS_PDF_SURFACE || \
-+ CAIRO_HAS_PS_SURFACE || \
-+ CAIRO_HAS_SCRIPT_SURFACE || \
-+ CAIRO_HAS_XML_SURFACE
- #define CAIRO_HAS_DEFLATE_STREAM 1
- #endif
-
-@@ -84,7 +87,9 @@
- #define CAIRO_HAS_FONT_SUBSET 1
- #endif
-
--#if CAIRO_HAS_PS_SURFACE || CAIRO_HAS_PDF_SURFACE || CAIRO_HAS_FONT_SUBSET
-+#if CAIRO_HAS_PS_SURFACE || \
-+ CAIRO_HAS_PDF_SURFACE || \
-+ CAIRO_HAS_FONT_SUBSET
- #define CAIRO_HAS_PDF_OPERATORS 1
- #endif
-
---
-cgit v0.9.0.2-2-gbebe
-From a965b0f95fdeb567f7ccb51f7c8c47735a61e2d9 Mon Sep 17 00:00:00 2001
-From: Henry (Yu) Song <hsong@sisa.samsung.com>
-Date: Thu, 29 Mar 2012 01:08:51 +0000
-Subject: gl: fix y-axis origin when map_to_image() for non texture GL surface
-
-We need to fix y-axis origin when map a GL surface to image surface for
-non-texture GL surface.
-
-Test cases: extended-blend-alpha-mask, extended-blend-mask.
-Although the image outputs is not right, but the image on the first grid
-(upper-left corner) is correct comparing to image output.
----
-diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
-index 8bbf939..32ecf63 100644
---- a/src/cairo-gl-surface.c
-+++ b/src/cairo-gl-surface.c
-@@ -985,6 +985,7 @@ _cairo_gl_surface_map_to_image (void *abstract_surface,
- unsigned int cpp;
- cairo_bool_t invert;
- cairo_status_t status;
-+ int y;
-
- /* Want to use a switch statement here but the compiler gets whiny. */
- if (surface->base.content == CAIRO_CONTENT_COLOR_ALPHA) {
-@@ -1065,7 +1066,12 @@ _cairo_gl_surface_map_to_image (void *abstract_surface,
- glPixelStorei (GL_PACK_ROW_LENGTH, image->stride / cpp);
- if (invert)
- glPixelStorei (GL_PACK_INVERT_MESA, 1);
-- glReadPixels (extents->x, extents->y,
-+
-+ y = extents->y;
-+ if (! _cairo_gl_surface_is_texture (surface))
-+ y = surface->height - extents->y - extents->height;
-+
-+ glReadPixels (extents->x, y,
- extents->width, extents->height,
- format, type, image->data);
- if (invert)
---
-cgit v0.9.0.2-2-gbebe
-From c77112c5464d7ff21052527f82f4d729cc509291 Mon Sep 17 00:00:00 2001
-From: Uli Schlachter <psychon@znc.in>
-Date: Mon, 02 Apr 2012 18:43:00 +0000
-Subject: xcb: Fix SHM in _get_image()
-
-Commit 2283ab9 introduced a logic error. Instead of falling back to the non-SHM
-path when getting the image via SHM failed, we now did the fallback when getting
-the image via SHM worked (which means that the SHM operation was a waste of
-time).
-
-Signed-off-by: Uli Schlachter <psychon@znc.in>
----
-diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c
-index fff4f52..6bedbda 100644
---- a/src/cairo-xcb-surface.c
-+++ b/src/cairo-xcb-surface.c
-@@ -367,7 +367,7 @@ _get_image (cairo_xcb_surface_t *surface,
- if (use_shm) {
- image = _get_shm_image (surface, x, y, width, height);
- if (image) {
-- if (image->status) {
-+ if (image->status == CAIRO_STATUS_SUCCESS) {
- _cairo_xcb_connection_release (connection);
- return image;
- }
---
-cgit v0.9.0.2-2-gbebe
-From cc247c346b75353f16ab40ac74c54cdd9663d16b Mon Sep 17 00:00:00 2001
-From: Henry (Yu) Song <hsong@sisa.samsung.com>
-Date: Mon, 02 Apr 2012 21:29:47 +0000
-Subject: gl: Remove an unused variable
-
----
-diff --git a/src/cairo-gl-gradient.c b/src/cairo-gl-gradient.c
-index b364b92..ce7c0dd 100644
---- a/src/cairo-gl-gradient.c
-+++ b/src/cairo-gl-gradient.c
-@@ -207,7 +207,6 @@ _cairo_gl_gradient_create (cairo_gl_context_t *ctx,
- cairo_status_t status;
- int tex_width;
- void *data;
-- cairo_gl_dispatch_t *dispatch = &ctx->dispatch;
-
- if ((unsigned int) ctx->max_texture_size / 2 <= n_stops)
- return CAIRO_INT_STATUS_UNSUPPORTED;
---
-cgit v0.9.0.2-2-gbebe
-From 7a262fd398c8a1f3c9052e8d9ec459e27ff91b4d Mon Sep 17 00:00:00 2001
-From: Adrian Johnson <ajohnson@redneon.com>
-Date: Wed, 04 Apr 2012 10:23:09 +0000
-Subject: fix bug in _cairo_image_analyze_color
-
----
-diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
-index 8208a15..e860e1b 100644
---- a/src/cairo-image-surface.c
-+++ b/src/cairo-image-surface.c
-@@ -1130,9 +1130,12 @@ _cairo_image_analyze_color (cairo_image_surface_t *image)
- if (image->color != CAIRO_IMAGE_UNKNOWN_COLOR)
- return image->color;
-
-- if (image->format == CAIRO_FORMAT_A1 || image->format == CAIRO_FORMAT_A8)
-+ if (image->format == CAIRO_FORMAT_A1)
- return image->color = CAIRO_IMAGE_IS_MONOCHROME;
-
-+ if (image->format == CAIRO_FORMAT_A8)
-+ return image->color = CAIRO_IMAGE_IS_GRAYSCALE;
-+
- if (image->format == CAIRO_FORMAT_ARGB32) {
- image->color = CAIRO_IMAGE_IS_MONOCHROME;
- for (y = 0; y < image->height; y++) {
---
-cgit v0.9.0.2-2-gbebe
-From 70b2856ed3d31b41e69b3d82fb9c5c11c2b3d3d4 Mon Sep 17 00:00:00 2001
-From: Adrian Johnson <ajohnson@redneon.com>
-Date: Thu, 05 Apr 2012 23:43:35 +0000
-Subject: type1-subset: use fallback font if glyph widths are calculated
-
-Bug 48349 has a pdf file with a Type 1 font where the glyph widths are
-of the form:
-
-34 9302 19 div hsbw
----
-diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
-index 607ac8e..ba1008a 100644
---- a/src/cairo-type1-subset.c
-+++ b/src/cairo-type1-subset.c
-@@ -751,6 +751,9 @@ cairo_type1_font_subset_parse_charstring (cairo_type1_font_subset_t *font,
- command = *p++;
- switch (command) {
- case TYPE1_CHARSTRING_COMMAND_HSBW:
-+ if (! last_op_was_integer)
-+ return CAIRO_INT_STATUS_UNSUPPORTED;
-+
- font->glyphs[glyph].width = font->build_stack.stack[1]/font->base.units_per_em;
- font->build_stack.sp = 0;
- last_op_was_integer = FALSE;
-@@ -797,6 +800,9 @@ cairo_type1_font_subset_parse_charstring (cairo_type1_font_subset_t *font,
- break;
-
- case TYPE1_CHARSTRING_COMMAND_SBW:
-+ if (! last_op_was_integer)
-+ return CAIRO_INT_STATUS_UNSUPPORTED;
-+
- font->glyphs[glyph].width = font->build_stack.stack[2]/font->base.units_per_em;
- font->build_stack.sp = 0;
- last_op_was_integer = FALSE;
---
-cgit v0.9.0.2-2-gbebe
-From a6d955fcc46ae2da8d6f3b2cadeae64c03066461 Mon Sep 17 00:00:00 2001
-From: Adrian Johnson <ajohnson@redneon.com>
-Date: Thu, 05 Apr 2012 23:53:50 +0000
-Subject: fix indentation in cairo_type1_font_subset_parse_charstring
-
----
-diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
-index ba1008a..ddef8ae 100644
---- a/src/cairo-type1-subset.c
-+++ b/src/cairo-type1-subset.c
-@@ -1,3 +1,4 @@
-+/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */
- /* cairo - a vector graphics library with display and print output
- *
- * Copyright © 2006 Red Hat, Inc
-@@ -750,86 +751,79 @@ cairo_type1_font_subset_parse_charstring (cairo_type1_font_subset_t *font,
- if (*p < 32) {
- command = *p++;
- switch (command) {
-- case TYPE1_CHARSTRING_COMMAND_HSBW:
-- if (! last_op_was_integer)
-- return CAIRO_INT_STATUS_UNSUPPORTED;
-+ case TYPE1_CHARSTRING_COMMAND_HSBW:
-+ if (! last_op_was_integer)
-+ return CAIRO_INT_STATUS_UNSUPPORTED;
-+
-+ font->glyphs[glyph].width = font->build_stack.stack[1]/font->base.units_per_em;
-+ font->build_stack.sp = 0;
-+ last_op_was_integer = FALSE;
-+ break;
-+
-+ case TYPE1_CHARSTRING_COMMAND_CALLSUBR:
-+ if (font->subset_subrs &&
-+ last_op_was_integer &&
-+ font->build_stack.top_value >= 0 &&
-+ font->build_stack.top_value < font->num_subrs)
-+ {
-+ subr_num = font->build_stack.top_value;
-+ font->subrs[subr_num].used = TRUE;
-+ last_op_was_integer = FALSE;
-+ status = cairo_type1_font_subset_parse_charstring (font,
-+ glyph,
-+ font->subrs[subr_num].subr_string,
-+ font->subrs[subr_num].subr_length);
-+ } else {
-+ font->subset_subrs = FALSE;
-+ }
-+ break;
-+
-+ case TYPE1_CHARSTRING_COMMAND_ESCAPE:
-+ command = command << 8 | *p++;
-+ switch (command) {
-+ case TYPE1_CHARSTRING_COMMAND_SEAC:
-+ /* The seac command takes five integer arguments. The
-+ * last two are glyph indices into the PS standard
-+ * encoding give the names of the glyphs that this
-+ * glyph is composed from. All we need to do is to
-+ * make sure those glyphs are present in the subset
-+ * under their standard names. */
-+ status = use_standard_encoding_glyph (font, font->build_stack.stack[3]);
-+ if (unlikely (status))
-+ return status;
-+
-+ status = use_standard_encoding_glyph (font, font->build_stack.stack[4]);
-+ if (unlikely (status))
-+ return status;
-
-- font->glyphs[glyph].width = font->build_stack.stack[1]/font->base.units_per_em;
- font->build_stack.sp = 0;
- last_op_was_integer = FALSE;
- break;
-
-- case TYPE1_CHARSTRING_COMMAND_CALLSUBR:
-- if (font->subset_subrs &&
-- last_op_was_integer &&
-- font->build_stack.top_value >= 0 &&
-- font->build_stack.top_value < font->num_subrs)
-- {
-- subr_num = font->build_stack.top_value;
-- font->subrs[subr_num].used = TRUE;
-- last_op_was_integer = FALSE;
-- status = cairo_type1_font_subset_parse_charstring (font,
-- glyph,
-- font->subrs[subr_num].subr_string,
-- font->subrs[subr_num].subr_length);
-- } else {
-- font->subset_subrs = FALSE;
-- }
-+ case TYPE1_CHARSTRING_COMMAND_SBW:
-+ if (! last_op_was_integer)
-+ return CAIRO_INT_STATUS_UNSUPPORTED;
-+
-+ font->glyphs[glyph].width = font->build_stack.stack[2]/font->base.units_per_em;
-+ font->build_stack.sp = 0;
-+ last_op_was_integer = FALSE;
- break;
-
-- case TYPE1_CHARSTRING_COMMAND_ESCAPE:
-- command = command << 8 | *p++;
-- switch (command) {
-- case TYPE1_CHARSTRING_COMMAND_SEAC:
-- /* The seac command takes five integer arguments. The
-- * last two are glyph indices into the PS standard
-- * encoding give the names of the glyphs that this
-- * glyph is composed from. All we need to do is to
-- * make sure those glyphs are present in the subset
-- * under their standard names. */
-- status = use_standard_encoding_glyph (font, font->build_stack.stack[3]);
-- if (unlikely (status))
-- return status;
--
-- status = use_standard_encoding_glyph (font, font->build_stack.stack[4]);
-- if (unlikely (status))
-- return status;
--
-- font->build_stack.sp = 0;
-- last_op_was_integer = FALSE;
-- break;
--
-- case TYPE1_CHARSTRING_COMMAND_SBW:
-- if (! last_op_was_integer)
-- return CAIRO_INT_STATUS_UNSUPPORTED;
--
-- font->glyphs[glyph].width = font->build_stack.stack[2]/font->base.units_per_em;
-- font->build_stack.sp = 0;
-- last_op_was_integer = FALSE;
-- break;
--
-- case TYPE1_CHARSTRING_COMMAND_CALLOTHERSUBR:
-- for (i = 0; i < font->build_stack.sp; i++)
-- font->ps_stack.other_subr_args[i] = font->build_stack.stack[i];
-- font->ps_stack.num_other_subr_args = font->build_stack.sp;
-- font->ps_stack.cur_other_subr_arg = 0;
-- font->build_stack.sp = 0;
-- last_op_was_integer = FALSE;
-- break;
--
-- case TYPE1_CHARSTRING_COMMAND_POP:
-- if (font->ps_stack.num_other_subr_args > font->ps_stack.cur_other_subr_arg) {
-- font->build_stack.top_value = font->ps_stack.other_subr_args[font->ps_stack.cur_other_subr_arg++];
-- last_op_was_integer = TRUE;
-- } else {
-- font->subset_subrs = FALSE;
-- }
-- break;
--
-- default:
-- font->build_stack.sp = 0;
-- last_op_was_integer = FALSE;
-- break;
-+ case TYPE1_CHARSTRING_COMMAND_CALLOTHERSUBR:
-+ for (i = 0; i < font->build_stack.sp; i++)
-+ font->ps_stack.other_subr_args[i] = font->build_stack.stack[i];
-+ font->ps_stack.num_other_subr_args = font->build_stack.sp;
-+ font->ps_stack.cur_other_subr_arg = 0;
-+ font->build_stack.sp = 0;
-+ last_op_was_integer = FALSE;
-+ break;
-+
-+ case TYPE1_CHARSTRING_COMMAND_POP:
-+ if (font->ps_stack.num_other_subr_args > font->ps_stack.cur_other_subr_arg) {
-+ font->build_stack.top_value = font->ps_stack.other_subr_args[font->ps_stack.cur_other_subr_arg++];
-+ last_op_was_integer = TRUE;
-+ } else {
-+ font->subset_subrs = FALSE;
- }
- break;
-
-@@ -837,6 +831,13 @@ cairo_type1_font_subset_parse_charstring (cairo_type1_font_subset_t *font,
- font->build_stack.sp = 0;
- last_op_was_integer = FALSE;
- break;
-+ }
-+ break;
-+
-+ default:
-+ font->build_stack.sp = 0;
-+ last_op_was_integer = FALSE;
-+ break;
- }
- } else {
- /* integer argument */
---
-cgit v0.9.0.2-2-gbebe
-From 8886220b5027296f5b3b95e9c2f93509108d3b9e Mon Sep 17 00:00:00 2001
-From: Adrian Johnson <ajohnson@redneon.com>
-Date: Fri, 06 Apr 2012 00:13:53 +0000
-Subject: type1-subset: if font name is prefixed with a subset tag, strip it off
-
----
-diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
-index ddef8ae..e507abe 100644
---- a/src/cairo-type1-subset.c
-+++ b/src/cairo-type1-subset.c
-@@ -381,6 +381,7 @@ cairo_type1_font_subset_get_fontname (cairo_type1_font_subset_t *font)
- {
- const char *start, *end, *segment_end;
- char *s;
-+ int i;
-
- segment_end = font->header_segment + font->header_segment_size;
- start = find_token (font->header_segment, segment_end, "/FontName");
-@@ -406,6 +407,16 @@ cairo_type1_font_subset_get_fontname (cairo_type1_font_subset_t *font)
- return CAIRO_INT_STATUS_UNSUPPORTED;
- }
-
-+ /* If font name is prefixed with a subset tag, strip it off. */
-+ if (strlen(start) > 7 && start[6] == '+') {
-+ for (i = 0; i < 6; i++) {
-+ if (start[i] < 'A' || start[i] > 'Z')
-+ break;
-+ }
-+ if (i == 6)
-+ start += 7;
-+ }
-+
- font->base.base_font = strdup (start);
- free (s);
- if (unlikely (font->base.base_font == NULL))
---
-cgit v0.9.0.2-2-gbebe
-From 8657ca10e34b0034602680b4304d47ecf90ccbfd Mon Sep 17 00:00:00 2001
-From: Adrian Johnson <ajohnson@redneon.com>
-Date: Fri, 06 Apr 2012 11:50:40 +0000
-Subject: fix _cairo_pattern_get_ink_extents to work with snapshot recording surfaces
-
-It had caused pdf bbox sizes to regress to page size bboxes.
----
-diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
-index 27ba004..5b3e177 100644
---- a/src/cairo-pattern.c
-+++ b/src/cairo-pattern.c
-@@ -37,6 +37,7 @@
- #include "cairo-path-private.h"
- #include "cairo-pattern-private.h"
- #include "cairo-recording-surface-private.h"
-+#include "cairo-surface-snapshot-private.h"
-
- #include <float.h>
-
-@@ -3666,6 +3667,9 @@ _cairo_pattern_get_ink_extents (const cairo_pattern_t *pattern,
- (const cairo_surface_pattern_t *) pattern;
- cairo_surface_t *surface = surface_pattern->surface;
-
-+ if (_cairo_surface_is_snapshot (surface))
-+ surface = _cairo_surface_snapshot_get_target (surface);
-+
- if (_cairo_surface_is_recording (surface)) {
- cairo_matrix_t imatrix;
- cairo_box_t box;
---
-cgit v0.9.0.2-2-gbebe
-From 6f28f0b33cb12f3b2dd48c87da0018bd00c17107 Mon Sep 17 00:00:00 2001
-From: Chris Wilson <chris@chris-wilson.co.uk>
-Date: Sun, 08 Apr 2012 10:28:59 +0000
-Subject: stroke: Fix misuse of half_line_x for vertical caps on dashes
-
-A typo using half_line_x instead of half_line_y when emitting dashed
-segments of the rectilinear stroke.
-
-Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
----
-diff --git a/src/cairo-path-stroke-boxes.c b/src/cairo-path-stroke-boxes.c
-index 3e8c5a4..cc9dd19 100644
---- a/src/cairo-path-stroke-boxes.c
-+++ b/src/cairo-path-stroke-boxes.c
-@@ -342,15 +342,15 @@ _cairo_rectilinear_stroker_emit_segments_dashed (cairo_rectilinear_stroker_t *st
- box.p1.x = box.p2.x - half_line_x;
- }
- if (out_slope.dy >= 0)
-- box.p1.y -= half_line_x;
-+ box.p1.y -= half_line_y;
- if (out_slope.dy <= 0)
-- box.p2.y += half_line_x;
-+ box.p2.y += half_line_y;
- } else {
- if (box.p1.y <= box.p2.y) {
- box.p1.y = box.p2.y;
-- box.p2.y += half_line_x;
-+ box.p2.y += half_line_y;
- } else {
-- box.p1.y = box.p2.y - half_line_x;
-+ box.p1.y = box.p2.y - half_line_y;
- }
- if (out_slope.dx >= 0)
- box.p1.x -= half_line_x;
---
-cgit v0.9.0.2-2-gbebe
-From 113ec6bf0c8ed1ff12293d1ed2a2de9bd5b9904b Mon Sep 17 00:00:00 2001
-From: Chris Wilson <chris@chris-wilson.co.uk>
-Date: Sun, 08 Apr 2012 16:58:13 +0000
-Subject: traps: Clip the trapezoid extents against the clip extents
-
-Just in case the clip polygon turns out to be much larger than the
-operation extents (silly us for not reducing it correctly) and lead to
-catastrophe, such as:
-
-Program received signal SIGSEGV, Segmentation fault.
-pixman_fill_sse2 (bits=<optimized out>, stride=4, bpp=8, x=0, y=0,
-width=3, height=-34811, data=0) at pixman-sse2.c:3369
-3369 *(uint16_t *)d = data;
-
-Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
----
-diff --git a/src/cairo-traps-compositor.c b/src/cairo-traps-compositor.c
-index 284a0be..c49e208 100644
---- a/src/cairo-traps-compositor.c
-+++ b/src/cairo-traps-compositor.c
-@@ -218,8 +218,13 @@ combine_clip_as_traps (const cairo_traps_compositor_t *compositor,
- _cairo_traps_fini (&traps);
- cairo_surface_destroy (src);
-
-- if (status == CAIRO_INT_STATUS_SUCCESS &&
-- (fixup.width < extents->width || fixup.height < extents->height)) {
-+ if (unlikely (status))
-+ return status;
-+
-+ if (! _cairo_rectangle_intersect (&fixup, extents))
-+ return CAIRO_STATUS_SUCCESS;
-+
-+ if (fixup.width < extents->width || fixup.height < extents->height) {
- cairo_boxes_t clear;
-
- _cairo_boxes_init (&clear);
---
-cgit v0.9.0.2-2-gbebe
-From de61681574eb7d6e0e497ea7f25797e3d9b20ac4 Mon Sep 17 00:00:00 2001
-From: Chris Wilson <chris@chris-wilson.co.uk>
-Date: Mon, 09 Apr 2012 11:47:34 +0000
-Subject: build: Disable -Wset-but-unused-variable
-
-This is too noisy in the current build, and masking more important
-warnings.
-
-Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
----
-diff --git a/build/configure.ac.warnings b/build/configure.ac.warnings
-index 3eb0104..f1b17f4 100644
---- a/build/configure.ac.warnings
-+++ b/build/configure.ac.warnings
-@@ -21,6 +21,9 @@ MAYBE_WARN="-Wall -Wextra \
- -Wno-missing-field-initializers -Wno-unused-parameter \
- -Wno-attributes -Wno-long-long -Winline"
-
-+# -Wunused-but-set-variable is too noisy at present
-+NO_WARN="-Wno-unused-but-set-variable"
-+
- dnl Sun Studio 12 likes to rag at us for abusing enums like
- dnl having cairo_status_t variables hold cairo_int_status_t
- dnl values. It's bad, we know. Now please be quiet.
-@@ -34,6 +37,8 @@ MAYBE_WARN="$MAYBE_WARN -fno-strict-aliasing -fno-common -flto"
- dnl Also to turn various gcc/glibc-specific preprocessor checks
- MAYBE_WARN="$MAYBE_WARN -Wp,-D_FORTIFY_SOURCE=2"
-
-+MAYBE_WARN="$MAYBE_WARN $NO_WARN"
-+
- # invalidate cached value if MAYBE_WARN has changed
- if test "x$cairo_cv_warn_maybe" != "x$MAYBE_WARN"; then
- unset cairo_cv_warn_cflags
---
-cgit v0.9.0.2-2-gbebe
-From 7cb5053c0694992320b5f7ea3b91ea497431813b Mon Sep 17 00:00:00 2001
-From: Chris Wilson <chris@chris-wilson.co.uk>
-Date: Mon, 09 Apr 2012 11:49:20 +0000
-Subject: analysis: Apply the integer translation to the bbox as well
-
-The bbox is used to compute the ink extents (and so the pattern extents
-of a recording surface) and if given an integer translation we failed to
-transform the bbox into the target space.
-
-Fixes mask (pdf).
-
-Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
----
-diff --git a/src/cairo-analysis-surface.c b/src/cairo-analysis-surface.c
-index b8abe02..8878f62 100644
---- a/src/cairo-analysis-surface.c
-+++ b/src/cairo-analysis-surface.c
-@@ -220,6 +220,14 @@ _add_operation (cairo_analysis_surface_t *surface,
- if (_cairo_matrix_is_integer_translation (&surface->ctm, &tx, &ty)) {
- rect->x += tx;
- rect->y += ty;
-+
-+ tx = _cairo_fixed_from_int (tx);
-+ bbox.p1.x += tx;
-+ bbox.p2.x += tx;
-+
-+ ty = _cairo_fixed_from_int (ty);
-+ bbox.p1.y += ty;
-+ bbox.p2.y += ty;
- } else {
- _cairo_matrix_transform_bounding_box_fixed (&surface->ctm,
- &bbox, NULL);
---
-cgit v0.9.0.2-2-gbebe
-From 038e4991912656a3239ca82d60056ca129016ba6 Mon Sep 17 00:00:00 2001
-From: Adrian Johnson <ajohnson@redneon.com>
-Date: Mon, 09 Apr 2012 08:31:44 +0000
-Subject: pdf: avoid unnecessary use of patterns in mask groups
-
----
-diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
-index 4930e72..78537ce 100644
---- a/src/cairo-pdf-surface.c
-+++ b/src/cairo-pdf-surface.c
-@@ -5703,56 +5703,68 @@ _cairo_pdf_surface_write_mask_group (cairo_pdf_surface_t *surface,
- if (unlikely (status))
- return status;
-
-- pattern_res.id = 0;
-- gstate_res.id = 0;
-- status = _cairo_pdf_surface_add_pdf_pattern (surface, group->mask, NULL,
-- &pattern_res, &gstate_res);
-- if (unlikely (status))
-- return status;
--
-- if (gstate_res.id != 0) {
-- smask_group = _cairo_pdf_surface_create_smask_group (surface, &group->extents);
-- if (unlikely (smask_group == NULL))
-- return _cairo_error (CAIRO_STATUS_NO_MEMORY);
--
-- smask_group->width = group->width;
-- smask_group->height = group->height;
-- smask_group->operation = PDF_PAINT;
-- smask_group->source = cairo_pattern_reference (group->mask);
-- smask_group->source_res = pattern_res;
-- status = _cairo_pdf_surface_add_smask_group (surface, smask_group);
-- if (unlikely (status)) {
-- _cairo_pdf_smask_group_destroy (smask_group);
-- return status;
-- }
--
-- status = _cairo_pdf_surface_add_smask (surface, gstate_res);
-- if (unlikely (status))
-- return status;
--
-- status = _cairo_pdf_surface_add_xobject (surface, smask_group->group_res);
-+ if (_can_paint_pattern (group->mask)) {
-+ _cairo_output_stream_printf (surface->output, "q\n");
-+ status = _cairo_pdf_surface_paint_pattern (surface,
-+ group->mask,
-+ &group->extents,
-+ FALSE);
- if (unlikely (status))
- return status;
-
-- _cairo_output_stream_printf (surface->output,
-- "q /s%d gs /x%d Do Q\n",
-- gstate_res.id,
-- smask_group->group_res.id);
-+ _cairo_output_stream_printf (surface->output, "Q\n");
- } else {
-- status = _cairo_pdf_surface_select_pattern (surface, group->mask, pattern_res, FALSE);
-+ pattern_res.id = 0;
-+ gstate_res.id = 0;
-+ status = _cairo_pdf_surface_add_pdf_pattern (surface, group->mask, NULL,
-+ &pattern_res, &gstate_res);
- if (unlikely (status))
- return status;
-
-- _cairo_output_stream_printf (surface->output,
-- "%f %f %f %f re f\n",
-- bbox.p1.x,
-- bbox.p1.y,
-- bbox.p2.x - bbox.p1.x,
-- bbox.p2.y - bbox.p1.y);
-+ if (gstate_res.id != 0) {
-+ smask_group = _cairo_pdf_surface_create_smask_group (surface, &group->extents);
-+ if (unlikely (smask_group == NULL))
-+ return _cairo_error (CAIRO_STATUS_NO_MEMORY);
-
-- status = _cairo_pdf_surface_unselect_pattern (surface);
-- if (unlikely (status))
-- return status;
-+ smask_group->width = group->width;
-+ smask_group->height = group->height;
-+ smask_group->operation = PDF_PAINT;
-+ smask_group->source = cairo_pattern_reference (group->mask);
-+ smask_group->source_res = pattern_res;
-+ status = _cairo_pdf_surface_add_smask_group (surface, smask_group);
-+ if (unlikely (status)) {
-+ _cairo_pdf_smask_group_destroy (smask_group);
-+ return status;
-+ }
-+
-+ status = _cairo_pdf_surface_add_smask (surface, gstate_res);
-+ if (unlikely (status))
-+ return status;
-+
-+ status = _cairo_pdf_surface_add_xobject (surface, smask_group->group_res);
-+ if (unlikely (status))
-+ return status;
-+
-+ _cairo_output_stream_printf (surface->output,
-+ "q /s%d gs /x%d Do Q\n",
-+ gstate_res.id,
-+ smask_group->group_res.id);
-+ } else {
-+ status = _cairo_pdf_surface_select_pattern (surface, group->mask, pattern_res, FALSE);
-+ if (unlikely (status))
-+ return status;
-+
-+ _cairo_output_stream_printf (surface->output,
-+ "%f %f %f %f re f\n",
-+ bbox.p1.x,
-+ bbox.p1.y,
-+ bbox.p2.x - bbox.p1.x,
-+ bbox.p2.y - bbox.p1.y);
-+
-+ status = _cairo_pdf_surface_unselect_pattern (surface);
-+ if (unlikely (status))
-+ return status;
-+ }
- }
-
- status = _cairo_pdf_surface_close_group (surface, &mask_group);
-@@ -5764,54 +5776,66 @@ _cairo_pdf_surface_write_mask_group (cairo_pdf_surface_t *surface,
- if (unlikely (status))
- return status;
-
-- pattern_res.id = 0;
-- gstate_res.id = 0;
-- status = _cairo_pdf_surface_add_pdf_pattern (surface, group->source, NULL,
-- &pattern_res, &gstate_res);
-- if (unlikely (status))
-- return status;
--
-- if (gstate_res.id != 0) {
-- smask_group = _cairo_pdf_surface_create_smask_group (surface, &group->extents);
-- if (unlikely (smask_group == NULL))
-- return _cairo_error (CAIRO_STATUS_NO_MEMORY);
--
-- smask_group->operation = PDF_PAINT;
-- smask_group->source = cairo_pattern_reference (group->source);
-- smask_group->source_res = pattern_res;
-- status = _cairo_pdf_surface_add_smask_group (surface, smask_group);
-- if (unlikely (status)) {
-- _cairo_pdf_smask_group_destroy (smask_group);
-- return status;
-- }
--
-- status = _cairo_pdf_surface_add_smask (surface, gstate_res);
-- if (unlikely (status))
-- return status;
--
-- status = _cairo_pdf_surface_add_xobject (surface, smask_group->group_res);
-+ if (_can_paint_pattern (group->source)) {
-+ _cairo_output_stream_printf (surface->output, "q\n");
-+ status = _cairo_pdf_surface_paint_pattern (surface,
-+ group->source,
-+ &group->extents,
-+ FALSE);
- if (unlikely (status))
- return status;
-
-- _cairo_output_stream_printf (surface->output,
-- "q /s%d gs /x%d Do Q\n",
-- gstate_res.id,
-- smask_group->group_res.id);
-+ _cairo_output_stream_printf (surface->output, "Q\n");
- } else {
-- status = _cairo_pdf_surface_select_pattern (surface, group->source, pattern_res, FALSE);
-+ pattern_res.id = 0;
-+ gstate_res.id = 0;
-+ status = _cairo_pdf_surface_add_pdf_pattern (surface, group->source, NULL,
-+ &pattern_res, &gstate_res);
- if (unlikely (status))
- return status;
-
-- _cairo_output_stream_printf (surface->output,
-- "%f %f %f %f re f\n",
-- bbox.p1.x,
-- bbox.p1.y,
-- bbox.p2.x - bbox.p1.x,
-- bbox.p2.y - bbox.p1.y);
-+ if (gstate_res.id != 0) {
-+ smask_group = _cairo_pdf_surface_create_smask_group (surface, &group->extents);
-+ if (unlikely (smask_group == NULL))
-+ return _cairo_error (CAIRO_STATUS_NO_MEMORY);
-
-- status = _cairo_pdf_surface_unselect_pattern (surface);
-- if (unlikely (status))
-- return status;
-+ smask_group->operation = PDF_PAINT;
-+ smask_group->source = cairo_pattern_reference (group->source);
-+ smask_group->source_res = pattern_res;
-+ status = _cairo_pdf_surface_add_smask_group (surface, smask_group);
-+ if (unlikely (status)) {
-+ _cairo_pdf_smask_group_destroy (smask_group);
-+ return status;
-+ }
-+
-+ status = _cairo_pdf_surface_add_smask (surface, gstate_res);
-+ if (unlikely (status))
-+ return status;
-+
-+ status = _cairo_pdf_surface_add_xobject (surface, smask_group->group_res);
-+ if (unlikely (status))
-+ return status;
-+
-+ _cairo_output_stream_printf (surface->output,
-+ "q /s%d gs /x%d Do Q\n",
-+ gstate_res.id,
-+ smask_group->group_res.id);
-+ } else {
-+ status = _cairo_pdf_surface_select_pattern (surface, group->source, pattern_res, FALSE);
-+ if (unlikely (status))
-+ return status;
-+
-+ _cairo_output_stream_printf (surface->output,
-+ "%f %f %f %f re f\n",
-+ bbox.p1.x,
-+ bbox.p1.y,
-+ bbox.p2.x - bbox.p1.x,
-+ bbox.p2.y - bbox.p1.y);
-+
-+ status = _cairo_pdf_surface_unselect_pattern (surface);
-+ if (unlikely (status))
-+ return status;
-+ }
- }
-
- status = _cairo_pdf_surface_close_group (surface, NULL);
---
-cgit v0.9.0.2-2-gbebe
-From 9fcbe25c2dcf831783bb0fd20af9754c0b5c409b Mon Sep 17 00:00:00 2001
-From: Maarten Bosmans <mkbosmans@gmail.com>
-Date: Mon, 09 Apr 2012 19:33:50 +0000
-Subject: Protect code using dlfcn.h with CAIRO_HAS_DLSYM
-
----
-diff --git a/configure.ac b/configure.ac
-index cedfebe..5d2e6ec 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -52,6 +52,7 @@ AM_CONDITIONAL(CAIRO_HAS_DL, test "x$have_dl" = "xyes")
- if test "x$have_dlsym" = "xyes"; then
- AC_DEFINE([CAIRO_HAS_DLSYM], 1, [Define to 1 if dlsym is available])
- fi
-+AM_CONDITIONAL(CAIRO_HAS_DLSYM, test "x$have_dlsym" = "xyes")
-
- dnl ===========================================================================
-
-diff --git a/util/Makefile.am b/util/Makefile.am
-index f202f35..82d0a80 100644
---- a/util/Makefile.am
-+++ b/util/Makefile.am
-@@ -12,20 +12,24 @@ endif
-
- if CAIRO_HAS_TRACE
- SUBDIRS += cairo-trace
-+if CAIRO_HAS_DLSYM
- if CAIRO_HAS_SCRIPT_SURFACE
- if CAIRO_HAS_TEE_SURFACE
- SUBDIRS += cairo-fdr
- endif
- endif
- endif
-+endif
-
- if BUILD_SPHINX
-+if CAIRO_HAS_DLSYM
- if CAIRO_HAS_SCRIPT_SURFACE
- if CAIRO_HAS_TEE_SURFACE
- SUBDIRS += cairo-sphinx
- endif
- endif
- endif
-+endif
-
- AM_CPPFLAGS = -I$(top_srcdir)/src \
- -I$(top_builddir)/src \
---
-cgit v0.9.0.2-2-gbebe
-From c7b86ab97be1d3d3ccf43b652832f148a2fcf290 Mon Sep 17 00:00:00 2001
-From: Adrian Johnson <ajohnson@redneon.com>
-Date: Tue, 10 Apr 2012 13:04:05 +0000
-Subject: any2ppm: fix missing enumeration warning
-
----
-diff --git a/test/any2ppm.c b/test/any2ppm.c
-index 6b61c47..2403347 100644
---- a/test/any2ppm.c
-+++ b/test/any2ppm.c
-@@ -193,6 +193,7 @@ write_ppm (cairo_surface_t *surface, int fd)
- break;
- case CAIRO_FORMAT_A1:
- case CAIRO_FORMAT_RGB16_565:
-+ case CAIRO_FORMAT_RGB30:
- case CAIRO_FORMAT_INVALID:
- default:
- return "unhandled image format";
---
-cgit v0.9.0.2-2-gbebe
-From 09de481ce5f6ed1c38c0d5bf3af7c60642c4c947 Mon Sep 17 00:00:00 2001
-From: Gilles Espinasse <g.esp@free.fr>
-Date: Sat, 07 Apr 2012 21:09:51 +0000
-Subject: Cosmetic configure fix
-
-'how to allow undefined symbols in shared libraries' test should use CAIRO_CC_TRY_FLAG_SILENT or configure display is a bit out of order like this
-
-checking how to allow undefined symbols in shared libraries used by test suite... checking whether gcc supports -Wl,--allow-shlib-undefined... yes
--Wl,--allow-shlib-undefined
-
-Signed-off-by: Gilles Espinasse <g.esp@free.fr>
-Signed-off-by: Uli Schlachter <psychon@znc.in>
----
-diff --git a/build/configure.ac.warnings b/build/configure.ac.warnings
-index f1b17f4..3b2c6f3 100644
---- a/build/configure.ac.warnings
-+++ b/build/configure.ac.warnings
-@@ -89,7 +89,7 @@ AC_DEFINE_UNQUOTED([WARN_UNUSED_RESULT], [$cairo_cv_warn_unused_result],
-
- dnl check linker flags
- AC_CACHE_CHECK([how to allow undefined symbols in shared libraries used by test suite], cairo_cv_test_undefined_ldflags,
-- [CAIRO_CC_TRY_FLAG([-Wl,--allow-shlib-undefined], [],
-+ [CAIRO_CC_TRY_FLAG_SILENT([-Wl,--allow-shlib-undefined], [],
- [cairo_cv_test_undefined_ldflags="-Wl,--allow-shlib-undefined]")])
- CAIRO_TEST_UNDEFINED_LDFLAGS="$cairo_cv_test_undefined_ldflags"
- AC_SUBST(CAIRO_TEST_UNDEFINED_LDFLAGS)
---
-cgit v0.9.0.2-2-gbebe
-From 07fc63676dfdaa57ed919ad7be8f59c97c615473 Mon Sep 17 00:00:00 2001
-From: Uli Schlachter <psychon@znc.in>
-Date: Wed, 11 Apr 2012 19:37:55 +0000
-Subject: xlib: Disable fallback compositor with xlib-xcb
-
-When xlib-xcb is enabled, this is just dead code which is never used. Thus, this
-shouldn't hurt. However, this does include cairo-xlib-private.h. Shouldn't be a
-problem? Well, that header contains static inline functions which some compiler
-on Solaris will emit even when they are unused.
-
-This brings us to the real problem: That static inline function refers to a
-function which isn't compiled with xlib-xcb and thus linking fails with
-undefined symbols.
-
-This can be reproduced with GCC by adding a call to
-_cairo_xlib_screen_put_gc(NULL, NULL, 0, 0); to
-_cairo_xlib_fallback_compositor_get.
-
-Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48489
-Signed-off-by: Uli Schlachter <psychon@znc.in>
----
-diff --git a/src/cairo-xlib-fallback-compositor.c b/src/cairo-xlib-fallback-compositor.c
-index 5391926..7d45cd1 100644
---- a/src/cairo-xlib-fallback-compositor.c
-+++ b/src/cairo-xlib-fallback-compositor.c
-@@ -42,6 +42,8 @@
-
- #include "cairoint.h"
-
-+#if !CAIRO_HAS_XLIB_XCB_FUNCTIONS
-+
- #include "cairo-xlib-private.h"
-
- #include "cairo-compositor-private.h"
-@@ -52,3 +54,5 @@ _cairo_xlib_fallback_compositor_get (void)
- /* XXX Do something interesting here to mitigate fallbacks ala xcb */
- return &_cairo_fallback_compositor;
- }
-+
-+#endif /* !CAIRO_HAS_XLIB_XCB_FUNCTIONS */
---
-cgit v0.9.0.2-2-gbebe
diff --git a/extra/cairo/revert-xlib-Simplify-source-creation-by-use-of-map-to-image.patch b/extra/cairo/revert-xlib-Simplify-source-creation-by-use-of-map-to-image.patch
deleted file mode 100644
index ffd324252..000000000
--- a/extra/cairo/revert-xlib-Simplify-source-creation-by-use-of-map-to-image.patch
+++ /dev/null
@@ -1,144 +0,0 @@
-From a73e7ff0186176bc82cd3ae1432c054c1fd3aebd Mon Sep 17 00:00:00 2001
-From: Chris Wilson <chris@chris-wilson.co.uk>
-Date: Sun, 06 Jan 2013 11:29:27 +0000
-Subject: xlib: Simplify source creation by use of map-to-image
-
-We were open-coding the functionality of map-to-image inside the source
-creation routines. so refactor to actually use map-to-image instead.
-
-Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
----
-diff --git a/src/cairo-xlib-source.c b/src/cairo-xlib-source.c
-index e312222..d08052a 100644
---- a/src/cairo-xlib-source.c
-+++ b/src/cairo-xlib-source.c
-@@ -898,9 +898,6 @@ surface_source (cairo_xlib_surface_t *dst,
- cairo_surface_pattern_t local_pattern;
- cairo_status_t status;
- cairo_rectangle_int_t upload, limit;
-- cairo_matrix_t m;
-- pixman_format_code_t format;
-- int draw_x, draw_y;
-
- src = pattern->surface;
- if (src->type == CAIRO_SURFACE_TYPE_IMAGE &&
-@@ -910,7 +907,6 @@ surface_source (cairo_xlib_surface_t *dst,
-
- cairo_surface_reference (src);
-
--prepare_shm_image:
- proxy = malloc (sizeof(*proxy));
- if (unlikely (proxy == NULL)) {
- cairo_surface_destroy (src);
-@@ -954,46 +950,47 @@ prepare_shm_image:
- }
- }
-
-- if (_cairo_surface_is_image (src))
-- format = ((cairo_image_surface_t *)src)->pixman_format;
-- else
-- format = _cairo_format_to_pixman_format_code (_cairo_format_from_content (src->content));
-- src = _cairo_xlib_surface_create_shm (dst, format,
-- upload.width, upload.height);
-- if (src == NULL) {
-- if (_cairo_surface_is_image (pattern->surface)) {
-- draw_x = upload.x;
-- draw_y = upload.y;
-- src = cairo_surface_reference (pattern->surface);
-- goto skip_paint;
-- }
--
-- src = _cairo_image_surface_create_with_pixman_format (NULL,
-- format,
-- upload.width,
-- upload.height,
-- 0);
-+ xsrc = (cairo_xlib_surface_t *)
-+ _cairo_surface_create_similar_scratch (&dst->base,
-+ src->content,
-+ upload.width,
-+ upload.height);
-+ if (xsrc->base.type != CAIRO_SURFACE_TYPE_XLIB) {
-+ cairo_surface_destroy (src);
-+ cairo_surface_destroy (&xsrc->base);
-+ return None;
- }
-
-- _cairo_pattern_init_for_surface (&local_pattern, pattern->surface);
-- cairo_matrix_init_translate (&local_pattern.base.matrix,
-- upload.x, upload.y);
-+ if (_cairo_surface_is_image (src)) {
-+ status = _cairo_xlib_surface_draw_image (xsrc, (cairo_image_surface_t *)src,
-+ upload.x, upload.y,
-+ upload.width, upload.height,
-+ 0, 0);
-+ } else {
-+ cairo_image_surface_t *image;
-
-- status = _cairo_surface_paint (src,
-- CAIRO_OPERATOR_SOURCE,
-- &local_pattern.base,
-- NULL);
-- _cairo_pattern_fini (&local_pattern.base);
-+ image = _cairo_surface_map_to_image (&xsrc->base, NULL);
-
-- if (unlikely (status)) {
-- cairo_surface_destroy (src);
-- return _cairo_surface_create_in_error (status);
-+ _cairo_pattern_init_for_surface (&local_pattern, pattern->surface);
-+ cairo_matrix_init_translate (&local_pattern.base.matrix,
-+ upload.x, upload.y);
-+
-+ status = _cairo_surface_paint (&image->base,
-+ CAIRO_OPERATOR_SOURCE,
-+ &local_pattern.base,
-+ NULL);
-+ _cairo_pattern_fini (&local_pattern.base);
-+
-+ status = _cairo_surface_unmap_image (&xsrc->base, image);
-+ if (unlikely (status)) {
-+ cairo_surface_destroy (src);
-+ return _cairo_surface_create_in_error (status);
-+ }
- }
-
-- draw_x = draw_y = 0;
--skip_paint:
- _cairo_pattern_init_static_copy (&local_pattern.base, &pattern->base);
- if (upload.x | upload.y) {
-+ cairo_matrix_t m;
- cairo_matrix_init_translate (&m, -upload.x, -upload.y);
- cairo_matrix_multiply (&local_pattern.base.matrix,
- &local_pattern.base.matrix,
-@@ -1001,29 +998,6 @@ skip_paint:
- }
-
- *src_x = *src_y = 0;
-- if (src->device == dst->base.device &&
-- _cairo_xlib_shm_surface_get_pixmap (src)) {
-- pattern = &local_pattern;
-- goto prepare_shm_image;
-- }
--
-- xsrc = (cairo_xlib_surface_t *)
-- _cairo_surface_create_similar_scratch (&dst->base,
-- src->content,
-- upload.width,
-- upload.height);
-- if (xsrc->base.type != CAIRO_SURFACE_TYPE_XLIB) {
-- cairo_surface_destroy (src);
-- cairo_surface_destroy (&xsrc->base);
-- return None;
-- }
--
-- status = _cairo_xlib_surface_draw_image (xsrc, (cairo_image_surface_t *)src,
-- draw_x, draw_y,
-- upload.width, upload.height,
-- 0, 0);
-- cairo_surface_destroy (src);
--
- _cairo_xlib_surface_ensure_picture (xsrc);
- if (! picture_set_properties (xsrc->display,
- xsrc->picture,
---
-cgit v0.9.0.2-2-gbebe
diff --git a/extra/cairo/revert-xlib-map-to-image-requires-an-extents.patch b/extra/cairo/revert-xlib-map-to-image-requires-an-extents.patch
deleted file mode 100644
index ccc1ebf47..000000000
--- a/extra/cairo/revert-xlib-map-to-image-requires-an-extents.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From dd20c1f4d6419238bbb37fb93a48986f83c6e6c2 Mon Sep 17 00:00:00 2001
-From: Chris Wilson <chris@chris-wilson.co.uk>
-Date: Wed, 09 Jan 2013 12:38:09 +0000
-Subject: xlib: map-to-image requires an extents
-
-Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
----
-diff --git a/src/cairo-xlib-source.c b/src/cairo-xlib-source.c
-index d08052a..0689d82 100644
---- a/src/cairo-xlib-source.c
-+++ b/src/cairo-xlib-source.c
-@@ -968,8 +968,9 @@ surface_source (cairo_xlib_surface_t *dst,
- 0, 0);
- } else {
- cairo_image_surface_t *image;
-+ cairo_rectangle_int_t map_extents = { 0,0, upload.width,upload.height };
-
-- image = _cairo_surface_map_to_image (&xsrc->base, NULL);
-+ image = _cairo_surface_map_to_image (&xsrc->base, &map_extents);
-
- _cairo_pattern_init_for_surface (&local_pattern, pattern->surface);
- cairo_matrix_init_translate (&local_pattern.base.matrix,
---
-cgit v0.9.0.2-2-gbebe