aboutsummaryrefslogtreecommitdiff
path: root/freetype/src/smooth
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-06-15 20:22:43 +0200
committermarha <marha@users.sourceforge.net>2015-06-15 20:22:43 +0200
commit0b3be550b20ad9f991f77bf979b2c306a7d4ef11 (patch)
tree523f6db090457118723eca33dabc7758eeb2dcde /freetype/src/smooth
parent5fe210ff514aa4b3149ea7561862776d7b8849e7 (diff)
downloadvcxsrv-0b3be550b20ad9f991f77bf979b2c306a7d4ef11.tar.gz
vcxsrv-0b3be550b20ad9f991f77bf979b2c306a7d4ef11.tar.bz2
vcxsrv-0b3be550b20ad9f991f77bf979b2c306a7d4ef11.zip
Update to freetype 2.6
Diffstat (limited to 'freetype/src/smooth')
-rw-r--r--freetype/src/smooth/Jamfile2
-rw-r--r--freetype/src/smooth/ftgrays.c124
-rw-r--r--freetype/src/smooth/ftgrays.h2
-rw-r--r--freetype/src/smooth/ftsmerrs.h2
-rw-r--r--freetype/src/smooth/ftsmooth.c8
-rw-r--r--freetype/src/smooth/ftsmooth.h2
-rw-r--r--freetype/src/smooth/ftspic.c2
-rw-r--r--freetype/src/smooth/ftspic.h2
-rw-r--r--freetype/src/smooth/module.mk2
-rw-r--r--freetype/src/smooth/rules.mk8
-rw-r--r--freetype/src/smooth/smooth.c2
11 files changed, 80 insertions, 76 deletions
diff --git a/freetype/src/smooth/Jamfile b/freetype/src/smooth/Jamfile
index a8496aa2c..73b29d6bc 100644
--- a/freetype/src/smooth/Jamfile
+++ b/freetype/src/smooth/Jamfile
@@ -1,6 +1,6 @@
# FreeType 2 src/smooth Jamfile
#
-# Copyright 2001 by
+# Copyright 2001-2015 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/freetype/src/smooth/ftgrays.c b/freetype/src/smooth/ftgrays.c
index 131ad27a0..77b58f25f 100644
--- a/freetype/src/smooth/ftgrays.c
+++ b/freetype/src/smooth/ftgrays.c
@@ -4,7 +4,7 @@
/* */
/* A new `perfect' anti-aliasing renderer (body). */
/* */
-/* Copyright 2000-2003, 2005-2014 by */
+/* Copyright 2000-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -94,6 +94,11 @@
#ifdef _STANDALONE_
+ /* The size in bytes of the render pool used by the scan-line converter */
+ /* to do all of its work. */
+#define FT_RENDER_POOL_SIZE 16384L
+
+
/* Auxiliary macros for token concatenation. */
#define FT_ERR_XCAT( x, y ) x ## y
#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y )
@@ -101,6 +106,21 @@
#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) )
+
+
+ /*
+ * Approximate sqrt(x*x+y*y) using the `alpha max plus beta min'
+ * algorithm. We use alpha = 1, beta = 3/8, giving us results with a
+ * largest error less than 7% compared to the exact value.
+ */
+#define FT_HYPOT( x, y ) \
+ ( x = FT_ABS( x ), \
+ y = FT_ABS( y ), \
+ x > y ? x + ( 3 * y >> 3 ) \
+ : y + ( 3 * x >> 3 ) )
+
/* define this to dump debugging information */
/* #define FT_DEBUG_LEVEL_TRACE */
@@ -464,11 +484,7 @@ typedef ptrdiff_t FT_PtrDist;
typedef struct gray_TRaster_
{
- void* buffer;
- long buffer_size;
- int band_size;
void* memory;
- gray_PWorker worker;
} gray_TRaster, *gray_PRaster;
@@ -480,7 +496,7 @@ typedef ptrdiff_t FT_PtrDist;
/* */
static void
gray_init_cells( RAS_ARG_ void* buffer,
- long byte_size )
+ long byte_size )
{
ras.buffer = buffer;
ras.buffer_size = byte_size;
@@ -638,8 +654,8 @@ typedef ptrdiff_t FT_PtrDist;
ras.ey = ey;
}
- ras.invalid = ( (unsigned)ey >= (unsigned)ras.count_ey ||
- ex >= ras.count_ex );
+ ras.invalid = ( (unsigned int)ey >= (unsigned int)ras.count_ey ||
+ ex >= ras.count_ex );
}
@@ -1212,7 +1228,7 @@ typedef ptrdiff_t FT_PtrDist;
/* first of all, compute the scanline offset */
p = (unsigned char*)map->buffer - y * map->pitch;
if ( map->pitch >= 0 )
- p += (unsigned)( ( map->rows - 1 ) * map->pitch );
+ p += ( map->rows - 1 ) * (unsigned int)map->pitch;
for ( ; count > 0; count--, spans++ )
{
@@ -1744,14 +1760,17 @@ typedef ptrdiff_t FT_PtrDist;
} gray_TBand;
- FT_DEFINE_OUTLINE_FUNCS(func_interface,
- (FT_Outline_MoveTo_Func) gray_move_to,
- (FT_Outline_LineTo_Func) gray_line_to,
- (FT_Outline_ConicTo_Func)gray_conic_to,
- (FT_Outline_CubicTo_Func)gray_cubic_to,
- 0,
- 0
- )
+
+ FT_DEFINE_OUTLINE_FUNCS(
+ func_interface,
+
+ (FT_Outline_MoveTo_Func) gray_move_to,
+ (FT_Outline_LineTo_Func) gray_line_to,
+ (FT_Outline_ConicTo_Func)gray_conic_to,
+ (FT_Outline_CubicTo_Func)gray_cubic_to,
+ 0,
+ 0 )
+
static int
gray_convert_glyph_inner( RAS_ARG )
@@ -1842,13 +1861,13 @@ typedef ptrdiff_t FT_PtrDist;
ras.ycells = (PCell*)ras.buffer;
ras.ycount = band->max - band->min;
- cell_start = sizeof ( PCell ) * ras.ycount;
- cell_mod = cell_start % sizeof ( TCell );
+ cell_start = (long)sizeof ( PCell ) * ras.ycount;
+ cell_mod = cell_start % (long)sizeof ( TCell );
if ( cell_mod > 0 )
- cell_start += sizeof ( TCell ) - cell_mod;
+ cell_start += (long)sizeof ( TCell ) - cell_mod;
cell_end = ras.buffer_size;
- cell_end -= cell_end % sizeof ( TCell );
+ cell_end -= cell_end % (long)sizeof ( TCell );
cells_max = (PCell)( (char*)ras.buffer + cell_end );
ras.cells = (PCell)( (char*)ras.buffer + cell_start );
@@ -1918,12 +1937,18 @@ typedef ptrdiff_t FT_PtrDist;
gray_raster_render( gray_PRaster raster,
const FT_Raster_Params* params )
{
- const FT_Outline* outline = (const FT_Outline*)params->source;
- const FT_Bitmap* target_map = params->target;
- gray_PWorker worker;
+ const FT_Outline* outline = (const FT_Outline*)params->source;
+ const FT_Bitmap* target_map = params->target;
+
+ 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 ) );
- if ( !raster || !raster->buffer || !raster->buffer_size )
+
+ if ( !raster )
return FT_THROW( Invalid_Argument );
if ( !outline )
@@ -1940,8 +1965,6 @@ typedef ptrdiff_t FT_PtrDist;
outline->contours[outline->n_contours - 1] + 1 )
return FT_THROW( Invalid_Outline );
- worker = raster->worker;
-
/* if direct mode is not set, we must have a target bitmap */
if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) )
{
@@ -1966,8 +1989,8 @@ typedef ptrdiff_t FT_PtrDist;
/* compute clip box from target pixmap */
ras.clip_box.xMin = 0;
ras.clip_box.yMin = 0;
- ras.clip_box.xMax = target_map->width;
- ras.clip_box.yMax = target_map->rows;
+ ras.clip_box.xMax = (FT_Pos)target_map->width;
+ ras.clip_box.yMax = (FT_Pos)target_map->rows;
}
else if ( params->flags & FT_RASTER_FLAG_CLIP )
ras.clip_box = params->clip_box;
@@ -1979,13 +2002,14 @@ typedef ptrdiff_t FT_PtrDist;
ras.clip_box.yMax = 32767L;
}
- gray_init_cells( RAS_VAR_ raster->buffer, raster->buffer_size );
+ gray_init_cells( RAS_VAR_ buffer, buffer_size );
ras.outline = *outline;
ras.num_cells = 0;
ras.invalid = 1;
- ras.band_size = raster->band_size;
+ ras.band_size = band_size;
ras.num_gray_spans = 0;
+ ras.span_y = 0;
if ( params->flags & FT_RASTER_FLAG_DIRECT )
{
@@ -2069,34 +2093,9 @@ typedef ptrdiff_t FT_PtrDist;
char* pool_base,
long pool_size )
{
- gray_PRaster rast = (gray_PRaster)raster;
-
-
- if ( raster )
- {
- if ( pool_base && pool_size >= (long)sizeof ( gray_TWorker ) + 2048 )
- {
- gray_PWorker worker = (gray_PWorker)pool_base;
-
-
- rast->worker = worker;
- rast->buffer = pool_base +
- ( ( sizeof ( gray_TWorker ) +
- sizeof ( TCell ) - 1 ) &
- ~( sizeof ( TCell ) - 1 ) );
- rast->buffer_size = (long)( ( pool_base + pool_size ) -
- (char*)rast->buffer ) &
- ~( sizeof ( TCell ) - 1 );
- rast->band_size = (int)( rast->buffer_size /
- ( sizeof ( TCell ) * 8 ) );
- }
- else
- {
- rast->buffer = NULL;
- rast->buffer_size = 0;
- rast->worker = NULL;
- }
- }
+ FT_UNUSED( raster );
+ FT_UNUSED( pool_base );
+ FT_UNUSED( pool_size );
}
@@ -2114,15 +2113,16 @@ typedef ptrdiff_t FT_PtrDist;
}
- FT_DEFINE_RASTER_FUNCS(ft_grays_raster,
+ FT_DEFINE_RASTER_FUNCS(
+ ft_grays_raster,
+
FT_GLYPH_FORMAT_OUTLINE,
(FT_Raster_New_Func) gray_raster_new,
(FT_Raster_Reset_Func) gray_raster_reset,
(FT_Raster_Set_Mode_Func)gray_raster_set_mode,
(FT_Raster_Render_Func) gray_raster_render,
- (FT_Raster_Done_Func) gray_raster_done
- )
+ (FT_Raster_Done_Func) gray_raster_done )
/* END */
diff --git a/freetype/src/smooth/ftgrays.h b/freetype/src/smooth/ftgrays.h
index f20f55f14..1b5760330 100644
--- a/freetype/src/smooth/ftgrays.h
+++ b/freetype/src/smooth/ftgrays.h
@@ -4,7 +4,7 @@
/* */
/* FreeType smooth renderer declaration */
/* */
-/* Copyright 1996-2001 by */
+/* Copyright 1996-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/freetype/src/smooth/ftsmerrs.h b/freetype/src/smooth/ftsmerrs.h
index 413d2f1f7..cc38aa199 100644
--- a/freetype/src/smooth/ftsmerrs.h
+++ b/freetype/src/smooth/ftsmerrs.h
@@ -4,7 +4,7 @@
/* */
/* smooth renderer error codes (specification only). */
/* */
-/* Copyright 2001, 2012 by */
+/* Copyright 2001-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/freetype/src/smooth/ftsmooth.c b/freetype/src/smooth/ftsmooth.c
index 4e2dee562..362055053 100644
--- a/freetype/src/smooth/ftsmooth.c
+++ b/freetype/src/smooth/ftsmooth.c
@@ -4,7 +4,7 @@
/* */
/* Anti-aliasing renderer interface (body). */
/* */
-/* Copyright 2000-2006, 2009-2013 by */
+/* Copyright 2000-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -230,7 +230,7 @@
}
/* allocate new one */
- if ( FT_ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) )
+ if ( FT_ALLOC( bitmap->buffer, (FT_ULong)( pitch * height ) ) )
goto Exit;
else
have_buffer = TRUE;
@@ -243,8 +243,8 @@
bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
bitmap->num_grays = 256;
- bitmap->width = width;
- bitmap->rows = height;
+ bitmap->width = (unsigned int)width;
+ bitmap->rows = (unsigned int)height;
bitmap->pitch = pitch;
/* translate outline to render it into the bitmap */
diff --git a/freetype/src/smooth/ftsmooth.h b/freetype/src/smooth/ftsmooth.h
index 3708790df..765018c23 100644
--- a/freetype/src/smooth/ftsmooth.h
+++ b/freetype/src/smooth/ftsmooth.h
@@ -4,7 +4,7 @@
/* */
/* Anti-aliasing renderer interface (specification). */
/* */
-/* Copyright 1996-2001 by */
+/* Copyright 1996-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/freetype/src/smooth/ftspic.c b/freetype/src/smooth/ftspic.c
index 67a2b8310..8e6ed57ee 100644
--- a/freetype/src/smooth/ftspic.c
+++ b/freetype/src/smooth/ftspic.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for smooth module. */
/* */
-/* Copyright 2009, 2010, 2012, 2013 by */
+/* Copyright 2009-2015 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/freetype/src/smooth/ftspic.h b/freetype/src/smooth/ftspic.h
index 334b51c3f..99b9f0ed3 100644
--- a/freetype/src/smooth/ftspic.h
+++ b/freetype/src/smooth/ftspic.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for smooth module. */
/* */
-/* Copyright 2009 by */
+/* Copyright 2009-2015 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/freetype/src/smooth/module.mk b/freetype/src/smooth/module.mk
index 47f6c0407..740936f5b 100644
--- a/freetype/src/smooth/module.mk
+++ b/freetype/src/smooth/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2000, 2006 by
+# Copyright 1996-2015 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/freetype/src/smooth/rules.mk b/freetype/src/smooth/rules.mk
index 88d0aa53a..f00ebd5f1 100644
--- a/freetype/src/smooth/rules.mk
+++ b/freetype/src/smooth/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2000, 2001, 2003, 2011 by
+# Copyright 1996-2015 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -17,9 +17,13 @@
#
SMOOTH_DIR := $(SRC_DIR)/smooth
+
# compilation flags for the driver
#
-SMOOTH_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(SMOOTH_DIR))
+SMOOTH_COMPILE := $(CC) $(ANSIFLAGS) \
+ $I$(subst /,$(COMPILER_SEP),$(SMOOTH_DIR)) \
+ $(INCLUDE_FLAGS) \
+ $(FT_CFLAGS)
# smooth driver sources (i.e., C files)
diff --git a/freetype/src/smooth/smooth.c b/freetype/src/smooth/smooth.c
index a8ac51f9f..4ca4344c8 100644
--- a/freetype/src/smooth/smooth.c
+++ b/freetype/src/smooth/smooth.c
@@ -4,7 +4,7 @@
/* */
/* FreeType anti-aliasing rasterer module component (body only). */
/* */
-/* Copyright 1996-2001 by */
+/* Copyright 1996-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */