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

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

Issue 10510004: Roll harfbuzz-ng 3b8fd9c48f4bde368bf2d465c148b9743a9216ee (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright © 1998-2004 David Turner and Werner Lemberg 2 * Copyright © 1998-2004 David Turner and Werner Lemberg
3 * Copyright © 2004,2007,2009,2010 Red Hat, Inc. 3 * Copyright © 2004,2007,2009,2010 Red Hat, Inc.
4 * Copyright © 2011 Google, Inc. 4 * Copyright © 2011 Google, Inc.
5 * 5 *
6 * This is part of HarfBuzz, a text shaping library. 6 * This is part of HarfBuzz, a text shaping library.
7 * 7 *
8 * Permission is hereby granted, without written agreement and without 8 * Permission is hereby granted, without written agreement and without
9 * license or royalty fees, to use, copy, modify, and distribute this 9 * license or royalty fees, to use, copy, modify, and distribute this
10 * software and its documentation for any purpose, provided that the 10 * software and its documentation for any purpose, provided that the
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 216
217 memset (pos, 0, sizeof (pos[0]) * len); 217 memset (pos, 0, sizeof (pos[0]) * len);
218 } 218 }
219 219
220 void 220 void
221 hb_buffer_t::swap_buffers (void) 221 hb_buffer_t::swap_buffers (void)
222 { 222 {
223 if (unlikely (in_error)) return; 223 if (unlikely (in_error)) return;
224 224
225 assert (have_output); 225 assert (have_output);
226 have_output = FALSE;
226 227
227 if (out_info != info) 228 if (out_info != info)
228 { 229 {
229 hb_glyph_info_t *tmp_string; 230 hb_glyph_info_t *tmp_string;
230 tmp_string = info; 231 tmp_string = info;
231 info = out_info; 232 info = out_info;
232 out_info = tmp_string; 233 out_info = tmp_string;
233 pos = (hb_glyph_position_t *) out_info; 234 pos = (hb_glyph_position_t *) out_info;
234 } 235 }
235 236
(...skipping 27 matching lines...) Expand all
263 pinfo++; 264 pinfo++;
264 } 265 }
265 266
266 idx += num_in; 267 idx += num_in;
267 out_len += num_out; 268 out_len += num_out;
268 } 269 }
269 270
270 void 271 void
271 hb_buffer_t::replace_glyphs (unsigned int num_in, 272 hb_buffer_t::replace_glyphs (unsigned int num_in,
272 unsigned int num_out, 273 unsigned int num_out,
273 » » » const uint16_t *glyph_data) 274 » » » const uint32_t *glyph_data)
274 { 275 {
275 if (!make_room_for (num_in, num_out)) return; 276 if (!make_room_for (num_in, num_out)) return;
276 277
277 hb_glyph_info_t orig_info = info[idx]; 278 hb_glyph_info_t orig_info = info[idx];
278 for (unsigned int i = 1; i < num_in; i++) 279 for (unsigned int i = 1; i < num_in; i++)
279 { 280 {
280 hb_glyph_info_t *inf = &info[idx + i]; 281 hb_glyph_info_t *inf = &info[idx + i];
281 orig_info.cluster = MIN (orig_info.cluster, inf->cluster); 282 orig_info.cluster = MIN (orig_info.cluster, inf->cluster);
282 } 283 }
283 284
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 if (last_cluster != info[i].cluster) { 425 if (last_cluster != info[i].cluster) {
425 reverse_range (start, i); 426 reverse_range (start, i);
426 start = i; 427 start = i;
427 last_cluster = info[i].cluster; 428 last_cluster = info[i].cluster;
428 } 429 }
429 } 430 }
430 reverse_range (start, i); 431 reverse_range (start, i);
431 } 432 }
432 433
433 void 434 void
435 hb_buffer_t::merge_clusters (unsigned int start,
436 unsigned int end)
437 {
438 unsigned int cluster = this->info[start].cluster;
439
440 for (unsigned int i = start + 1; i < end; i++)
441 cluster = MIN (cluster, this->info[i].cluster);
442 for (unsigned int i = start; i < end; i++)
443 this->info[i].cluster = cluster;
444 }
445 void
446 hb_buffer_t::merge_out_clusters (unsigned int start,
447 unsigned int end)
448 {
449 unsigned int cluster = this->out_info[start].cluster;
450
451 for (unsigned int i = start + 1; i < end; i++)
452 cluster = MIN (cluster, this->out_info[i].cluster);
453 for (unsigned int i = start; i < end; i++)
454 this->out_info[i].cluster = cluster;
455 }
456
457 void
434 hb_buffer_t::guess_properties (void) 458 hb_buffer_t::guess_properties (void)
435 { 459 {
436 /* If script is set to INVALID, guess from buffer contents */ 460 /* If script is set to INVALID, guess from buffer contents */
437 if (props.script == HB_SCRIPT_INVALID) { 461 if (props.script == HB_SCRIPT_INVALID) {
438 for (unsigned int i = 0; i < len; i++) { 462 for (unsigned int i = 0; i < len; i++) {
439 hb_script_t script = hb_unicode_script (unicode, info[i].codepoint); 463 hb_script_t script = hb_unicode_script (unicode, info[i].codepoint);
440 if (likely (script != HB_SCRIPT_COMMON && 464 if (likely (script != HB_SCRIPT_COMMON &&
441 script != HB_SCRIPT_INHERITED && 465 script != HB_SCRIPT_INHERITED &&
442 script != HB_SCRIPT_UNKNOWN)) { 466 script != HB_SCRIPT_UNKNOWN)) {
443 props.script = script; 467 props.script = script;
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 int text_length, 874 int text_length,
851 unsigned int item_offset, 875 unsigned int item_offset,
852 int item_length) 876 int item_length)
853 { 877 {
854 #define UTF_NEXT(S, E, U) ((U) = *(S), (S)+1) 878 #define UTF_NEXT(S, E, U) ((U) = *(S), (S)+1)
855 ADD_UTF (uint32_t); 879 ADD_UTF (uint32_t);
856 #undef UTF_NEXT 880 #undef UTF_NEXT
857 } 881 }
858 882
859 883
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-buffer.h ('k') | third_party/harfbuzz-ng/src/hb-buffer-private.hh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698