[raster, smooth] Handle FT_RENDER_POOL_SIZE better.

* src/raster/ftraster.c (FT_MAX_BLACK_POOL): New macro.
(ft_black_render): Updated.
* src/smooth/ftgrays.c (FT_MAX_GRAY_POOL): New macro.
(gray_raster_render): Updated.
This commit is contained in:
Alexei Podtelezhnikov 2016-06-17 23:10:22 -04:00
parent 44341d279b
commit 72a0653142
3 changed files with 30 additions and 14 deletions

View File

@ -1,3 +1,12 @@
2016-06-17 Alexei Podtelezhnikov <apodtele@gmail.com>
[raster, smooth] Handle FT_RENDER_POOL_SIZE better.
* src/raster/ftraster.c (FT_MAX_BLACK_POOL): New macro.
(ft_black_render): Updated.
* src/smooth/ftgrays.c (FT_MAX_GRAY_POOL): New macro.
(gray_raster_render): Updated.
2016-06-16 Werner Lemberg <wl@gnu.org>
* src/base/md5.c: Updated to recent version.

View File

@ -179,8 +179,6 @@
#define FT_ERR_XCAT( x, y ) x ## y
#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y )
#define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) )
/* This macro is used to indicate that a function parameter is unused. */
/* Its purpose is simply to reduce compiler warnings. Note also that */
/* simply defining it as `(void)x' doesn't avoid warnings with certain */
@ -459,6 +457,12 @@
#define IS_TOP_OVERSHOOT( x ) \
(Bool)( x - FLOOR( x ) >= ras.precision_half )
#if FT_RENDER_POOL_SIZE > 2048
#define FT_MAX_BLACK_POOL ( FT_RENDER_POOL_SIZE / sizeof ( Long ) )
#elif
#define FT_MAX_BLACK_POOL ( 2048 / sizeof ( Long ) )
#endif
/* The most used variables are positioned at the top of the structure. */
/* Thus, their offset can be coded with less opcodes, resulting in a */
/* smaller executable. */
@ -3138,7 +3142,7 @@
black_TWorker worker[1];
Long buffer[FT_MAX( FT_RENDER_POOL_SIZE, 2048 ) / sizeof ( Long )];
Long buffer[FT_MAX_BLACK_POOL];
if ( !raster )

View File

@ -106,7 +106,6 @@
#define FT_BEGIN_STMNT do {
#define FT_END_STMNT } while ( 0 )
#define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) )
#define FT_ABS( a ) ( (a) < 0 ? -(a) : (a) )
@ -391,10 +390,6 @@ typedef ptrdiff_t FT_PtrDist;
typedef long TArea; /* cell areas, coordinate products */
/* maximum number of gray spans in a call to the span callback */
#define FT_MAX_GRAY_SPANS 32
typedef struct TCell_* PCell;
typedef struct TCell_
@ -407,6 +402,17 @@ typedef ptrdiff_t FT_PtrDist;
} TCell;
/* maximum number of gray spans in a call to the span callback */
#define FT_MAX_GRAY_SPANS 32
/* maximum number of gray cells in the buffer */
#if FT_RENDER_POOL_SIZE > 2048
#define FT_MAX_GRAY_POOL ( FT_RENDER_POOL_SIZE / sizeof ( TCell ) )
#elif
#define FT_MAX_GRAY_POOL ( 2048 / sizeof ( TCell ) )
#endif
#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */
/* We disable the warning `structure was padded due to */
/* __declspec(align())' in order to compile cleanly with */
@ -2024,10 +2030,7 @@ typedef ptrdiff_t FT_PtrDist;
gray_TWorker worker[1];
TCell buffer[FT_MAX( FT_RENDER_POOL_SIZE, 2048 ) / sizeof ( TCell )];
long buffer_size = sizeof ( buffer );
int band_size = (int)( buffer_size /
(long)( sizeof ( TCell ) * 8 ) );
TCell buffer[FT_MAX_GRAY_POOL];
if ( !raster )
@ -2098,12 +2101,12 @@ typedef ptrdiff_t FT_PtrDist;
ras.clip_box.yMax = 32767L;
}
gray_init_cells( RAS_VAR_ buffer, buffer_size );
gray_init_cells( RAS_VAR_ buffer, sizeof ( buffer ) );
ras.outline = *outline;
ras.num_cells = 0;
ras.invalid = 1;
ras.band_size = band_size;
ras.band_size = FT_MAX_GRAY_POOL / 8;
ras.num_gray_spans = 0;
ras.span_y = 0;