[HarfBuzz] harfbuzz: Branch 'master'
Behdad Esfahbod
behdad at kemper.freedesktop.org
Wed Nov 13 11:34:21 PST 2013
src/hb-coretext.cc | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
New commits:
commit 8fcadb9cf9418345610e3f4e38c28c12b768b589
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Nov 13 14:33:57 2013 -0500
[coretext] More scratch buffer fixes
diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 82785c4..eafa68e 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -553,11 +553,21 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
} HB_STMT_END;
unsigned int scratch_size;
- char *scratch = (char *) buffer->get_scratch_buffer (&scratch_size);
+ int *scratch = buffer->get_scratch_buffer (&scratch_size);
+
+#define ALLOCATE_ARRAY(Type, name, len) \
+ Type *name = (Type *) scratch; \
+ { \
+ unsigned int _consumed = DIV_CEIL ((len) * sizeof (Type), sizeof (*scratch)); \
+ assert (_consumed <= scratch_size); \
+ scratch += _consumed; \
+ scratch_size -= _consumed; \
+ }
#define utf16_index() var1.u32
- UniChar *pchars = (UniChar *) scratch;
+ ALLOCATE_ARRAY (UniChar, pchars, buffer->len * 2);
+
unsigned int chars_len = 0;
for (unsigned int i = 0; i < buffer->len; i++) {
hb_codepoint_t c = buffer->info[i].codepoint;
@@ -586,7 +596,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
if (num_features)
{
- unsigned int *log_clusters = (unsigned int *) (pchars + chars_len);
+ ALLOCATE_ARRAY (unsigned int, log_clusters, chars_len);
/* Need log_clusters to assign features. */
chars_len = 0;
@@ -650,15 +660,6 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
unsigned int scratch_size;
int *scratch = buffer->get_scratch_buffer (&scratch_size);
-#define ALLOCATE_ARRAY(Type, name, len) \
- Type *name = (Type *) scratch; \
- { \
- unsigned int _consumed = DIV_CEIL ((len) * sizeof (Type), sizeof (*scratch)); \
- assert (_consumed <= scratch_size); \
- scratch += _consumed; \
- scratch_size -= _consumed; \
- }
-
/* Testing indicates that CTRunGetGlyphsPtr, etc (almost?) always
* succeed, and so copying data to our own buffer will be rare. */
More information about the HarfBuzz
mailing list