summaryrefslogtreecommitdiff
path: root/pango/pangocairo-context.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2008-06-16 20:08:21 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2008-06-16 20:08:21 +0000
commitcb47a0de475cbaf812dd2266046f0713146867e1 (patch)
treec812f8221e19fc079e35a55bea14e46f8b91e179 /pango/pangocairo-context.c
parent13ea483741e68af7036470106a8a9e55ca76d3b7 (diff)
downloadpango-cb47a0de475cbaf812dd2266046f0713146867e1.tar.gz
Bug 538661 – Improve pango_cairo_context_update_context()
2008-06-16 Behdad Esfahbod <behdad@gnome.org> Bug 538661 – Improve pango_cairo_context_update_context() * pango/pangocairo-context.c (_pango_cairo_update_context): Relayout only if merged options changed. svn path=/trunk/; revision=2653
Diffstat (limited to 'pango/pangocairo-context.c')
-rw-r--r--pango/pangocairo-context.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/pango/pangocairo-context.c b/pango/pangocairo-context.c
index c8ccbe15..977225cb 100644
--- a/pango/pangocairo-context.c
+++ b/pango/pangocairo-context.c
@@ -92,36 +92,31 @@ _pango_cairo_update_context (cairo_t *cr,
PangoMatrix pango_matrix;
const PangoMatrix *current_matrix, identity_matrix = PANGO_MATRIX_INIT;
const cairo_font_options_t *merged_options;
+ cairo_font_options_t *old_merged_options;
gboolean changed = FALSE;
info = get_context_info (context, TRUE);
-
target = cairo_get_target (cr);
- if (!info->surface_options) {
+ if (!info->surface_options)
info->surface_options = cairo_font_options_create ();
- changed = TRUE;
- cairo_surface_get_font_options (target, info->surface_options);
- } else {
- cairo_font_options_t *surface_options = cairo_font_options_create ();
- cairo_surface_get_font_options (target, surface_options);
- if (!cairo_font_options_equal (surface_options, info->surface_options))
- {
- cairo_surface_get_font_options (target, info->surface_options);
- changed = TRUE;
- }
- cairo_font_options_destroy (surface_options);
- }
+ cairo_surface_get_font_options (target, info->surface_options);
- if (info->merged_options)
- {
- cairo_font_options_destroy (info->merged_options);
- info->merged_options = NULL;
- }
+ old_merged_options = info->merged_options;
+ info->merged_options = NULL;
merged_options = _pango_cairo_context_get_merged_font_options (context);
+ if (old_merged_options)
+ {
+ if (!cairo_font_options_equal (merged_options, old_merged_options))
+ changed = TRUE;
+ cairo_font_options_destroy (old_merged_options);
+ old_merged_options = NULL;
+ }
+ else
+ changed = TRUE;
cairo_get_matrix (cr, &cairo_matrix);
pango_matrix.xx = cairo_matrix.xx;