[colr] Move compare function into a static
Not sure if MSVC would be unhappy about this.
This commit is contained in:
parent
b6b171732a
commit
b92b9d7e52
@ -73,6 +73,13 @@ struct BaseGlyphRecord
|
|||||||
return g < glyphId ? -1 : g > glyphId ? 1 : 0;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GlyphID glyphId; /* Glyph ID of reference glyph */
|
GlyphID glyphId; /* Glyph ID of reference glyph */
|
||||||
HBUINT16 firstLayerIdx; /* Index (from beginning of
|
HBUINT16 firstLayerIdx; /* Index (from beginning of
|
||||||
@ -86,13 +93,6 @@ struct BaseGlyphRecord
|
|||||||
DEFINE_SIZE_STATIC (6);
|
DEFINE_SIZE_STATIC (6);
|
||||||
};
|
};
|
||||||
|
|
||||||
static int compare_bgr (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);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct COLR
|
struct COLR
|
||||||
{
|
{
|
||||||
static const hb_tag_t tableTag = HB_OT_TAG_COLR;
|
static const hb_tag_t tableTag = HB_OT_TAG_COLR;
|
||||||
@ -103,7 +103,7 @@ struct COLR
|
|||||||
{
|
{
|
||||||
const BaseGlyphRecord* record;
|
const BaseGlyphRecord* record;
|
||||||
record = (BaseGlyphRecord *) bsearch (&glyph_id, &(this+baseGlyphsZ), numBaseGlyphs,
|
record = (BaseGlyphRecord *) bsearch (&glyph_id, &(this+baseGlyphsZ), numBaseGlyphs,
|
||||||
sizeof (BaseGlyphRecord), compare_bgr);
|
sizeof (BaseGlyphRecord), BaseGlyphRecord::cmp);
|
||||||
if (unlikely (!record))
|
if (unlikely (!record))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user