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

41 lines
2.2 KiB
Diff
Raw Normal View History

diff --git a/gfx/cairo/cairo/src/cairo-gstate.c b/gfx/cairo/cairo/src/cairo-gstate.c
--- a/gfx/cairo/cairo/src/cairo-gstate.c
+++ b/gfx/cairo/cairo/src/cairo-gstate.c
@@ -1673,26 +1673,30 @@ _cairo_gstate_show_text_glyphs (cairo_gs
source_pattern = &source_pattern_stack.base;
status = _cairo_gstate_copy_transformed_source (gstate, &source_pattern);
if (unlikely (status))
goto CLEANUP_GLYPHS;
/* For really huge font sizes, we can just do path;fill instead of
* show_glyphs, as show_glyphs would put excess pressure on the cache,
- * and moreover, not all components below us correctly handle huge font
- * sizes. I wanted to set the limit at 256. But alas, seems like cairo's
+ * not all components below us correctly handle huge font sizes, and
+ * path filling can be cheaper since parts of glyphs are likely to be
+ * clipped out. 256 seems like a good limit. But alas, seems like cairo's
* rasterizer is something like ten times slower than freetype's for huge
- * sizes. So, no win just yet. For now, do it for insanely-huge sizes,
- * just to make sure we don't make anyone unhappy. When we get a really
- * fast rasterizer in cairo, we may want to readjust this.
+ * sizes. So, no win just yet when we're using cairo's rasterizer.
+ * For now, if we're using cairo's rasterizer, use path filling only
+ * for insanely-huge sizes, just to make sure we don't make anyone
+ * unhappy. When we get a really fast rasterizer in cairo, we may
+ * want to readjust this.
*
* Needless to say, do this only if show_text_glyphs is not available. */
+ int path_fill_threshold = gstate->target->backend->fill ? 256 : 10240;
if (cairo_surface_has_show_text_glyphs (gstate->target) ||
- _cairo_scaled_font_get_max_scale (gstate->scaled_font) <= 10240) {
+ _cairo_scaled_font_get_max_scale (gstate->scaled_font) <= path_fill_threshold) {
status = _cairo_surface_show_text_glyphs (gstate->target,
gstate->op,
source_pattern,
utf8, utf8_len,
transformed_glyphs, num_glyphs,
transformed_clusters, num_clusters,
cluster_flags,
gstate->scaled_font, NULL);