freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master 3beccbd: [smooth] Partly revert recent changes.


From: Alexei Podtelezhnikov
Subject: [freetype2] master 3beccbd: [smooth] Partly revert recent changes.
Date: Mon, 21 Mar 2016 04:08:12 +0000

branch: master
commit 3beccbdf3996f9ba749d9aad6e223a2f7c77c542
Author: Alexei Podtelezhnikov <address@hidden>
Commit: Alexei Podtelezhnikov <address@hidden>

    [smooth] Partly revert recent changes.
    
    * src/smooth/ftgrays.c (gray_conic_to, gray_cubic_to): Rework
    conditions to fix rendering issues.
---
 ChangeLog            |    7 +++++++
 src/smooth/ftgrays.c |   45 +++++++++++++++++++++------------------------
 2 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4a2a83f..67a0150 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-03-21  Alexei Podtelezhnikov  <address@hidden>
+
+       [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  <address@hidden>
 
        [autofit] Show `near' points in tracing.
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 4d3f664..6b4ea1f 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -715,10 +715,10 @@ typedef ptrdiff_t  FT_PtrDist;
     /* 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 @@ typedef ptrdiff_t  FT_PtrDist;
                  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 @@ typedef ptrdiff_t  FT_PtrDist;
     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 @@ typedef ptrdiff_t  FT_PtrDist;
                  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 @@ typedef ptrdiff_t  FT_PtrDist;
     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;
   }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]