From 24adc1575745a711558dab79488760f1ceb24750 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 21 Oct 2018 17:39:00 -0700 Subject: [PATCH] [colr] Touch up a bit When a struct is plain old data with no references, etc, it's okay to mark its members public. --- src/hb-ot-color-colr-table.hh | 36 ++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/hb-ot-color-colr-table.hh b/src/hb-ot-color-colr-table.hh index b185968e3..a87a567be 100644 --- a/src/hb-ot-color-colr-table.hh +++ b/src/hb-ot-color-colr-table.hh @@ -39,25 +39,30 @@ namespace OT { struct LayerRecord { - friend struct COLR; - inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); return_trace (c->check_struct (this)); } - protected: - GlyphID glyphid; /* Glyph ID of layer glyph */ - HBUINT16 colorIdx; /* Index value to use with a selected color palette */ + public: + GlyphID glyphId; /* Glyph ID of layer glyph */ + HBUINT16 colorIdx; /* Index value to use with a + * selected color palette. + * An index value of 0xFFFF + * is a special case indicating + * that the text foreground + * color (defined by a + * higher-level client) should + * be used and shall not be + * treated as actual index + * into CPAL ColorRecord array. */ public: DEFINE_SIZE_STATIC (4); }; struct BaseGlyphRecord { - friend struct COLR; - inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -65,13 +70,18 @@ struct BaseGlyphRecord } inline int cmp (hb_codepoint_t g) const { - return g < glyphid ? -1 : g > glyphid ? 1 : 0; + return g < glyphId ? -1 : g > glyphId ? 1 : 0; } - protected: - GlyphID glyphid; /* Glyph ID of reference glyph */ - HBUINT16 firstLayerIdx; /* Index to the layer record */ - HBUINT16 numLayers; /* Number of color layers associated with this glyph */ + public: + GlyphID glyphId; /* Glyph ID of reference glyph */ + HBUINT16 firstLayerIdx; /* Index (from beginning of + * the Layer Records) to the + * layer record. There will be + * numLayers consecutive entries + * for this base glyph. */ + HBUINT16 numLayers; /* Number of color layers + * associated with this glyph */ public: DEFINE_SIZE_STATIC (6); }; @@ -121,7 +131,7 @@ struct COLR return false; } const LayerRecord &layer = (this+layersZ)[record]; - if (glyph_id) *glyph_id = layer.glyphid; + if (glyph_id) *glyph_id = layer.glyphId; if (color_index) *color_index = layer.colorIdx; return true; }