gfx/cairo/text-path-filling-threshold.patch

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/cairo/text-path-filling-threshold.patch	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,90 @@
     1.4 +diff --git a/gfx/cairo/cairo/src/cairo-gstate.c b/gfx/cairo/cairo/src/cairo-gstate.c
     1.5 +--- a/gfx/cairo/cairo/src/cairo-gstate.c
     1.6 ++++ b/gfx/cairo/cairo/src/cairo-gstate.c
     1.7 +@@ -1673,26 +1673,31 @@ _cairo_gstate_show_text_glyphs (cairo_gs
     1.8 + 
     1.9 +     source_pattern = &source_pattern_stack.base;
    1.10 +     status = _cairo_gstate_copy_transformed_source (gstate, &source_pattern);
    1.11 +     if (unlikely (status))
    1.12 + 	goto CLEANUP_GLYPHS;
    1.13 + 
    1.14 +     /* For really huge font sizes, we can just do path;fill instead of
    1.15 +      * show_glyphs, as show_glyphs would put excess pressure on the cache,
    1.16 +-     * and moreover, not all components below us correctly handle huge font
    1.17 +-     * sizes.  I wanted to set the limit at 256.  But alas, seems like cairo's
    1.18 ++     * not all components below us correctly handle huge font sizes, and
    1.19 ++     * path filling can be cheaper since parts of glyphs are likely to be
    1.20 ++     * clipped out.  256 seems like a good limit.  But alas, seems like cairo's
    1.21 +      * rasterizer is something like ten times slower than freetype's for huge
    1.22 +-     * sizes.  So, no win just yet.  For now, do it for insanely-huge sizes,
    1.23 +-     * just to make sure we don't make anyone unhappy.  When we get a really
    1.24 +-     * fast rasterizer in cairo, we may want to readjust this.
    1.25 ++     * sizes.  So, no win just yet when we're using cairo's rasterizer.
    1.26 ++     * For now, if we're using cairo's rasterizer, use path filling only
    1.27 ++     * for insanely-huge sizes, just to make sure we don't make anyone
    1.28 ++     * unhappy.  When we get a really fast rasterizer in cairo, we may
    1.29 ++     * want to readjust this.  The threshold calculation is
    1.30 ++     * encapsulated in _cairo_surface_get_text_path_fill_threshold.
    1.31 +      *
    1.32 +      * Needless to say, do this only if show_text_glyphs is not available. */
    1.33 +     if (cairo_surface_has_show_text_glyphs (gstate->target) ||
    1.34 +-	_cairo_scaled_font_get_max_scale (gstate->scaled_font) <= 10240) {
    1.35 ++	_cairo_scaled_font_get_max_scale (gstate->scaled_font) <=
    1.36 ++	_cairo_surface_get_text_path_fill_threshold (gstate->target)) {
    1.37 + 	status = _cairo_surface_show_text_glyphs (gstate->target,
    1.38 + 						  gstate->op,
    1.39 + 						  source_pattern,
    1.40 + 						  utf8, utf8_len,
    1.41 + 						  transformed_glyphs, num_glyphs,
    1.42 + 						  transformed_clusters, num_clusters,
    1.43 + 						  cluster_flags,
    1.44 + 						  gstate->scaled_font, NULL);
    1.45 +diff --git a/gfx/cairo/cairo/src/cairo-surface.c b/gfx/cairo/cairo/src/cairo-surface.c
    1.46 +--- a/gfx/cairo/cairo/src/cairo-surface.c
    1.47 ++++ b/gfx/cairo/cairo/src/cairo-surface.c
    1.48 +@@ -1120,16 +1120,22 @@ cairo_surface_get_fallback_resolution (c
    1.49 + 				       double		*y_pixels_per_inch)
    1.50 + {
    1.51 +     if (x_pixels_per_inch)
    1.52 + 	*x_pixels_per_inch = surface->x_fallback_resolution;
    1.53 +     if (y_pixels_per_inch)
    1.54 + 	*y_pixels_per_inch = surface->y_fallback_resolution;
    1.55 + }
    1.56 + 
    1.57 ++int
    1.58 ++_cairo_surface_get_text_path_fill_threshold (const cairo_surface_t *surface)
    1.59 ++{
    1.60 ++    return surface->backend->fill == NULL ? 10240 : 256;
    1.61 ++}
    1.62 ++
    1.63 + cairo_bool_t
    1.64 + _cairo_surface_has_device_transform (cairo_surface_t *surface)
    1.65 + {
    1.66 +     return ! _cairo_matrix_is_identity (&surface->device_transform);
    1.67 + }
    1.68 + 
    1.69 + /**
    1.70 +  * _cairo_surface_acquire_source_image:
    1.71 +diff --git a/gfx/cairo/cairo/src/cairoint.h b/gfx/cairo/cairo/src/cairoint.h
    1.72 +--- a/gfx/cairo/cairo/src/cairoint.h
    1.73 ++++ b/gfx/cairo/cairo/src/cairoint.h
    1.74 +@@ -2065,16 +2065,19 @@ _cairo_surface_composite_shape_fixup_unb
    1.75 + 						int			    dst_x,
    1.76 + 						int			    dst_y,
    1.77 + 						unsigned int		    width,
    1.78 + 						unsigned int		    height);
    1.79 + 
    1.80 + cairo_private cairo_bool_t
    1.81 + _cairo_surface_is_opaque (const cairo_surface_t *surface);
    1.82 + 
    1.83 ++cairo_private int
    1.84 ++_cairo_surface_get_text_path_fill_threshold (const cairo_surface_t *surface);
    1.85 ++
    1.86 + cairo_private void
    1.87 + _cairo_surface_set_device_scale (cairo_surface_t *surface,
    1.88 + 				 double		  sx,
    1.89 + 				 double		  sy);
    1.90 + 
    1.91 + cairo_private cairo_bool_t
    1.92 + _cairo_surface_has_device_transform (cairo_surface_t *surface);
    1.93 + 

mercurial