[layout] Simplify CoverageFormat2 intersects_coverage()
This commit is contained in:
parent
1f4d8ccaed
commit
41a8597f38
|
@ -128,21 +128,9 @@ struct CoverageFormat2_4
|
||||||
}
|
}
|
||||||
bool intersects_coverage (const hb_set_t *glyphs, unsigned int index) const
|
bool intersects_coverage (const hb_set_t *glyphs, unsigned int index) const
|
||||||
{
|
{
|
||||||
auto cmp = [] (const void *pk, const void *pr) -> int
|
auto *range = rangeRecord.as_array ().bsearch (index);
|
||||||
{
|
if (range)
|
||||||
unsigned index = * (const unsigned *) pk;
|
return range->intersects (*glyphs);
|
||||||
const RangeRecord<Types> &range = * (const RangeRecord<Types> *) pr;
|
|
||||||
if (index < range.value) return -1;
|
|
||||||
if (index > (unsigned int) range.value + (range.last - range.first)) return +1;
|
|
||||||
return 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
auto arr = rangeRecord.as_array ();
|
|
||||||
unsigned idx;
|
|
||||||
if (hb_bsearch_impl (&idx, index,
|
|
||||||
arr.arrayZ, arr.length, sizeof (arr[0]),
|
|
||||||
(int (*)(const void *_key, const void *_item)) cmp))
|
|
||||||
return arr.arrayZ[idx].intersects (*glyphs);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue