[smooth] Limit pool size on demand.
* src/smooth/ftgrays.c (gray_convert_glyph): Honor FT_GRAY_POOL_SIZE.
This commit is contained in:
parent
819d73f658
commit
4f01f5dbd1
|
@ -469,10 +469,8 @@ typedef ptrdiff_t FT_PtrDist;
|
||||||
} TPixmap;
|
} TPixmap;
|
||||||
|
|
||||||
/* maximum number of gray cells in the buffer */
|
/* maximum number of gray cells in the buffer */
|
||||||
#if FT_RENDER_POOL_SIZE > 2048
|
#if defined( FT_GRAY_POOL_SIZE ) && FT_GRAY_POOL_SIZE > 2048
|
||||||
#define FT_MAX_GRAY_POOL ( FT_RENDER_POOL_SIZE / sizeof ( TCell ) )
|
#define FT_MAX_GRAY_POOL ( FT_RENDER_POOL_SIZE / sizeof ( TCell ) )
|
||||||
#else
|
|
||||||
#define FT_MAX_GRAY_POOL ( 2048 / sizeof ( TCell ) )
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* FT_Span buffer size for direct rendering only */
|
/* FT_Span buffer size for direct rendering only */
|
||||||
|
@ -2026,6 +2024,16 @@ typedef ptrdiff_t FT_PtrDist;
|
||||||
size += height * sizeof ( PCell ) / sizeof ( TCell ) +
|
size += height * sizeof ( PCell ) / sizeof ( TCell ) +
|
||||||
9; /* empirical extra for local extrema */
|
9; /* empirical extra for local extrema */
|
||||||
|
|
||||||
|
#ifdef FT_MAX_GRAY_POOL
|
||||||
|
if ( size > FT_MAX_GRAY_POOL )
|
||||||
|
{
|
||||||
|
/* both divisions rounded up */
|
||||||
|
n = ( size + FT_MAX_GRAY_POOL - 1 ) / FT_MAX_GRAY_POOL;
|
||||||
|
height = ( height + n - 1 ) / n;
|
||||||
|
size = FT_MAX_GRAY_POOL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( FT_QNEW_ARRAY( buffer, size ) )
|
if ( FT_QNEW_ARRAY( buffer, size ) )
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue