diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2015-01-14 19:26:49 +0100 |
---|---|---|
committer | Werner Lemberg <wl@gnu.org> | 2015-01-14 19:26:49 +0100 |
commit | 6f16b10019d7699aff4d5bbc64999a5fd1ce7457 (patch) | |
tree | 10d16a0cbefa204d2e957f0d99503fac4a158601 /src/autofit/afhints.h | |
parent | c27336567bf9ec18734506f68fc03e328c479bc9 (diff) | |
download | freetype2-6f16b10019d7699aff4d5bbc64999a5fd1ce7457.tar.gz |
[autofit] Add embedded arrays for points and contours.
This avoids at least two malloc calls for typical glyphs.
* src/autofit/afhints.h (AF_POINTS_EMBEDDED, AF_CONTOURS_EMBEDDED):
New macros.
(AF_GlyphHintsRec): Add two arrays for contours and points.
* src/autofit/afhints.c (af_glyph_hints_init, af_glyph_hints_done):
Updated.
(af_glyph_hints_reload): Only allocate data if number of contours or
points exceeds given threshold values.
Diffstat (limited to 'src/autofit/afhints.h')
-rw-r--r-- | src/autofit/afhints.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/autofit/afhints.h b/src/autofit/afhints.h index 92101de7c..01e9d706e 100644 --- a/src/autofit/afhints.h +++ b/src/autofit/afhints.h @@ -324,6 +324,9 @@ FT_BEGIN_HEADER } AF_AxisHintsRec, *AF_AxisHints; +#define AF_POINTS_EMBEDDED 96 /* number of embedded points */ +#define AF_CONTOURS_EMBEDDED 8 /* number of embedded contours */ + typedef struct AF_GlyphHintsRec_ { FT_Memory memory; @@ -352,6 +355,14 @@ FT_BEGIN_HEADER FT_Pos xmin_delta; /* used for warping */ FT_Pos xmax_delta; + /* Two arrays to avoid allocation penalty. */ + /* The `embedded' structure must be the last element! */ + struct + { + AF_Point contours[AF_CONTOURS_EMBEDDED]; + AF_PointRec points[AF_POINTS_EMBEDDED]; + } embedded; + } AF_GlyphHintsRec; |