Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: third_party/harfbuzz-ng/src/hb-ot-map.cc

Issue 2318273003: Roll HarfBuzz to 1.3.1 (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-ft.cc ('k') | third_party/harfbuzz-ng/src/hb-ot-tag.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright © 2009,2010 Red Hat, Inc. 2 * Copyright © 2009,2010 Red Hat, Inc.
3 * Copyright © 2010,2011,2013 Google, Inc. 3 * Copyright © 2010,2011,2013 Google, Inc.
4 * 4 *
5 * This is part of HarfBuzz, a text shaping library. 5 * This is part of HarfBuzz, a text shaping library.
6 * 6 *
7 * Permission is hereby granted, without written agreement and without 7 * Permission is hereby granted, without written agreement and without
8 * license or royalty fees, to use, copy, modify, and distribute this 8 * license or royalty fees, to use, copy, modify, and distribute this
9 * software and its documentation for any purpose, provided that the 9 * software and its documentation for any purpose, provided that the
10 * above copyright notice and the following two paragraphs appear in 10 * above copyright notice and the following two paragraphs appear in
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 for (unsigned int i = 0; i < feature_infos.len; i++) 186 for (unsigned int i = 0; i < feature_infos.len; i++)
187 { 187 {
188 const feature_info_t *info = &feature_infos[i]; 188 const feature_info_t *info = &feature_infos[i];
189 189
190 unsigned int bits_needed; 190 unsigned int bits_needed;
191 191
192 if ((info->flags & F_GLOBAL) && info->max_value == 1) 192 if ((info->flags & F_GLOBAL) && info->max_value == 1)
193 /* Uses the global bit */ 193 /* Uses the global bit */
194 bits_needed = 0; 194 bits_needed = 0;
195 else 195 else
196 bits_needed = _hb_bit_storage (info->max_value); 196 /* Limit to 8 bits per feature. */
197 bits_needed = MIN(8u, _hb_bit_storage (info->max_value));
197 198
198 if (!info->max_value || next_bit + bits_needed > 8 * sizeof (hb_mask_t)) 199 if (!info->max_value || next_bit + bits_needed > 8 * sizeof (hb_mask_t))
199 continue; /* Feature disabled, or not enough bits. */ 200 continue; /* Feature disabled, or not enough bits. */
200 201
201 202
202 hb_bool_t found = false; 203 hb_bool_t found = false;
203 unsigned int feature_index[2]; 204 unsigned int feature_index[2];
204 for (unsigned int table_index = 0; table_index < 2; table_index++) 205 for (unsigned int table_index = 0; table_index < 2; table_index++)
205 { 206 {
206 if (required_feature_tag[table_index] == info->tag) 207 if (required_feature_tag[table_index] == info->tag)
(...skipping 29 matching lines...) Expand all
236 map->index[1] = feature_index[1]; 237 map->index[1] = feature_index[1];
237 map->stage[0] = info->stage[0]; 238 map->stage[0] = info->stage[0];
238 map->stage[1] = info->stage[1]; 239 map->stage[1] = info->stage[1];
239 map->auto_zwj = !(info->flags & F_MANUAL_ZWJ); 240 map->auto_zwj = !(info->flags & F_MANUAL_ZWJ);
240 if ((info->flags & F_GLOBAL) && info->max_value == 1) { 241 if ((info->flags & F_GLOBAL) && info->max_value == 1) {
241 /* Uses the global bit */ 242 /* Uses the global bit */
242 map->shift = 0; 243 map->shift = 0;
243 map->mask = 1; 244 map->mask = 1;
244 } else { 245 } else {
245 map->shift = next_bit; 246 map->shift = next_bit;
246 map->mask = (1 << (next_bit + bits_needed)) - (1 << next_bit); 247 map->mask = (1u << (next_bit + bits_needed)) - (1u << next_bit);
247 next_bit += bits_needed; 248 next_bit += bits_needed;
248 m.global_mask |= (info->default_value << map->shift) & map->mask; 249 m.global_mask |= (info->default_value << map->shift) & map->mask;
249 } 250 }
250 map->_1_mask = (1 << map->shift) & map->mask; 251 map->_1_mask = (1u << map->shift) & map->mask;
251 map->needs_fallback = !found; 252 map->needs_fallback = !found;
252 253
253 } 254 }
254 feature_infos.shrink (0); /* Done with these */ 255 feature_infos.shrink (0); /* Done with these */
255 256
256 257
257 add_gsub_pause (NULL); 258 add_gsub_pause (NULL);
258 add_gpos_pause (NULL); 259 add_gpos_pause (NULL);
259 260
260 for (unsigned int table_index = 0; table_index < 2; table_index++) 261 for (unsigned int table_index = 0; table_index < 2; table_index++)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 if (likely (stage_map)) { 304 if (likely (stage_map)) {
304 stage_map->last_lookup = last_num_lookups; 305 stage_map->last_lookup = last_num_lookups;
305 stage_map->pause_func = stages[table_index][stage_index].pause_func; 306 stage_map->pause_func = stages[table_index][stage_index].pause_func;
306 } 307 }
307 308
308 stage_index++; 309 stage_index++;
309 } 310 }
310 } 311 }
311 } 312 }
312 } 313 }
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-ft.cc ('k') | third_party/harfbuzz-ng/src/hb-ot-tag.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698