Add buffer->swap()

This commit is contained in:
Behdad Esfahbod 2010-05-12 23:34:52 -04:00
parent 3b649a38b5
commit d0316a81f5
2 changed files with 38 additions and 32 deletions

View File

@ -62,37 +62,6 @@ ASSERT_STATIC (sizeof (hb_glyph_position_t) == sizeof (hb_internal_glyph_positio
ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t));
struct _hb_buffer_t {
hb_reference_count_t ref_count;
/* Information about how the text in the buffer should be treated */
hb_unicode_funcs_t *unicode;
hb_direction_t direction;
hb_script_t script;
hb_language_t language;
/* Buffer contents */
unsigned int allocated;
hb_bool_t have_output; /* whether we have an output buffer going on */
hb_bool_t have_positions; /* whether we have positions */
unsigned int in_length;
unsigned int out_length;
unsigned int in_pos;
unsigned int out_pos; /* out_length and out_pos are actually always the same */
hb_internal_glyph_info_t *in_string;
hb_internal_glyph_info_t *out_string;
hb_internal_glyph_position_t *positions;
/* Other stuff */
unsigned int max_lig_id;
inline unsigned int allocate_lig_id (void) { return max_lig_id++; }
};
HB_INTERNAL void
_hb_buffer_swap (hb_buffer_t *buffer);
@ -130,6 +99,43 @@ _hb_buffer_replace_glyph (hb_buffer_t *buffer,
hb_codepoint_t glyph_index);
struct _hb_buffer_t {
hb_reference_count_t ref_count;
/* Information about how the text in the buffer should be treated */
hb_unicode_funcs_t *unicode;
hb_direction_t direction;
hb_script_t script;
hb_language_t language;
/* Buffer contents */
unsigned int allocated;
hb_bool_t have_output; /* whether we have an output buffer going on */
hb_bool_t have_positions; /* whether we have positions */
unsigned int in_length;
unsigned int out_length;
unsigned int in_pos;
unsigned int out_pos; /* out_length and out_pos are actually always the same */
hb_internal_glyph_info_t *in_string;
hb_internal_glyph_info_t *out_string;
hb_internal_glyph_position_t *positions;
/* Other stuff */
unsigned int max_lig_id;
/* Methods */
inline unsigned int allocate_lig_id (void) { return max_lig_id++; }
inline void swap (void) { _hb_buffer_swap (this); }
};
#ifndef BUFFER
#define BUFFER buffer
#endif

View File

@ -844,7 +844,7 @@ struct SubstLookup : Lookup
}
if (ret)
_hb_buffer_swap (buffer);
buffer->swap ();
}
else
{