michael@0: diff --git a/gfx/cairo/cairo/src/cairo-gstate.c b/gfx/cairo/cairo/src/cairo-gstate.c michael@0: --- a/gfx/cairo/cairo/src/cairo-gstate.c michael@0: +++ b/gfx/cairo/cairo/src/cairo-gstate.c michael@0: @@ -1673,26 +1673,31 @@ _cairo_gstate_show_text_glyphs (cairo_gs michael@0: michael@0: source_pattern = &source_pattern_stack.base; michael@0: status = _cairo_gstate_copy_transformed_source (gstate, &source_pattern); michael@0: if (unlikely (status)) michael@0: goto CLEANUP_GLYPHS; michael@0: michael@0: /* For really huge font sizes, we can just do path;fill instead of michael@0: * show_glyphs, as show_glyphs would put excess pressure on the cache, michael@0: - * and moreover, not all components below us correctly handle huge font michael@0: - * sizes. I wanted to set the limit at 256. But alas, seems like cairo's michael@0: + * not all components below us correctly handle huge font sizes, and michael@0: + * path filling can be cheaper since parts of glyphs are likely to be michael@0: + * clipped out. 256 seems like a good limit. But alas, seems like cairo's michael@0: * rasterizer is something like ten times slower than freetype's for huge michael@0: - * sizes. So, no win just yet. For now, do it for insanely-huge sizes, michael@0: - * just to make sure we don't make anyone unhappy. When we get a really michael@0: - * fast rasterizer in cairo, we may want to readjust this. michael@0: + * sizes. So, no win just yet when we're using cairo's rasterizer. michael@0: + * For now, if we're using cairo's rasterizer, use path filling only michael@0: + * for insanely-huge sizes, just to make sure we don't make anyone michael@0: + * unhappy. When we get a really fast rasterizer in cairo, we may michael@0: + * want to readjust this. The threshold calculation is michael@0: + * encapsulated in _cairo_surface_get_text_path_fill_threshold. michael@0: * michael@0: * Needless to say, do this only if show_text_glyphs is not available. */ michael@0: if (cairo_surface_has_show_text_glyphs (gstate->target) || michael@0: - _cairo_scaled_font_get_max_scale (gstate->scaled_font) <= 10240) { michael@0: + _cairo_scaled_font_get_max_scale (gstate->scaled_font) <= michael@0: + _cairo_surface_get_text_path_fill_threshold (gstate->target)) { michael@0: status = _cairo_surface_show_text_glyphs (gstate->target, michael@0: gstate->op, michael@0: source_pattern, michael@0: utf8, utf8_len, michael@0: transformed_glyphs, num_glyphs, michael@0: transformed_clusters, num_clusters, michael@0: cluster_flags, michael@0: gstate->scaled_font, NULL); michael@0: diff --git a/gfx/cairo/cairo/src/cairo-surface.c b/gfx/cairo/cairo/src/cairo-surface.c michael@0: --- a/gfx/cairo/cairo/src/cairo-surface.c michael@0: +++ b/gfx/cairo/cairo/src/cairo-surface.c michael@0: @@ -1120,16 +1120,22 @@ cairo_surface_get_fallback_resolution (c michael@0: double *y_pixels_per_inch) michael@0: { michael@0: if (x_pixels_per_inch) michael@0: *x_pixels_per_inch = surface->x_fallback_resolution; michael@0: if (y_pixels_per_inch) michael@0: *y_pixels_per_inch = surface->y_fallback_resolution; michael@0: } michael@0: michael@0: +int michael@0: +_cairo_surface_get_text_path_fill_threshold (const cairo_surface_t *surface) michael@0: +{ michael@0: + return surface->backend->fill == NULL ? 10240 : 256; michael@0: +} michael@0: + michael@0: cairo_bool_t michael@0: _cairo_surface_has_device_transform (cairo_surface_t *surface) michael@0: { michael@0: return ! _cairo_matrix_is_identity (&surface->device_transform); michael@0: } michael@0: michael@0: /** michael@0: * _cairo_surface_acquire_source_image: michael@0: diff --git a/gfx/cairo/cairo/src/cairoint.h b/gfx/cairo/cairo/src/cairoint.h michael@0: --- a/gfx/cairo/cairo/src/cairoint.h michael@0: +++ b/gfx/cairo/cairo/src/cairoint.h michael@0: @@ -2065,16 +2065,19 @@ _cairo_surface_composite_shape_fixup_unb michael@0: int dst_x, michael@0: int dst_y, michael@0: unsigned int width, michael@0: unsigned int height); michael@0: michael@0: cairo_private cairo_bool_t michael@0: _cairo_surface_is_opaque (const cairo_surface_t *surface); michael@0: michael@0: +cairo_private int michael@0: +_cairo_surface_get_text_path_fill_threshold (const cairo_surface_t *surface); michael@0: + michael@0: cairo_private void michael@0: _cairo_surface_set_device_scale (cairo_surface_t *surface, michael@0: double sx, michael@0: double sy); michael@0: michael@0: cairo_private cairo_bool_t michael@0: _cairo_surface_has_device_transform (cairo_surface_t *surface); michael@0: