From ae96c98dfaef3a789227ffecd40b92518dface8a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 24 Nov 2018 10:25:10 -0500 Subject: [PATCH] [color] Use SortedUnsizedArrayOf<> --- src/hb-ot-color-colr-table.hh | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/hb-ot-color-colr-table.hh b/src/hb-ot-color-colr-table.hh index fa40223b7..84c343325 100644 --- a/src/hb-ot-color-colr-table.hh +++ b/src/hb-ot-color-colr-table.hh @@ -66,13 +66,6 @@ struct BaseGlyphRecord inline int cmp (hb_codepoint_t g) const { return g < glyphId ? -1 : g > glyphId ? 1 : 0; } - static int cmp (const void *pa, const void *pb) - { - const hb_codepoint_t *a = (const hb_codepoint_t *) pa; - const BaseGlyphRecord *b = (const BaseGlyphRecord *) pb; - return b->cmp (*a); - } - inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -103,12 +96,7 @@ struct COLR unsigned int *count, /* IN/OUT. May be NULL. */ hb_ot_color_layer_t *layers /* OUT. May be NULL. */) const { - const BaseGlyphRecord *rec = (BaseGlyphRecord *) bsearch (&glyph, - &(this+baseGlyphsZ), - numBaseGlyphs, - sizeof (BaseGlyphRecord), - BaseGlyphRecord::cmp); - const BaseGlyphRecord &record = rec ? *rec : Null (BaseGlyphRecord); + const BaseGlyphRecord &record = (this+baseGlyphsZ).bsearch (numBaseGlyphs, glyph); hb_array_t all_layers ((this+layersZ).arrayZ, numLayers); hb_array_t glyph_layers = all_layers.sub_array (record.firstLayerIdx, @@ -137,7 +125,7 @@ struct COLR protected: HBUINT16 version; /* Table version number (starts at 0). */ HBUINT16 numBaseGlyphs; /* Number of Base Glyph Records. */ - LOffsetTo, false> + LOffsetTo, false> baseGlyphsZ; /* Offset to Base Glyph records. */ LOffsetTo, false> layersZ; /* Offset to Layer Records. */