shithub: freetype+ttf2subf

Download patch

ref: 3beccbdf3996f9ba749d9aad6e223a2f7c77c542
parent: 709486db7f5684329bdf39156fadf6bdff6d8fdd
author: Alexei Podtelezhnikov <[email protected]>
date: Sun Mar 20 20:07:47 EDT 2016

[smooth] Partly revert recent changes.

* src/smooth/ftgrays.c (gray_conic_to, gray_cubic_to): Rework
conditions to fix rendering issues.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-03-21  Alexei Podtelezhnikov  <[email protected]>
+
+	[smooth] Partly revert recent changes.
+
+	* src/smooth/ftgrays.c (gray_conic_to, gray_cubic_to): Rework
+	conditions to fix rendering issues.
+
 2016-03-20  Werner Lemberg  <[email protected]>
 
 	[autofit] Show `near' points in tracing.
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -715,10 +715,10 @@
     /* ok, we'll have to render a run of adjacent cells on the same */
     /* scanline...                                                  */
     /*                                                              */
-    dx    = x2 - x1;
     p     = ( ONE_PIXEL - fx1 ) * ( y2 - y1 );
     first = ONE_PIXEL;
     incr  = 1;
+    dx    = x2 - x1;
 
     if ( dx < 0 )
     {
@@ -1246,8 +1246,6 @@
                  gray_PWorker      worker )
   {
     FT_Vector*  arc = ras.bez_stack;
-    TPos        min = SUBPIXELS( ras.min_ey );
-    TPos        max = SUBPIXELS( ras.max_ey );
 
 
     arc[0].x = UPSCALE( to->x );
@@ -1257,16 +1255,16 @@
     arc[2].x = ras.x;
     arc[2].y = ras.y;
 
-    /* only render arc inside the current band */
-    if ( ( min <= arc[0].y && arc[0].y < max ) ||
-         ( min <= arc[1].y && arc[1].y < max ) ||
-         ( min <= arc[2].y && arc[2].y < max ) )
-      gray_render_conic( RAS_VAR );
+    /* short-cut the arc that crosses the current band */
+    if ( ( TRUNC( arc[0].y ) >= ras.max_ey &&
+           TRUNC( arc[1].y ) >= ras.max_ey &&
+           TRUNC( arc[2].y ) >= ras.max_ey ) ||
+         ( TRUNC( arc[0].y ) <  ras.min_ey &&
+           TRUNC( arc[1].y ) <  ras.min_ey &&
+           TRUNC( arc[2].y ) <  ras.min_ey ) )
+      gray_render_line( RAS_VAR_ arc[0].x, arc[0].y );
     else
-    {
-      ras.x = arc[0].x;
-      ras.y = arc[0].y;
-    }
+      gray_render_conic( RAS_VAR );
 
     return 0;
   }
@@ -1279,8 +1277,6 @@
                  gray_PWorker      worker )
   {
     FT_Vector*  arc = ras.bez_stack;
-    TPos        min = SUBPIXELS( ras.min_ey );
-    TPos        max = SUBPIXELS( ras.max_ey );
 
 
     arc[0].x = UPSCALE( to->x );
@@ -1292,17 +1288,18 @@
     arc[3].x = ras.x;
     arc[3].y = ras.y;
 
-    /* only render arc inside the current band */
-    if ( ( min <= arc[0].y && arc[0].y < max ) ||
-         ( min <= arc[1].y && arc[1].y < max ) ||
-         ( min <= arc[2].y && arc[2].y < max ) ||
-         ( min <= arc[3].y && arc[3].y < max ) )
-      gray_render_cubic( RAS_VAR );
+    /* short-cut the arc that crosses the current band */
+    if ( ( TRUNC( arc[0].y ) >= ras.max_ey &&
+           TRUNC( arc[1].y ) >= ras.max_ey &&
+           TRUNC( arc[2].y ) >= ras.max_ey &&
+           TRUNC( arc[3].y ) >= ras.max_ey ) ||
+         ( TRUNC( arc[0].y ) <  ras.min_ey &&
+           TRUNC( arc[1].y ) <  ras.min_ey &&
+           TRUNC( arc[2].y ) <  ras.min_ey &&
+           TRUNC( arc[3].y ) <  ras.min_ey ) )
+      gray_render_line( RAS_VAR_ arc[0].x, arc[0].y );
     else
-    {
-      ras.x = arc[0].x;
-      ras.y = arc[0].y;
-    }
+      gray_render_cubic( RAS_VAR );
 
     return 0;
   }