[buffer] Merge and rename clear_glyph_flags()

This commit is contained in:
Behdad Esfahbod 2021-12-04 16:56:39 -08:00
parent b95d252fab
commit 94d43c008a
7 changed files with 8 additions and 9 deletions

View File

@ -450,11 +450,10 @@ struct hb_buffer_t
} }
} }
void unsafe_to_break_all () { unsafe_to_break_impl (0, len); } void clear_glyph_flags (hb_mask_t mask = 0)
void safe_to_break_all ()
{ {
for (unsigned int i = 0; i < len; i++) for (unsigned int i = 0; i < len; i++)
info[i].mask &= ~HB_GLYPH_FLAG_UNSAFE_TO_BREAK; info[i].mask = (info[i].mask & ~HB_GLYPH_FLAG_DEFINED) | (mask & HB_GLYPH_FLAG_DEFINED);
} }
}; };
DECLARE_NULL_INSTANCE (hb_buffer_t); DECLARE_NULL_INSTANCE (hb_buffer_t);

View File

@ -1213,7 +1213,7 @@ resize_and_retry:
} }
} }
buffer->unsafe_to_break_all (); buffer->clear_glyph_flags (HB_GLYPH_FLAG_UNSAFE_TO_BREAK);
#undef FAIL #undef FAIL

View File

@ -762,7 +762,7 @@ retry_getglyphs:
if (isRightToLeft) hb_buffer_reverse (buffer); if (isRightToLeft) hb_buffer_reverse (buffer);
buffer->unsafe_to_break_all (); buffer->clear_glyph_flags (HB_GLYPH_FLAG_UNSAFE_TO_BREAK);
delete [] clusterMap; delete [] clusterMap;
delete [] glyphIndices; delete [] glyphIndices;

View File

@ -117,7 +117,7 @@ _hb_fallback_shape (hb_shape_plan_t *shape_plan HB_UNUSED,
if (HB_DIRECTION_IS_BACKWARD (direction)) if (HB_DIRECTION_IS_BACKWARD (direction))
hb_buffer_reverse (buffer); hb_buffer_reverse (buffer);
buffer->safe_to_break_all (); buffer->clear_glyph_flags ();
return true; return true;
} }

View File

@ -439,7 +439,7 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan HB_UNUSED,
if (feats) gr_featureval_destroy (feats); if (feats) gr_featureval_destroy (feats);
gr_seg_destroy (seg); gr_seg_destroy (seg);
buffer->unsafe_to_break_all (); buffer->clear_glyph_flags (HB_GLYPH_FLAG_UNSAFE_TO_BREAK);
return true; return true;
} }

View File

@ -566,7 +566,7 @@ struct AlternateSet
{ {
/* Maybe we can do better than unsafe-to-break all; but since we are /* Maybe we can do better than unsafe-to-break all; but since we are
* changing random state, it would be hard to track that. Good 'nough. */ * changing random state, it would be hard to track that. Good 'nough. */
c->buffer->unsafe_to_break_all (); c->buffer->unsafe_to_break (0, c->buffer->len);
alt_index = c->random_number () % count + 1; alt_index = c->random_number () % count + 1;
} }

View File

@ -878,7 +878,7 @@ retry:
if (backward) if (backward)
hb_buffer_reverse (buffer); hb_buffer_reverse (buffer);
buffer->unsafe_to_break_all (); buffer->clear_glyph_flags (HB_GLYPH_FLAG_UNSAFE_TO_BREAK);
/* Wow, done! */ /* Wow, done! */
return true; return true;