shithub: freetype+ttf2subf

Download patch

ref: 97718f3c91864994025048af756ded07218a1aea
parent: 053943a757dda08a4df9f5fa934f59fb9dab80c1
author: Alexei Podtelezhnikov <[email protected]>
date: Fri Aug 5 19:36:16 EDT 2016

[smooth] Minor refactoring.

* src/smooth/ftgrays.c (gray_render_scanline, gray_render_line):
Updated.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-08-05  Alexei Podtelezhnikov  <[email protected]>
+
+	[smooth] Minor refactoring.
+
+	* src/smooth/ftgrays.c (gray_render_scanline, gray_render_line):
+	Updated.
+
 2016-07-29  Werner Lemberg  <[email protected]>
 
 	[sfnt, truetype] Don't abort on invalid `maxComponentDepth'.
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -657,14 +657,14 @@
       return;
     }
 
-    fx1 = (TCoord)( x1 - SUBPIXELS( ex1 ) );
-    fx2 = (TCoord)( x2 - SUBPIXELS( ex2 ) );
+    fx1   = (TCoord)( x1 - SUBPIXELS( ex1 ) );
+    fx2   = (TCoord)( x2 - SUBPIXELS( ex2 ) );
+    delta = y2 - y1;
 
     /* everything is located in a single cell.  That is easy! */
     /*                                                        */
     if ( ex1 == ex2 )
     {
-      delta      = y2 - y1;
       ras.area  += (TArea)(( fx1 + fx2 ) * delta);
       ras.cover += delta;
       return;
@@ -673,14 +673,17 @@
     /* ok, we'll have to render a run of adjacent cells on the same */
     /* scanline...                                                  */
     /*                                                              */
-    p     = ( ONE_PIXEL - fx1 ) * ( y2 - y1 );
-    first = ONE_PIXEL;
-    incr  = 1;
-    dx    = x2 - x1;
+    dx = x2 - x1;
 
-    if ( dx < 0 )
+    if ( dx > 0 )
     {
-      p     = fx1 * ( y2 - y1 );
+      p     = ( ONE_PIXEL - fx1 ) * delta;
+      first = ONE_PIXEL;
+      incr  = 1;
+    }
+    else
+    {
+      p     = fx1 * delta;
       first = 0;
       incr  = -1;
       dx    = -dx;
@@ -764,8 +767,6 @@
     dy = to_y - ras.y;
 
     /* vertical line - avoid calling gray_render_scanline */
-    incr = 1;
-
     if ( dx == 0 )
     {
       TCoord  ex     = TRUNC( ras.x );
@@ -773,9 +774,13 @@
       TArea   area;
 
 
-      first = ONE_PIXEL;
-      if ( dy < 0 )
+      if ( dy > 0)
       {
+        first = ONE_PIXEL;
+        incr  = 1;
+      }
+      else
+      {
         first = 0;
         incr  = -1;
       }
@@ -806,11 +811,13 @@
     }
 
     /* ok, we have to render several scanlines */
-    p     = ( ONE_PIXEL - fy1 ) * dx;
-    first = ONE_PIXEL;
-    incr  = 1;
-
-    if ( dy < 0 )
+    if ( dy > 0)
+    {
+      p     = ( ONE_PIXEL - fy1 ) * dx;
+      first = ONE_PIXEL;
+      incr  = 1;
+    }
+    else
     {
       p     = fy1 * dx;
       first = 0;