Minor
This commit is contained in:
parent
44f79b4bf8
commit
37ba2413c1
@ -115,17 +115,17 @@ struct CPAL
|
||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
if (unlikely (!(c->check_struct (this) && // it checks colorRecordIndices also
|
||||
// see #get_size
|
||||
if (unlikely (!(c->check_struct (this) && /* it checks colorRecordIndices also
|
||||
* See #get_size */
|
||||
(this+colorRecordsZ).sanitize (c, numColorRecords))))
|
||||
return_trace (false);
|
||||
|
||||
// Check for indices sanity so no need for doing it runtime
|
||||
/* Check for indices sanity so no need for doing it runtime */
|
||||
for (unsigned int i = 0; i < numPalettes; ++i)
|
||||
if (unlikely (colorRecordIndicesZ[i] + numPaletteEntries > numColorRecords))
|
||||
return_trace (false);
|
||||
|
||||
// If version is zero, we are done here; otherwise we need to check tail also
|
||||
/* If version is zero, we are done here; otherwise we need to check tail also */
|
||||
if (version == 0)
|
||||
return_trace (true);
|
||||
|
||||
@ -177,7 +177,7 @@ struct CPAL
|
||||
if (unlikely (color_index >= numPaletteEntries || palette >= numPalettes))
|
||||
return false;
|
||||
|
||||
// No need for more range check as it is already done on #sanitize
|
||||
/* No need for more range check as it is already done on #sanitize */
|
||||
const UnsizedArrayOf<BGRAColor>& color_records = this+colorRecordsZ;
|
||||
if (color)
|
||||
*color = color_records[colorRecordIndicesZ[palette] + color_index];
|
||||
|
@ -121,7 +121,7 @@ hb_ot_color_get_palette_name_id (hb_face_t *face, unsigned int palette)
|
||||
* @face: a font face.
|
||||
* @palette_entry:
|
||||
*
|
||||
* Returns: Name ID associated with an palette entry, e.g. eye color
|
||||
* Returns: Name ID associated with a palette entry, e.g. eye color
|
||||
*
|
||||
* Since: REPLACEME
|
||||
*/
|
||||
@ -162,20 +162,22 @@ unsigned int
|
||||
hb_ot_color_get_palette_colors (hb_face_t *face,
|
||||
unsigned int palette, /* default=0 */
|
||||
unsigned int start_offset,
|
||||
unsigned int *count /* IN/OUT. May be NULL. */,
|
||||
unsigned int *colors_count /* IN/OUT. May be NULL. */,
|
||||
hb_color_t *colors /* OUT. May be NULL. */)
|
||||
{
|
||||
const OT::CPAL& cpal = _get_cpal(face);
|
||||
if (unlikely (palette >= cpal.get_palette_count ()))
|
||||
{
|
||||
if (count) *count = 0;
|
||||
if (colors_count) *colors_count = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int num_results = 0;
|
||||
if (count)
|
||||
if (colors_count)
|
||||
{
|
||||
unsigned int platte_count = MIN<unsigned int>(*count, cpal.get_palette_entries_count () - start_offset);
|
||||
unsigned int platte_count;
|
||||
platte_count = MIN<unsigned int>(*colors_count,
|
||||
cpal.get_palette_entries_count () - start_offset);
|
||||
for (unsigned int i = 0; i < platte_count; i++)
|
||||
{
|
||||
if (cpal.get_color_record_argb(start_offset + i, palette, &colors[num_results]))
|
||||
@ -183,12 +185,13 @@ hb_ot_color_get_palette_colors (hb_face_t *face,
|
||||
}
|
||||
}
|
||||
|
||||
if (likely (count)) *count = num_results;
|
||||
if (likely (colors_count)) *colors_count = num_results;
|
||||
return cpal.get_palette_entries_count ();
|
||||
}
|
||||
|
||||
/**
|
||||
* hb_ot_color_get_color_layers:
|
||||
* @face: a font face.
|
||||
* @gid:
|
||||
* @start_offset:
|
||||
* @count: (inout) (optional):
|
||||
@ -203,8 +206,8 @@ unsigned int
|
||||
hb_ot_color_get_color_layers (hb_face_t *face,
|
||||
hb_codepoint_t gid,
|
||||
unsigned int start_offset,
|
||||
unsigned int *count, /* IN/OUT. May be NULL. */
|
||||
hb_codepoint_t *gids, /* OUT. May be NULL. */
|
||||
unsigned int *count /* IN/OUT. May be NULL. */,
|
||||
hb_codepoint_t *gids /* OUT. May be NULL. */,
|
||||
unsigned int *color_indices /* OUT. May be NULL. */)
|
||||
{
|
||||
const OT::COLR& colr = _get_colr (face);
|
||||
|
@ -57,16 +57,16 @@ HB_EXTERN unsigned int
|
||||
hb_ot_color_get_palette_colors (hb_face_t *face,
|
||||
unsigned int palette, /* default=0 */
|
||||
unsigned int start_offset,
|
||||
unsigned int *color_count /* IN/OUT */,
|
||||
hb_color_t *colors /* OUT */);
|
||||
unsigned int *color_count /* IN/OUT. May be NULL. */,
|
||||
hb_color_t *colors /* OUT. May be NULL. */);
|
||||
|
||||
HB_EXTERN unsigned int
|
||||
hb_ot_color_get_color_layers (hb_face_t *face,
|
||||
hb_codepoint_t gid,
|
||||
unsigned int offset,
|
||||
unsigned int *count, /* IN/OUT */
|
||||
hb_codepoint_t *gids, /* OUT */
|
||||
unsigned int *color_indices /* OUT */);
|
||||
unsigned int start_offset,
|
||||
unsigned int *count /* IN/OUT. May be NULL. */,
|
||||
hb_codepoint_t *gids /* OUT. May be NULL. */,
|
||||
unsigned int *color_indices /* OUT. May be NULL. */);
|
||||
|
||||
/**
|
||||
* hb_ot_color_palette_flags_t:
|
||||
|
Loading…
Reference in New Issue
Block a user