Merge clearing masks and setting global masks

This commit is contained in:
Behdad Esfahbod 2010-10-12 17:07:02 -04:00
parent fc96596b7c
commit 57ac0ecb78
4 changed files with 12 additions and 13 deletions

View File

@ -102,10 +102,11 @@ _hb_buffer_next_glyph (hb_buffer_t *buffer);
HB_INTERNAL void
_hb_buffer_clear_masks (hb_buffer_t *buffer);
_hb_buffer_reset_masks (hb_buffer_t *buffer,
hb_mask_t mask);
HB_INTERNAL void
_hb_buffer_set_masks (hb_buffer_t *buffer,
_hb_buffer_add_masks (hb_buffer_t *buffer,
hb_mask_t value,
hb_mask_t mask,
unsigned int cluster_start,
@ -164,12 +165,12 @@ struct _hb_buffer_t {
{ _hb_buffer_add_output_glyph (this, glyph_index, component, ligID); }
inline void replace_glyph (hb_codepoint_t glyph_index) { add_output_glyph (glyph_index); }
inline void clear_masks (void) { _hb_buffer_clear_masks (this); }
inline void set_masks (hb_mask_t value,
inline void reset_masks (hb_mask_t mask) { _hb_buffer_reset_masks (this, mask); }
inline void add_masks (hb_mask_t value,
hb_mask_t mask,
unsigned int cluster_start,
unsigned int cluster_end)
{ _hb_buffer_set_masks (this, value, mask, cluster_start, cluster_end); }
{ _hb_buffer_add_masks (this, value, mask, cluster_start, cluster_end); }
};

View File

@ -460,7 +460,8 @@ _hb_buffer_next_glyph (hb_buffer_t *buffer)
}
void
_hb_buffer_clear_masks (hb_buffer_t *buffer)
_hb_buffer_reset_masks (hb_buffer_t *buffer,
hb_mask_t mask)
{
unsigned int count = buffer->len;
for (unsigned int i = 0; i < count; i++)
@ -468,7 +469,7 @@ _hb_buffer_clear_masks (hb_buffer_t *buffer)
}
void
_hb_buffer_set_masks (hb_buffer_t *buffer,
_hb_buffer_add_masks (hb_buffer_t *buffer,
hb_mask_t value,
hb_mask_t mask,
unsigned int cluster_start,

View File

@ -63,7 +63,7 @@ void
hb_ot_map_t::compile (hb_face_t *face,
const hb_segment_properties_t *props)
{
global_mask = 0;
global_mask = 1;
lookup_count[0] = lookup_count[1] = 0;
if (!feature_count)

View File

@ -82,11 +82,8 @@ hb_ot_shape_collect_features (hb_ot_shape_plan_t *plan,
static void
hb_ot_shape_setup_masks (hb_ot_shape_context_t *c)
{
c->buffer->clear_masks ();
hb_mask_t global_mask = c->plan->map.get_global_mask ();
if (global_mask)
c->buffer->set_masks (global_mask, global_mask, 0, (unsigned int) -1);
c->buffer->reset_masks (global_mask);
for (unsigned int i = 0; i < c->num_user_features; i++)
{
@ -94,7 +91,7 @@ hb_ot_shape_setup_masks (hb_ot_shape_context_t *c)
if (!(feature->start == 0 && feature->end == (unsigned int)-1)) {
unsigned int shift;
hb_mask_t mask = c->plan->map.get_mask (feature->tag, &shift);
c->buffer->set_masks (feature->value << shift, mask, feature->start, feature->end);
c->buffer->add_masks (feature->value << shift, mask, feature->start, feature->end);
}
}