[HarfBuzz] harfbuzz-ng: Branch 'master'
Behdad Esfahbod
behdad at kemper.freedesktop.org
Thu May 5 13:11:07 PDT 2011
src/hb-buffer.cc | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
New commits:
commit 3935af1c0d0f53a5fd6054e1ee219f3adda42dca
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu May 5 16:09:45 2011 -0400
[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.
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index 4009b12..6d0d4d4 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -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;
}
More information about the HarfBuzz
mailing list