summaryrefslogtreecommitdiff
path: root/pango/pangocairo-context.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2007-10-24 19:31:42 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2007-10-24 19:31:42 +0000
commit8533dce574f457267d62e32c0cb8ae1114b899a8 (patch)
treeaf21aab2e0d4fca28c677bb6201d4800902a3328 /pango/pangocairo-context.c
parent2ccf75919f04018d9286f53f1954288a8f91547c (diff)
downloadpango-8533dce574f457267d62e32c0cb8ae1114b899a8.tar.gz
Bug 471568 – Optimizations in _pango_cairo_update_context()
2007-10-24 Behdad Esfahbod <behdad@gnome.org> Bug 471568 – Optimizations in _pango_cairo_update_context() * pango/pangocairo-context.c (_pango_cairo_update_context): Skip change notification about matrix changes if merged font options for the context set metrics hinting to off. svn path=/trunk/; revision=2471
Diffstat (limited to 'pango/pangocairo-context.c')
-rw-r--r--pango/pangocairo-context.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/pango/pangocairo-context.c b/pango/pangocairo-context.c
index 53cabfc6..1948ebc9 100644
--- a/pango/pangocairo-context.c
+++ b/pango/pangocairo-context.c
@@ -90,29 +90,12 @@ _pango_cairo_update_context (cairo_t *cr,
cairo_matrix_t cairo_matrix;
cairo_surface_t *target;
PangoMatrix pango_matrix;
- const PangoMatrix *layout_matrix, identity_matrix = PANGO_MATRIX_INIT;
+ const PangoMatrix *current_matrix, identity_matrix = PANGO_MATRIX_INIT;
+ const cairo_font_options_t *merged_options;
gboolean changed = FALSE;
info = get_context_info (context, TRUE);
- cairo_get_matrix (cr, &cairo_matrix);
- pango_matrix.xx = cairo_matrix.xx;
- pango_matrix.yx = cairo_matrix.yx;
- pango_matrix.xy = cairo_matrix.xy;
- pango_matrix.yy = cairo_matrix.yy;
- pango_matrix.x0 = cairo_matrix.x0;
- pango_matrix.y0 = cairo_matrix.y0;
-
- layout_matrix = pango_context_get_matrix (context);
- if (!layout_matrix)
- layout_matrix = &identity_matrix;
-
- /* ignore translation offsets */
- if (0 != memcmp (&pango_matrix, layout_matrix, 4 * sizeof (double)))
- changed = TRUE;
-
- pango_context_set_matrix (context, &pango_matrix);
-
target = cairo_get_target (cr);
@@ -137,6 +120,30 @@ _pango_cairo_update_context (cairo_t *cr,
info->merged_options = NULL;
}
+ merged_options = _pango_cairo_context_get_merged_font_options (context);
+
+
+ cairo_get_matrix (cr, &cairo_matrix);
+ pango_matrix.xx = cairo_matrix.xx;
+ pango_matrix.yx = cairo_matrix.yx;
+ pango_matrix.xy = cairo_matrix.xy;
+ pango_matrix.yy = cairo_matrix.yy;
+ pango_matrix.x0 = cairo_matrix.x0;
+ pango_matrix.y0 = cairo_matrix.y0;
+
+ current_matrix = pango_context_get_matrix (context);
+ if (!current_matrix)
+ current_matrix = &identity_matrix;
+
+ /* layout is matrix-independent if metrics-hinting is off.
+ * also ignore matrix translation offsets */
+ if ((cairo_font_options_get_hint_metrics (merged_options) != CAIRO_HINT_METRICS_OFF) &&
+ (0 != memcmp (&pango_matrix, current_matrix, 4 * sizeof (double))))
+ changed = TRUE;
+
+ pango_context_set_matrix (context, &pango_matrix);
+
+
return changed;
}