| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright © 2007,2008,2009,2010 Red Hat, Inc. | 2 * Copyright © 2007,2008,2009,2010 Red Hat, Inc. |
| 3 * Copyright © 2012 Google, Inc. | 3 * Copyright © 2012 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 #endif | 178 #endif |
| 179 | 179 |
| 180 | 180 |
| 181 #define TRACE_SANITIZE(this) \ | 181 #define TRACE_SANITIZE(this) \ |
| 182 hb_auto_trace_t<HB_DEBUG_SANITIZE, bool> trace \ | 182 hb_auto_trace_t<HB_DEBUG_SANITIZE, bool> trace \ |
| 183 (&c->debug_depth, c->get_name (), this, HB_FUNC, \ | 183 (&c->debug_depth, c->get_name (), this, HB_FUNC, \ |
| 184 ""); | 184 ""); |
| 185 | 185 |
| 186 /* This limits sanitizing time on really broken fonts. */ | 186 /* This limits sanitizing time on really broken fonts. */ |
| 187 #ifndef HB_SANITIZE_MAX_EDITS | 187 #ifndef HB_SANITIZE_MAX_EDITS |
| 188 #define HB_SANITIZE_MAX_EDITS 100 | 188 #define HB_SANITIZE_MAX_EDITS 8 |
| 189 #endif | 189 #endif |
| 190 | 190 |
| 191 struct hb_sanitize_context_t : | 191 struct hb_sanitize_context_t : |
| 192 hb_dispatch_context_t<hb_sanitize_context_t, bool, HB_DEBUG_SANITIZE> | 192 hb_dispatch_context_t<hb_sanitize_context_t, bool, HB_DEBUG_SANITIZE> |
| 193 { | 193 { |
| 194 inline hb_sanitize_context_t (void) : | 194 inline hb_sanitize_context_t (void) : |
| 195 debug_depth (0), | 195 debug_depth (0), |
| 196 start (NULL), end (NULL), | 196 start (NULL), end (NULL), |
| 197 writable (false), edit_count (0), | 197 writable (false), edit_count (0), |
| 198 blob (NULL) {} | 198 blob (NULL) {} |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 | 392 |
| 393 | 393 |
| 394 #define TRACE_SERIALIZE(this) \ | 394 #define TRACE_SERIALIZE(this) \ |
| 395 hb_auto_trace_t<HB_DEBUG_SERIALIZE, bool> trace \ | 395 hb_auto_trace_t<HB_DEBUG_SERIALIZE, bool> trace \ |
| 396 (&c->debug_depth, "SERIALIZE", c, HB_FUNC, \ | 396 (&c->debug_depth, "SERIALIZE", c, HB_FUNC, \ |
| 397 ""); | 397 ""); |
| 398 | 398 |
| 399 | 399 |
| 400 struct hb_serialize_context_t | 400 struct hb_serialize_context_t |
| 401 { | 401 { |
| 402 inline hb_serialize_context_t (void *start, unsigned int size) | 402 inline hb_serialize_context_t (void *start_, unsigned int size) |
| 403 { | 403 { |
| 404 this->start = (char *) start; | 404 this->start = (char *) start_; |
| 405 this->end = this->start + size; | 405 this->end = this->start + size; |
| 406 | 406 |
| 407 this->ran_out_of_room = false; | 407 this->ran_out_of_room = false; |
| 408 this->head = this->start; | 408 this->head = this->start; |
| 409 this->debug_depth = 0; | 409 this->debug_depth = 0; |
| 410 } | 410 } |
| 411 | 411 |
| 412 template <typename Type> | 412 template <typename Type> |
| 413 inline Type *start_serialize (void) | 413 inline Type *start_serialize (void) |
| 414 { | 414 { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 | 488 |
| 489 template <typename Type> | 489 template <typename Type> |
| 490 inline Type *extend (Type &obj) | 490 inline Type *extend (Type &obj) |
| 491 { | 491 { |
| 492 unsigned int size = obj.get_size (); | 492 unsigned int size = obj.get_size (); |
| 493 assert (this->start < (char *) &obj && (char *) &obj <= this->head && (char
*) &obj + size >= this->head); | 493 assert (this->start < (char *) &obj && (char *) &obj <= this->head && (char
*) &obj + size >= this->head); |
| 494 if (unlikely (!this->allocate_size<Type> (((char *) &obj) + size - this->hea
d))) return NULL; | 494 if (unlikely (!this->allocate_size<Type> (((char *) &obj) + size - this->hea
d))) return NULL; |
| 495 return reinterpret_cast<Type *> (&obj); | 495 return reinterpret_cast<Type *> (&obj); |
| 496 } | 496 } |
| 497 | 497 |
| 498 inline void truncate (void *head) | 498 inline void truncate (void *new_head) |
| 499 { | 499 { |
| 500 assert (this->start < head && head <= this->head); | 500 assert (this->start < new_head && new_head <= this->head); |
| 501 this->head = (char *) head; | 501 this->head = (char *) new_head; |
| 502 } | 502 } |
| 503 | 503 |
| 504 unsigned int debug_depth; | 504 unsigned int debug_depth; |
| 505 char *start, *end, *head; | 505 char *start, *end, *head; |
| 506 bool ran_out_of_room; | 506 bool ran_out_of_room; |
| 507 }; | 507 }; |
| 508 | 508 |
| 509 template <typename Type> | 509 template <typename Type> |
| 510 struct Supplier | 510 struct Supplier |
| 511 { | 511 { |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 } | 1037 } |
| 1038 return -1; | 1038 return -1; |
| 1039 } | 1039 } |
| 1040 }; | 1040 }; |
| 1041 | 1041 |
| 1042 | 1042 |
| 1043 } /* namespace OT */ | 1043 } /* namespace OT */ |
| 1044 | 1044 |
| 1045 | 1045 |
| 1046 #endif /* HB_OPEN_TYPE_PRIVATE_HH */ | 1046 #endif /* HB_OPEN_TYPE_PRIVATE_HH */ |
| OLD | NEW |