ref: 516342534468565abf0dafbd5bbb2891bfc19990
parent: 6dfdaf4d99e435250eb18582fa60b59dc3bbc427
author: Behdad Esfahbod <[email protected]>
date: Wed Jan 14 13:30:59 EST 2015
[base] Don't allocate `library->raster_pool' anymore. It's unused after the following commits: [raster] Allocate render pool for mono rasterizer on the stack. [raster] Remove 5-level gray AA mode from monochrome rasterizer. The value of FT_RENDER_POOL_SIZE still serves the purpose it used to serve, which is, to adjust the pool size. But the pool is now allocated on the stack on demand. * src/base/ftobjs.c (FT_New_Library, FT_Done_Library): Implement.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
2015-01-14 Behdad Esfahbod <[email protected]>
+ [base] Don't allocate `library->raster_pool' anymore.
+
+ It's unused after the following commits:
+
+ [raster] Allocate render pool for mono rasterizer on the stack.
+ [raster] Remove 5-level gray AA mode from monochrome rasterizer.
+
+ The value of FT_RENDER_POOL_SIZE still serves the purpose it used to
+ serve, which is, to adjust the pool size. But the pool is now
+ allocated on the stack on demand.
+
+ * src/base/ftobjs.c (FT_New_Library, FT_Done_Library): Implement.
+
+2015-01-14 Behdad Esfahbod <[email protected]>
+
[base] Do not reorder library->renderers upon use.
Instead of keeping `library->renderers' in a MRU order, just leave
--- a/devel/ftoption.h
+++ b/devel/ftoption.h
@@ -378,10 +378,6 @@
/* The size in bytes of the render pool used by the scan-line converter */
/* to do all of its work. */
/* */
- /* This must be greater than 4KByte if you use FreeType to rasterize */
- /* glyphs; otherwise, you may set it to zero to avoid unnecessary */
- /* allocation of the render pool. */
- /* */
#define FT_RENDER_POOL_SIZE 16384L
--- a/include/config/ftoption.h
+++ b/include/config/ftoption.h
@@ -378,10 +378,6 @@
/* The size in bytes of the render pool used by the scan-line converter */
/* to do all of its work. */
/* */
- /* This must be greater than 4KByte if you use FreeType to rasterize */
- /* glyphs; otherwise, you may set it to zero to avoid unnecessary */
- /* allocation of the render pool. */
- /* */
#define FT_RENDER_POOL_SIZE 16384L
--- a/include/ftimage.h
+++ b/include/ftimage.h
@@ -1078,10 +1078,10 @@
/* FT_Raster_ResetFunc */
/* */
/* <Description> */
- /* FreeType provides an area of memory called the `render pool', */
- /* available to all registered rasters. This pool can be freely used */
- /* during a given scan-conversion but is shared by all rasters. Its */
- /* content is thus transient. */
+ /* FreeType used to provide an area of memory called the `render */
+ /* pool' available to all registered rasters. This was not thread */
+ /* safe however and now FreeType never allocates this pool. NULL */
+ /* is always passed in as pool_base. */
/* */
/* This function is called each time the render pool changes, or just */
/* after a new raster object is created. */
@@ -1094,10 +1094,9 @@
/* pool_size :: The size in bytes of the render pool. */
/* */
/* <Note> */
- /* Rasters can ignore the render pool and rely on dynamic memory */
+ /* Rasters should ignore the render pool and rely on dynamic or stack */
/* allocation if they want to (a handle to the memory allocator is */
- /* passed to the raster constructor). However, this is not */
- /* recommended for efficiency purposes. */
+ /* passed to the raster constructor). */
/* */
typedef void
(*FT_Raster_ResetFunc)( FT_Raster raster,
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -4666,12 +4666,9 @@
goto Fail;
#endif
- /* allocate the render pool */
- library->raster_pool_size = FT_RENDER_POOL_SIZE;
-#if FT_RENDER_POOL_SIZE > 0
- if ( FT_ALLOC( library->raster_pool, FT_RENDER_POOL_SIZE ) )
- goto Fail;
-#endif
+ /* we don't use raster_pool anymore. */
+ library->raster_pool_size = 0;
+ library->raster_pool = NULL;
library->version_major = FREETYPE_MAJOR;
library->version_minor = FREETYPE_MINOR;
@@ -4819,10 +4816,6 @@
}
}
#endif
-
- /* Destroy raster objects */
- FT_FREE( library->raster_pool );
- library->raster_pool_size = 0;
#ifdef FT_CONFIG_OPTION_PIC
/* Destroy pic container contents */