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

Side by Side Diff: third_party/harfbuzz-ng/src/hb-private.hh

Issue 70193010: Update harfbuzz-ng to 0.9.24 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright © 2007,2008,2009 Red Hat, Inc. 2 * Copyright © 2007,2008,2009 Red Hat, Inc.
3 * Copyright © 2011,2012 Google, Inc. 3 * Copyright © 2011,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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 73
74 #undef MIN 74 #undef MIN
75 template <typename Type> 75 template <typename Type>
76 static inline Type MIN (const Type &a, const Type &b) { return a < b ? a : b; } 76 static inline Type MIN (const Type &a, const Type &b) { return a < b ? a : b; }
77 77
78 #undef MAX 78 #undef MAX
79 template <typename Type> 79 template <typename Type>
80 static inline Type MAX (const Type &a, const Type &b) { return a > b ? a : b; } 80 static inline Type MAX (const Type &a, const Type &b) { return a > b ? a : b; }
81 81
82 static inline unsigned int DIV_CEIL (const unsigned int a, unsigned int b)
83 { return (a + (b - 1)) / b; }
84
82 85
83 #undef ARRAY_LENGTH 86 #undef ARRAY_LENGTH
84 template <typename Type, unsigned int n> 87 template <typename Type, unsigned int n>
85 static inline unsigned int ARRAY_LENGTH (const Type (&)[n]) { return n; } 88 static inline unsigned int ARRAY_LENGTH (const Type (&)[n]) { return n; }
86 /* A const version, but does not detect erratically being called on pointers. */ 89 /* A const version, but does not detect erratically being called on pointers. */
87 #define ARRAY_LENGTH_CONST(__array) ((signed int) (sizeof (__array) / sizeof (__ array[0]))) 90 #define ARRAY_LENGTH_CONST(__array) ((signed int) (sizeof (__array) / sizeof (__ array[0])))
88 91
89 #define HB_STMT_START do 92 #define HB_STMT_START do
90 #define HB_STMT_END while (0) 93 #define HB_STMT_END while (0)
91 94
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 return NULL; 317 return NULL;
315 318
316 array = new_array; 319 array = new_array;
317 allocated = new_allocated; 320 allocated = new_allocated;
318 return &array[len++]; 321 return &array[len++];
319 } 322 }
320 323
321 inline void pop (void) 324 inline void pop (void)
322 { 325 {
323 len--; 326 len--;
324 /* TODO: shrink array if needed */ 327 }
328
329 inline void remove (unsigned int i)
330 {
331 if (unlikely (i >= len))
332 return;
333 memmove (static_cast<void *> (&array[i]),
334 » static_cast<void *> (&array[i + 1]),
335 » (len - i - 1) * sizeof (Type));
336 len--;
325 } 337 }
326 338
327 inline void shrink (unsigned int l) 339 inline void shrink (unsigned int l)
328 { 340 {
329 if (l < len) 341 if (l < len)
330 len = l; 342 len = l;
331 /* TODO: shrink array if needed */
332 } 343 }
333 344
334 template <typename T> 345 template <typename T>
335 inline Type *find (T v) { 346 inline Type *find (T v) {
336 for (unsigned int i = 0; i < len; i++) 347 for (unsigned int i = 0; i < len; i++)
337 if (array[i] == v) 348 if (array[i] == v)
338 return &array[i]; 349 return &array[i];
339 return NULL; 350 return NULL;
340 } 351 }
341 template <typename T> 352 template <typename T>
(...skipping 27 matching lines...) Expand all
369 380
370 inline void finish (void) 381 inline void finish (void)
371 { 382 {
372 if (array != static_array) 383 if (array != static_array)
373 free (array); 384 free (array);
374 array = NULL; 385 array = NULL;
375 allocated = len = 0; 386 allocated = len = 0;
376 } 387 }
377 }; 388 };
378 389
379 #define HB_AUTO_ARRAY_PREALLOCED 64 390 #define HB_AUTO_ARRAY_PREALLOCED 16
380 template <typename Type> 391 template <typename Type>
381 struct hb_auto_array_t : hb_prealloced_array_t <Type, HB_AUTO_ARRAY_PREALLOCED> 392 struct hb_auto_array_t : hb_prealloced_array_t <Type, HB_AUTO_ARRAY_PREALLOCED>
382 { 393 {
383 hb_auto_array_t (void) { hb_prealloced_array_t<Type, HB_AUTO_ARRAY_PREALLOCED> ::init (); } 394 hb_auto_array_t (void) { hb_prealloced_array_t<Type, HB_AUTO_ARRAY_PREALLOCED> ::init (); }
384 ~hb_auto_array_t (void) { hb_prealloced_array_t<Type, HB_AUTO_ARRAY_PREALLOCED >::finish (); } 395 ~hb_auto_array_t (void) { hb_prealloced_array_t<Type, HB_AUTO_ARRAY_PREALLOCED >::finish (); }
385 }; 396 };
386 397
387 398
388 #define HB_LOCKABLE_SET_INIT {HB_PREALLOCED_ARRAY_INIT} 399 #define HB_LOCKABLE_SET_INIT {HB_PREALLOCED_ARRAY_INIT}
389 template <typename item_t, typename lock_t> 400 template <typename item_t, typename lock_t>
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 599
589 if (indented) { 600 if (indented) {
590 /* One may want to add ASCII version of these. See: 601 /* One may want to add ASCII version of these. See:
591 * https://bugs.freedesktop.org/show_bug.cgi?id=50970 */ 602 * https://bugs.freedesktop.org/show_bug.cgi?id=50970 */
592 #define VBAR "\342\224\202" /* U+2502 BOX DRAWINGS LIGHT VERTICAL */ 603 #define VBAR "\342\224\202" /* U+2502 BOX DRAWINGS LIGHT VERTICAL */
593 #define VRBAR "\342\224\234" /* U+251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT */ 604 #define VRBAR "\342\224\234" /* U+251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT */
594 #define DLBAR "\342\225\256" /* U+256E BOX DRAWINGS LIGHT ARC DOWN AND LEFT * / 605 #define DLBAR "\342\225\256" /* U+256E BOX DRAWINGS LIGHT ARC DOWN AND LEFT * /
595 #define ULBAR "\342\225\257" /* U+256F BOX DRAWINGS LIGHT ARC UP AND LEFT */ 606 #define ULBAR "\342\225\257" /* U+256F BOX DRAWINGS LIGHT ARC UP AND LEFT */
596 #define LBAR "\342\225\264" /* U+2574 BOX DRAWINGS LIGHT LEFT */ 607 #define LBAR "\342\225\264" /* U+2574 BOX DRAWINGS LIGHT LEFT */
597 static const char bars[] = VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR; 608 static const char bars[] = VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR;
598 fprintf (stderr, "%2d %s" VRBAR "%s", 609 fprintf (stderr, "%2u %s" VRBAR "%s",
599 level, 610 level,
600 bars + sizeof (bars) - 1 - MIN ((unsigned int) sizeof (bars), (unsi gned int) (sizeof (VBAR) - 1) * level), 611 bars + sizeof (bars) - 1 - MIN ((unsigned int) sizeof (bars), (unsi gned int) (sizeof (VBAR) - 1) * level),
601 level_dir ? (level_dir > 0 ? DLBAR : ULBAR) : LBAR); 612 level_dir ? (level_dir > 0 ? DLBAR : ULBAR) : LBAR);
602 } else 613 } else
603 fprintf (stderr, " " VRBAR LBAR); 614 fprintf (stderr, " " VRBAR LBAR);
604 615
605 if (func) 616 if (func)
606 { 617 {
607 unsigned int func_len = strlen (func); 618 unsigned int func_len = strlen (func);
608 #ifndef HB_DEBUG_VERBOSE 619 #ifndef HB_DEBUG_VERBOSE
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 hb_options (void) 903 hb_options (void)
893 { 904 {
894 if (unlikely (!_hb_options.i)) 905 if (unlikely (!_hb_options.i))
895 _hb_options_init (); 906 _hb_options_init ();
896 907
897 return _hb_options.opts; 908 return _hb_options.opts;
898 } 909 }
899 910
900 911
901 #endif /* HB_PRIVATE_HH */ 912 #endif /* HB_PRIVATE_HH */
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-ot-shape-normalize.cc ('k') | third_party/harfbuzz-ng/src/hb-set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698