From d8e3f99cdf46297afeb26fe15ad30f7c6de8ee7c Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 18 Jul 2011 08:30:47 +0200 Subject: Switched to freetype 2.4.5 --- freetype/src/raster/ftraster.c | 42 ++++++++++++++++++++++++++++++++++++++++-- freetype/src/raster/ftrend1.c | 8 ++++++++ freetype/src/raster/rules.mk | 5 +++-- 3 files changed, 51 insertions(+), 4 deletions(-) (limited to 'freetype/src/raster') diff --git a/freetype/src/raster/ftraster.c b/freetype/src/raster/ftraster.c index 9638dfb02..55e2d0d75 100644 --- a/freetype/src/raster/ftraster.c +++ b/freetype/src/raster/ftraster.c @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2005, 2007, 2008, 2009, 2010 by */ +/* Copyright 1996-2001, 2002, 2003, 2005, 2007, 2008, 2009, 2010, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -651,11 +651,33 @@ static void Set_High_Precision( RAS_ARGS Int High ) { + /* + * `precision_step' is used in `Bezier_Up' to decide when to split a + * given y-monotonous Bezier arc that crosses a scanline before + * approximating it as a straight segment. The default value of 32 (for + * low accuracy) corresponds to + * + * 32 / 64 == 0.5 pixels , + * + * while for the high accuracy case we have + * + * 256/ (1 << 12) = 0.0625 pixels . + * + * `precision_jitter' is an epsilon threshold used in + * `Vertical_Sweep_Span' to deal with small imperfections in the Bezier + * decomposition (after all, we are working with approximations only); + * it avoids switching on additional pixels which would cause artifacts + * otherwise. + * + * The value of `precision_jitter' has been determined heuristically. + * + */ + if ( High ) { ras.precision_bits = 12; ras.precision_step = 256; - ras.precision_jitter = 50; + ras.precision_jitter = 30; } else { @@ -2403,6 +2425,14 @@ return; /* no drop-out control */ } + /* undocumented but confirmed: If the drop-out would result in a */ + /* pixel outside of the bounding box, use the pixel inside of the */ + /* bounding box instead */ + if ( pxl < 0 ) + pxl = e1; + else if ( TRUNC( pxl ) >= ras.bWidth ) + pxl = e2; + /* check that the other pixel isn't set */ e1 = pxl == e1 ? e2 : e1; @@ -2579,6 +2609,14 @@ return; /* no drop-out control */ } + /* undocumented but confirmed: If the drop-out would result in a */ + /* pixel outside of the bounding box, use the pixel inside of the */ + /* bounding box instead */ + if ( pxl < 0 ) + pxl = e1; + else if ( TRUNC( pxl ) >= ras.target.rows ) + pxl = e2; + /* check that the other pixel isn't set */ e1 = pxl == e1 ? e2 : e1; diff --git a/freetype/src/raster/ftrend1.c b/freetype/src/raster/ftrend1.c index 1ed8af612..d8a89f28a 100644 --- a/freetype/src/raster/ftrend1.c +++ b/freetype/src/raster/ftrend1.c @@ -161,10 +161,18 @@ /* compute the control box, and grid fit it */ FT_Outline_Get_CBox( outline, &cbox ); + /* undocumented but confirmed: bbox values get rounded */ +#if 1 + cbox.xMin = FT_PIX_ROUND( cbox.xMin ); + cbox.yMin = FT_PIX_ROUND( cbox.yMin ); + cbox.xMax = FT_PIX_ROUND( cbox.xMax ); + cbox.yMax = FT_PIX_ROUND( cbox.yMax ); +#else cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); cbox.xMax = FT_PIX_CEIL( cbox.xMax ); cbox.yMax = FT_PIX_CEIL( cbox.yMax ); +#endif width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 ); height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 ); diff --git a/freetype/src/raster/rules.mk b/freetype/src/raster/rules.mk index 9703b1298..0e0b5e4eb 100644 --- a/freetype/src/raster/rules.mk +++ b/freetype/src/raster/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2001, 2003, 2008, 2009 by +# Copyright 1996-2000, 2001, 2003, 2008, 2009, 2011 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -25,7 +25,8 @@ RASTER_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(RASTER_DIR)) # raster driver sources (i.e., C files) # RASTER_DRV_SRC := $(RASTER_DIR)/ftraster.c \ - $(RASTER_DIR)/ftrend1.c + $(RASTER_DIR)/ftrend1.c \ + $(RASTER_DIR)/rastpic.c # raster driver headers -- cgit v1.2.3