[colr] Touch up a bit

When a struct is plain old data with no references, etc, it's okay
to mark its members public.
This commit is contained in:
Behdad Esfahbod 2018-10-21 17:39:00 -07:00 committed by Khaled Hosny
parent cc6e77ca98
commit 24adc15757
1 changed files with 23 additions and 13 deletions

View File

@ -39,25 +39,30 @@ namespace OT {
struct LayerRecord struct LayerRecord
{ {
friend struct COLR;
inline bool sanitize (hb_sanitize_context_t *c) const inline bool sanitize (hb_sanitize_context_t *c) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return_trace (c->check_struct (this)); return_trace (c->check_struct (this));
} }
protected: public:
GlyphID glyphid; /* Glyph ID of layer glyph */ GlyphID glyphId; /* Glyph ID of layer glyph */
HBUINT16 colorIdx; /* Index value to use with a selected color palette */ 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: public:
DEFINE_SIZE_STATIC (4); DEFINE_SIZE_STATIC (4);
}; };
struct BaseGlyphRecord struct BaseGlyphRecord
{ {
friend struct COLR;
inline bool sanitize (hb_sanitize_context_t *c) const inline bool sanitize (hb_sanitize_context_t *c) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
@ -65,13 +70,18 @@ struct BaseGlyphRecord
} }
inline int cmp (hb_codepoint_t g) const { 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: public:
GlyphID glyphid; /* Glyph ID of reference glyph */ GlyphID glyphId; /* Glyph ID of reference glyph */
HBUINT16 firstLayerIdx; /* Index to the layer record */ HBUINT16 firstLayerIdx; /* Index (from beginning of
HBUINT16 numLayers; /* Number of color layers associated with this glyph */ * 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: public:
DEFINE_SIZE_STATIC (6); DEFINE_SIZE_STATIC (6);
}; };
@ -121,7 +131,7 @@ struct COLR
return false; return false;
} }
const LayerRecord &layer = (this+layersZ)[record]; 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; if (color_index) *color_index = layer.colorIdx;
return true; return true;
} }