OLD | NEW |
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,2012 Google, Inc. | 4 * Copyright © 2011,2012 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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 buf[8] = '\0'; | 542 buf[8] = '\0'; |
543 DEBUG_MSG (BUFFER, buffer, | 543 DEBUG_MSG (BUFFER, buffer, |
544 "Current var allocation: %s", | 544 "Current var allocation: %s", |
545 buf); | 545 buf); |
546 } | 546 } |
547 | 547 |
548 void hb_buffer_t::allocate_var (unsigned int byte_i, unsigned int count, const c
har *owner) | 548 void hb_buffer_t::allocate_var (unsigned int byte_i, unsigned int count, const c
har *owner) |
549 { | 549 { |
550 assert (byte_i < 8 && byte_i + count <= 8); | 550 assert (byte_i < 8 && byte_i + count <= 8); |
551 | 551 |
552 if (DEBUG (BUFFER)) | 552 if (DEBUG_ENABLED (BUFFER)) |
553 dump_var_allocation (this); | 553 dump_var_allocation (this); |
554 DEBUG_MSG (BUFFER, this, | 554 DEBUG_MSG (BUFFER, this, |
555 "Allocating var bytes %d..%d for %s", | 555 "Allocating var bytes %d..%d for %s", |
556 byte_i, byte_i + count - 1, owner); | 556 byte_i, byte_i + count - 1, owner); |
557 | 557 |
558 for (unsigned int i = byte_i; i < byte_i + count; i++) { | 558 for (unsigned int i = byte_i; i < byte_i + count; i++) { |
559 assert (!allocated_var_bytes[i]); | 559 assert (!allocated_var_bytes[i]); |
560 allocated_var_bytes[i]++; | 560 allocated_var_bytes[i]++; |
561 allocated_var_owner[i] = owner; | 561 allocated_var_owner[i] = owner; |
562 } | 562 } |
563 } | 563 } |
564 | 564 |
565 void hb_buffer_t::deallocate_var (unsigned int byte_i, unsigned int count, const
char *owner) | 565 void hb_buffer_t::deallocate_var (unsigned int byte_i, unsigned int count, const
char *owner) |
566 { | 566 { |
567 if (DEBUG (BUFFER)) | 567 if (DEBUG_ENABLED (BUFFER)) |
568 dump_var_allocation (this); | 568 dump_var_allocation (this); |
569 | 569 |
570 DEBUG_MSG (BUFFER, this, | 570 DEBUG_MSG (BUFFER, this, |
571 "Deallocating var bytes %d..%d for %s", | 571 "Deallocating var bytes %d..%d for %s", |
572 byte_i, byte_i + count - 1, owner); | 572 byte_i, byte_i + count - 1, owner); |
573 | 573 |
574 assert (byte_i < 8 && byte_i + count <= 8); | 574 assert (byte_i < 8 && byte_i + count <= 8); |
575 for (unsigned int i = byte_i; i < byte_i + count; i++) { | 575 for (unsigned int i = byte_i; i < byte_i + count; i++) { |
576 assert (allocated_var_bytes[i]); | 576 assert (allocated_var_bytes[i]); |
577 assert (0 == strcmp (allocated_var_owner[i], owner)); | 577 assert (0 == strcmp (allocated_var_owner[i], owner)); |
578 allocated_var_bytes[i]--; | 578 allocated_var_bytes[i]--; |
579 } | 579 } |
580 } | 580 } |
581 | 581 |
582 void hb_buffer_t::assert_var (unsigned int byte_i, unsigned int count, const cha
r *owner) | 582 void hb_buffer_t::assert_var (unsigned int byte_i, unsigned int count, const cha
r *owner) |
583 { | 583 { |
584 if (DEBUG (BUFFER)) | 584 if (DEBUG_ENABLED (BUFFER)) |
585 dump_var_allocation (this); | 585 dump_var_allocation (this); |
586 | 586 |
587 DEBUG_MSG (BUFFER, this, | 587 DEBUG_MSG (BUFFER, this, |
588 "Asserting var bytes %d..%d for %s", | 588 "Asserting var bytes %d..%d for %s", |
589 byte_i, byte_i + count - 1, owner); | 589 byte_i, byte_i + count - 1, owner); |
590 | 590 |
591 assert (byte_i < 8 && byte_i + count <= 8); | 591 assert (byte_i < 8 && byte_i + count <= 8); |
592 for (unsigned int i = byte_i; i < byte_i + count; i++) { | 592 for (unsigned int i = byte_i; i < byte_i + count; i++) { |
593 assert (allocated_var_bytes[i]); | 593 assert (allocated_var_bytes[i]); |
594 assert (0 == strcmp (allocated_var_owner[i], owner)); | 594 assert (0 == strcmp (allocated_var_owner[i], owner)); |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 | 1068 |
1069 unsigned int start = 0; | 1069 unsigned int start = 0; |
1070 unsigned int end; | 1070 unsigned int end; |
1071 for (end = start + 1; end < count; end++) | 1071 for (end = start + 1; end < count; end++) |
1072 if (info[start].cluster != info[end].cluster) { | 1072 if (info[start].cluster != info[end].cluster) { |
1073 normalize_glyphs_cluster (buffer, start, end, backward); | 1073 normalize_glyphs_cluster (buffer, start, end, backward); |
1074 start = end; | 1074 start = end; |
1075 } | 1075 } |
1076 normalize_glyphs_cluster (buffer, start, end, backward); | 1076 normalize_glyphs_cluster (buffer, start, end, backward); |
1077 } | 1077 } |
OLD | NEW |