[hvar] Change variation-index types from "unsigned int" to uint32_t

This commit is contained in:
Behdad Esfahbod 2021-03-31 11:31:49 -06:00
parent 9ffc46b8ff
commit 0f7f7536b9
1 changed files with 7 additions and 7 deletions

View File

@ -49,7 +49,7 @@ struct DeltaSetIndexMap
{ {
unsigned int width = plan.get_width (); unsigned int width = plan.get_width ();
unsigned int inner_bit_count = plan.get_inner_bit_count (); unsigned int inner_bit_count = plan.get_inner_bit_count ();
const hb_array_t<const unsigned int> output_map = plan.get_output_map (); const hb_array_t<const uint32_t> output_map = plan.get_output_map ();
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
if (unlikely (output_map.length && ((((inner_bit_count-1)&~0xF)!=0) || (((width-1)&~0x3)!=0)))) if (unlikely (output_map.length && ((((inner_bit_count-1)&~0xF)!=0) || (((width-1)&~0x3)!=0))))
@ -76,7 +76,7 @@ struct DeltaSetIndexMap
return_trace (true); return_trace (true);
} }
unsigned int map (unsigned int v) const /* Returns 16.16 outer.inner. */ uint32_t map (unsigned int v) const /* Returns 16.16 outer.inner. */
{ {
/* If count is zero, pass value unchanged. This takes /* If count is zero, pass value unchanged. This takes
* care of direct mapping for advance map. */ * care of direct mapping for advance map. */
@ -217,7 +217,7 @@ struct index_map_subset_plan_t
hb_codepoint_t old_gid; hb_codepoint_t old_gid;
if (plan->old_gid_for_new_gid (gid, &old_gid)) if (plan->old_gid_for_new_gid (gid, &old_gid))
{ {
unsigned int v = input_map->map (old_gid); uint32_t v = input_map->map (old_gid);
unsigned int outer = v >> 16; unsigned int outer = v >> 16;
output_map[gid] = (outer_map[outer] << 16) | (inner_maps[outer][v & 0xFFFF]); output_map[gid] = (outer_map[outer] << 16) | (inner_maps[outer][v & 0xFFFF]);
} }
@ -234,14 +234,14 @@ struct index_map_subset_plan_t
{ return (map_count? (DeltaSetIndexMap::min_size + get_width () * map_count): 0); } { return (map_count? (DeltaSetIndexMap::min_size + get_width () * map_count): 0); }
bool is_identity () const { return get_output_map ().length == 0; } bool is_identity () const { return get_output_map ().length == 0; }
hb_array_t<const unsigned int> get_output_map () const { return output_map.as_array (); } hb_array_t<const uint32_t> get_output_map () const { return output_map.as_array (); }
protected: protected:
unsigned int map_count; unsigned int map_count;
hb_vector_t<unsigned int> max_inners; hb_vector_t<unsigned int> max_inners;
unsigned int outer_bit_count; unsigned int outer_bit_count;
unsigned int inner_bit_count; unsigned int inner_bit_count;
hb_vector_t<unsigned int> output_map; hb_vector_t<uint32_t> output_map;
}; };
struct hvarvvar_subset_plan_t struct hvarvvar_subset_plan_t
@ -408,7 +408,7 @@ struct HVARVVAR
float get_advance_var (hb_codepoint_t glyph, hb_font_t *font) const float get_advance_var (hb_codepoint_t glyph, hb_font_t *font) const
{ {
unsigned int varidx = (this+advMap).map (glyph); uint32_t varidx = (this+advMap).map (glyph);
return (this+varStore).get_delta (varidx, font->coords, font->num_coords); return (this+varStore).get_delta (varidx, font->coords, font->num_coords);
} }
@ -416,7 +416,7 @@ struct HVARVVAR
const int *coords, unsigned int coord_count) const const int *coords, unsigned int coord_count) const
{ {
if (!has_side_bearing_deltas ()) return 0.f; if (!has_side_bearing_deltas ()) return 0.f;
unsigned int varidx = (this+lsbMap).map (glyph); uint32_t varidx = (this+lsbMap).map (glyph);
return (this+varStore).get_delta (varidx, coords, coord_count); return (this+varStore).get_delta (varidx, coords, coord_count);
} }