diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-03-18 13:02:13 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-03-20 08:44:40 +0000 |
commit | 698203ab28bc679c2e62a2452a79d5785fd46ca7 (patch) | |
tree | a2d0086444a6a25500283210cd340daca899ece7 /pango/pango-context.c | |
parent | 3241972c4f4d9c1d98d166c38cb0d7b12afb5545 (diff) | |
download | pango-698203ab28bc679c2e62a2452a79d5785fd46ca7.tar.gz |
[pango] Allocate PangoScriptIter on stack.
Move the PangoScriptIter structure definition to a private header file,
so that we can embed the iterator within other structures or allocate
a local iterator on the stack. This eliminates the frequent short-lived
allocations associated with the iterator.
Diffstat (limited to 'pango/pango-context.c')
-rw-r--r-- | pango/pango-context.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/pango/pango-context.c b/pango/pango-context.c index 9285581f..6c40a295 100644 --- a/pango/pango-context.c +++ b/pango/pango-context.c @@ -29,6 +29,7 @@ #include "pango-engine.h" #include "pango-engine-private.h" #include "pango-modules.h" +#include "pango-script-private.h" struct _PangoContext { @@ -685,7 +686,7 @@ struct _ItemizeState ChangedFlags changed; - PangoScriptIter *script_iter; + PangoScriptIter script_iter; const char *script_end; PangoScript script; @@ -850,8 +851,8 @@ itemize_state_init (ItemizeState *state, /* Initialize the script iterator */ - state->script_iter = pango_script_iter_new (text + start_index, length); - pango_script_iter_get_range (state->script_iter, NULL, + _pango_script_iter_init (&state->script_iter, text + start_index, length); + pango_script_iter_get_range (&state->script_iter, NULL, &state->script_end, &state->script); update_end (state); @@ -899,8 +900,8 @@ itemize_state_next (ItemizeState *state) if (state->run_end == state->script_end) { - pango_script_iter_next (state->script_iter); - pango_script_iter_get_range (state->script_iter, NULL, + pango_script_iter_next (&state->script_iter); + pango_script_iter_get_range (&state->script_iter, NULL, &state->script_end, &state->script); state->changed |= SCRIPT_CHANGED; } @@ -1410,7 +1411,7 @@ itemize_state_finish (ItemizeState *state) g_free (state->embedding_levels); if (state->free_attr_iter) pango_attr_iterator_destroy (state->attr_iter); - pango_script_iter_free (state->script_iter); + _pango_script_iter_fini (&state->script_iter); pango_font_description_free (state->font_desc); itemize_state_reset_shape_engines (state); |