From 516342534468565abf0dafbd5bbb2891bfc19990 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 14 Jan 2015 18:30:59 +0100 Subject: [PATCH] [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. --- ChangeLog | 15 +++++++++++++++ devel/ftoption.h | 4 ---- include/config/ftoption.h | 4 ---- include/ftimage.h | 13 ++++++------- src/base/ftobjs.c | 13 +++---------- 5 files changed, 24 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index b1b6ba895..6aca6373e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2015-01-14 Behdad Esfahbod + + [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 [base] Do not reorder library->renderers upon use. diff --git a/devel/ftoption.h b/devel/ftoption.h index 598460112..3d0c77d9d 100644 --- a/devel/ftoption.h +++ b/devel/ftoption.h @@ -378,10 +378,6 @@ FT_BEGIN_HEADER /* 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 diff --git a/include/config/ftoption.h b/include/config/ftoption.h index a40e88cbd..c85519d8e 100644 --- a/include/config/ftoption.h +++ b/include/config/ftoption.h @@ -378,10 +378,6 @@ FT_BEGIN_HEADER /* 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 diff --git a/include/ftimage.h b/include/ftimage.h index 2f7ca2aaf..42815c0a1 100644 --- a/include/ftimage.h +++ b/include/ftimage.h @@ -1078,10 +1078,10 @@ FT_BEGIN_HEADER /* FT_Raster_ResetFunc */ /* */ /* */ - /* 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 @@ FT_BEGIN_HEADER /* pool_size :: The size in bytes of the render pool. */ /* */ /* */ - /* 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, diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 6d685b5aa..ba5a24b87 100644 --- 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; @@ -4820,10 +4817,6 @@ } #endif - /* Destroy raster objects */ - FT_FREE( library->raster_pool ); - library->raster_pool_size = 0; - #ifdef FT_CONFIG_OPTION_PIC /* Destroy pic container contents */ ft_pic_container_destroy( library );