Tue, 06 Jan 2015 21:39:09 +0100
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-gstate.c b/gfx/cairo/cairo/src/cairo-gstate.c |
michael@0 | 2 | --- a/gfx/cairo/cairo/src/cairo-gstate.c |
michael@0 | 3 | +++ b/gfx/cairo/cairo/src/cairo-gstate.c |
michael@0 | 4 | @@ -1673,26 +1673,31 @@ _cairo_gstate_show_text_glyphs (cairo_gs |
michael@0 | 5 | |
michael@0 | 6 | source_pattern = &source_pattern_stack.base; |
michael@0 | 7 | status = _cairo_gstate_copy_transformed_source (gstate, &source_pattern); |
michael@0 | 8 | if (unlikely (status)) |
michael@0 | 9 | goto CLEANUP_GLYPHS; |
michael@0 | 10 | |
michael@0 | 11 | /* For really huge font sizes, we can just do path;fill instead of |
michael@0 | 12 | * show_glyphs, as show_glyphs would put excess pressure on the cache, |
michael@0 | 13 | - * and moreover, not all components below us correctly handle huge font |
michael@0 | 14 | - * sizes. I wanted to set the limit at 256. But alas, seems like cairo's |
michael@0 | 15 | + * not all components below us correctly handle huge font sizes, and |
michael@0 | 16 | + * path filling can be cheaper since parts of glyphs are likely to be |
michael@0 | 17 | + * clipped out. 256 seems like a good limit. But alas, seems like cairo's |
michael@0 | 18 | * rasterizer is something like ten times slower than freetype's for huge |
michael@0 | 19 | - * sizes. So, no win just yet. For now, do it for insanely-huge sizes, |
michael@0 | 20 | - * just to make sure we don't make anyone unhappy. When we get a really |
michael@0 | 21 | - * fast rasterizer in cairo, we may want to readjust this. |
michael@0 | 22 | + * sizes. So, no win just yet when we're using cairo's rasterizer. |
michael@0 | 23 | + * For now, if we're using cairo's rasterizer, use path filling only |
michael@0 | 24 | + * for insanely-huge sizes, just to make sure we don't make anyone |
michael@0 | 25 | + * unhappy. When we get a really fast rasterizer in cairo, we may |
michael@0 | 26 | + * want to readjust this. The threshold calculation is |
michael@0 | 27 | + * encapsulated in _cairo_surface_get_text_path_fill_threshold. |
michael@0 | 28 | * |
michael@0 | 29 | * Needless to say, do this only if show_text_glyphs is not available. */ |
michael@0 | 30 | if (cairo_surface_has_show_text_glyphs (gstate->target) || |
michael@0 | 31 | - _cairo_scaled_font_get_max_scale (gstate->scaled_font) <= 10240) { |
michael@0 | 32 | + _cairo_scaled_font_get_max_scale (gstate->scaled_font) <= |
michael@0 | 33 | + _cairo_surface_get_text_path_fill_threshold (gstate->target)) { |
michael@0 | 34 | status = _cairo_surface_show_text_glyphs (gstate->target, |
michael@0 | 35 | gstate->op, |
michael@0 | 36 | source_pattern, |
michael@0 | 37 | utf8, utf8_len, |
michael@0 | 38 | transformed_glyphs, num_glyphs, |
michael@0 | 39 | transformed_clusters, num_clusters, |
michael@0 | 40 | cluster_flags, |
michael@0 | 41 | gstate->scaled_font, NULL); |
michael@0 | 42 | diff --git a/gfx/cairo/cairo/src/cairo-surface.c b/gfx/cairo/cairo/src/cairo-surface.c |
michael@0 | 43 | --- a/gfx/cairo/cairo/src/cairo-surface.c |
michael@0 | 44 | +++ b/gfx/cairo/cairo/src/cairo-surface.c |
michael@0 | 45 | @@ -1120,16 +1120,22 @@ cairo_surface_get_fallback_resolution (c |
michael@0 | 46 | double *y_pixels_per_inch) |
michael@0 | 47 | { |
michael@0 | 48 | if (x_pixels_per_inch) |
michael@0 | 49 | *x_pixels_per_inch = surface->x_fallback_resolution; |
michael@0 | 50 | if (y_pixels_per_inch) |
michael@0 | 51 | *y_pixels_per_inch = surface->y_fallback_resolution; |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | +int |
michael@0 | 55 | +_cairo_surface_get_text_path_fill_threshold (const cairo_surface_t *surface) |
michael@0 | 56 | +{ |
michael@0 | 57 | + return surface->backend->fill == NULL ? 10240 : 256; |
michael@0 | 58 | +} |
michael@0 | 59 | + |
michael@0 | 60 | cairo_bool_t |
michael@0 | 61 | _cairo_surface_has_device_transform (cairo_surface_t *surface) |
michael@0 | 62 | { |
michael@0 | 63 | return ! _cairo_matrix_is_identity (&surface->device_transform); |
michael@0 | 64 | } |
michael@0 | 65 | |
michael@0 | 66 | /** |
michael@0 | 67 | * _cairo_surface_acquire_source_image: |
michael@0 | 68 | diff --git a/gfx/cairo/cairo/src/cairoint.h b/gfx/cairo/cairo/src/cairoint.h |
michael@0 | 69 | --- a/gfx/cairo/cairo/src/cairoint.h |
michael@0 | 70 | +++ b/gfx/cairo/cairo/src/cairoint.h |
michael@0 | 71 | @@ -2065,16 +2065,19 @@ _cairo_surface_composite_shape_fixup_unb |
michael@0 | 72 | int dst_x, |
michael@0 | 73 | int dst_y, |
michael@0 | 74 | unsigned int width, |
michael@0 | 75 | unsigned int height); |
michael@0 | 76 | |
michael@0 | 77 | cairo_private cairo_bool_t |
michael@0 | 78 | _cairo_surface_is_opaque (const cairo_surface_t *surface); |
michael@0 | 79 | |
michael@0 | 80 | +cairo_private int |
michael@0 | 81 | +_cairo_surface_get_text_path_fill_threshold (const cairo_surface_t *surface); |
michael@0 | 82 | + |
michael@0 | 83 | cairo_private void |
michael@0 | 84 | _cairo_surface_set_device_scale (cairo_surface_t *surface, |
michael@0 | 85 | double sx, |
michael@0 | 86 | double sy); |
michael@0 | 87 | |
michael@0 | 88 | cairo_private cairo_bool_t |
michael@0 | 89 | _cairo_surface_has_device_transform (cairo_surface_t *surface); |
michael@0 | 90 |