gfx/cairo/xlib-flush-glyphs.patch

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 diff --git a/gfx/cairo/cairo/src/cairo-xlib-surface.c b/gfx/cairo/cairo/src/cairo-xlib-surface.c
michael@0 2 index f0de3c7..e24c962 100644
michael@0 3 --- a/gfx/cairo/cairo/src/cairo-xlib-surface.c
michael@0 4 +++ b/gfx/cairo/cairo/src/cairo-xlib-surface.c
michael@0 5 @@ -50,35 +50,36 @@
michael@0 6 #include "cairo-xlib-private.h"
michael@0 7 #include "cairo-xlib-surface-private.h"
michael@0 8 #include "cairo-clip-private.h"
michael@0 9 #include "cairo-error-private.h"
michael@0 10 #include "cairo-scaled-font-private.h"
michael@0 11 #include "cairo-surface-snapshot-private.h"
michael@0 12 #include "cairo-surface-subsurface-private.h"
michael@0 13 #include "cairo-region-private.h"
michael@0 14 +#include "cairo-xlib-xrender-private.h"
michael@0 15
michael@0 16 #include <X11/Xutil.h> /* for XDestroyImage */
michael@0 17 +#include <X11/Xlibint.h> /* for access to XDisplay's innards */
michael@0 18
michael@0 19 #define XLIB_COORD_MAX 32767
michael@0 20
michael@0 21 #define DEBUG 0
michael@0 22
michael@0 23 #if DEBUG
michael@0 24 #define UNSUPPORTED(reason) \
michael@0 25 fprintf (stderr, \
michael@0 26 "cairo-xlib: hit unsupported operation %s(), line %d: %s\n", \
michael@0 27 __FUNCTION__, __LINE__, reason), \
michael@0 28 CAIRO_INT_STATUS_UNSUPPORTED
michael@0 29 #else
michael@0 30 #define UNSUPPORTED(reason) CAIRO_INT_STATUS_UNSUPPORTED
michael@0 31 #endif
michael@0 32
michael@0 33 #if DEBUG
michael@0 34 -#include <X11/Xlibint.h>
michael@0 35 static void CAIRO_PRINTF_FORMAT (2, 3)
michael@0 36 _x_bread_crumb (Display *dpy,
michael@0 37 const char *fmt,
michael@0 38 ...)
michael@0 39 {
michael@0 40 xReq *req;
michael@0 41 char buf[2048];
michael@0 42 unsigned int len, len_dwords;
michael@0 43 @@ -4313,16 +4314,23 @@ _cairo_xlib_surface_add_glyph (cairo_xlib_display_t *display,
michael@0 44 }
michael@0 45 break;
michael@0 46 default:
michael@0 47 ASSERT_NOT_REACHED;
michael@0 48 break;
michael@0 49 }
michael@0 50 /* XXX assume X server wants pixman padding. Xft assumes this as well */
michael@0 51
michael@0 52 + struct _XDisplay *dpy = (struct _XDisplay *) display->display;
michael@0 53 + int req_length = sz_xRenderAddGlyphsReq + 4;
michael@0 54 + if (req_length & 3)
michael@0 55 + req_length += 4 - (req_length & 3);
michael@0 56 + if (dpy->bufptr + req_length > dpy->bufmax)
michael@0 57 + XFlush (display->display);
michael@0 58 +
michael@0 59 XRenderAddGlyphs (display->display, glyphset_info->glyphset,
michael@0 60 &glyph_index, &glyph_info, 1,
michael@0 61 (char *) data,
michael@0 62 glyph_surface->stride * glyph_surface->height);
michael@0 63
michael@0 64 if (data != glyph_surface->data)
michael@0 65 free (data);
michael@0 66

mercurial