提交 3935af1c 编写于 作者: B Behdad Esfahbod

[buffer] Remove wrong optimization

While the cluster fields of the glyph string are usually sorted, they
wouldn't be in special cases (for example for non-native direction).
Blindly using bsearch is plain wrong.  If we want to reintroduce this
optimization we have to make sure we know the buffer clusters are
monotonic and in which direction.  Not sure it's worth it though.
上级 46df6828
......@@ -470,20 +470,10 @@ _hb_buffer_set_masks (hb_buffer_t *buffer,
return;
}
/* XXX can't bsearch since .cluster may not be sorted. */
/* Binary search to find the start position and go from there. */
unsigned int min = 0, max = buffer->len;
while (min < max)
{
unsigned int mid = min + ((max - min) / 2);
if (buffer->info[mid].cluster < cluster_start)
min = mid + 1;
else
max = mid;
}
unsigned int count = buffer->len;
for (unsigned int i = min; i < count && buffer->info[i].cluster < cluster_end; i++)
buffer->info[i].mask = (buffer->info[i].mask & not_mask) | value;
for (unsigned int i = 0; i < count; i++)
if (cluster_start <= buffer->info[i].cluster && buffer->info[i].cluster < cluster_end)
buffer->info[i].mask = (buffer->info[i].mask & not_mask) | value;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册