[ftsmooth] Improve rendering. * src/smooth/ftsmooth.c (gray_render_conic): Since version 2.4.3, cubic deviations have been estimated _after_ UPSCALE, whereas conic ones have been evaluated _before_ UPSCALE, which produces inferior rendering results. Fix this. Partially undo change from 2010-10-15 by using ONE_PIXEL/4; this has been tested with demo images sent to the mailing list. See http://lists.gnu.org/archive/html/freetype-devel/2010-10/msg00055.html and later mails in this thread.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
diff --git a/ChangeLog b/ChangeLog
index 414eae7..6e896b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2010-11-01 Alexei Podtelezhnikov <apodtele@gmail.com>
+
+ [ftsmooth] Improve rendering.
+
+ * src/smooth/ftsmooth.c (gray_render_conic): Since version 2.4.3,
+ cubic deviations have been estimated _after_ UPSCALE, whereas
+ conic ones have been evaluated _before_ UPSCALE, which produces
+ inferior rendering results. Fix this.
+ Partially undo change from 2010-10-15 by using ONE_PIXEL/4; this has
+ been tested with demo images sent to the mailing list. See
+
+ http://lists.gnu.org/archive/html/freetype-devel/2010-10/msg00055.html
+
+ and later mails in this thread.
+
2010-10-28 Werner Lemberg <wl@gnu.org>
[ftraster] Minor fixes.
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 4477638..8f93392 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -877,40 +877,35 @@ typedef ptrdiff_t FT_PtrDist;
FT_Vector* arc;
- dx = DOWNSCALE( ras.x ) + to->x - ( control->x << 1 );
- if ( dx < 0 )
- dx = -dx;
- dy = DOWNSCALE( ras.y ) + to->y - ( control->y << 1 );
- if ( dy < 0 )
- dy = -dy;
+ arc = ras.bez_stack;
+ arc[0].x = UPSCALE( to->x );
+ arc[0].y = UPSCALE( to->y );
+ arc[1].x = UPSCALE( control->x );
+ arc[1].y = UPSCALE( control->y );
+ arc[2].x = ras.x;
+ arc[2].y = ras.y;
+
+ dx = FT_ABS( arc[2].x + arc[0].x - 2 * arc[1].x );
+ dy = FT_ABS( arc[2].y + arc[0].y - 2 * arc[1].y );
if ( dx < dy )
dx = dy;
- if ( dx <= ONE_PIXEL / 8 )
+ if ( dx <= ONE_PIXEL / 4 )
{
- gray_render_line( RAS_VAR_ UPSCALE( to->x ), UPSCALE( to->y ) );
+ gray_render_line( RAS_VAR_ arc[0].x, arc[0].y );
return;
}
- level = 1;
- dx /= ONE_PIXEL / 8;
- while ( dx > 1 )
+ level = 0;
+ while ( dx > ONE_PIXEL / 4 )
{
dx >>= 2;
level++;
}
- arc = ras.bez_stack;
levels = ras.lev_stack;
- top = 0;
levels[0] = level;
-
- arc[0].x = UPSCALE( to->x );
- arc[0].y = UPSCALE( to->y );
- arc[1].x = UPSCALE( control->x );
- arc[1].y = UPSCALE( control->y );
- arc[2].x = ras.x;
- arc[2].y = ras.y;
+ top = 0;
while ( top >= 0 )
{