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.
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;
}