freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 9cf232e 1/2: [smooth] Minor clean-ups.


From: Alexei Podtelezhnikov
Subject: [freetype2] master 9cf232e 1/2: [smooth] Minor clean-ups.
Date: Thu, 9 Jun 2016 03:33:44 +0000 (UTC)

branch: master
commit 9cf232ed668476361fb144d79a7e9e8d4debfb1f
Author: Alexei Podtelezhnikov <address@hidden>
Commit: Alexei Podtelezhnikov <address@hidden>

    [smooth] Minor clean-ups.
    
    * src/smooth/ftgrays.c (gray_dump_cells): Move out of the way.
    (gray_render_span): Remove spurious casts and streamline.
---
 ChangeLog            |    7 +++++
 src/smooth/ftgrays.c |   85 ++++++++++++++++++++++++--------------------------
 2 files changed, 47 insertions(+), 45 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d2644ba..4218d3a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-06-08  Alexei Podtelezhnikov  <address@hidden>
+
+       [smooth] Minor clean-ups.
+
+       * src/smooth/ftgrays.c (gray_dump_cells): Move out of the way.
+       (gray_render_span): Remove spurious casts and streamline.
+
 2016-06-07  Werner Lemberg  <address@hidden>
 
        [autofit] Add support for Ethiopic script.
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index bee4043..8aad262 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -475,6 +475,32 @@ typedef ptrdiff_t  FT_PtrDist;
   } gray_TRaster, *gray_PRaster;
 
 
+#ifdef FT_DEBUG_LEVEL_TRACE
+
+  /* to be called while in the debugger --                                */
+  /* this function causes a compiler warning since it is unused otherwise */
+  static void
+  gray_dump_cells( RAS_ARG )
+  {
+    int  yindex;
+
+
+    for ( yindex = 0; yindex < ras.ycount; yindex++ )
+    {
+      PCell  cell;
+
+
+      printf( "%3d:", yindex );
+
+      for ( cell = ras.ycells[yindex]; cell != NULL; cell = cell->next )
+        printf( " (%3ld, c:%4ld, a:%6ld)",
+                cell->x, cell->cover, cell->area );
+      printf( "\n" );
+    }
+  }
+
+#endif /* FT_DEBUG_LEVEL_TRACE */
+
 
   /*************************************************************************/
   /*                                                                       */
@@ -1323,29 +1349,25 @@ typedef ptrdiff_t  FT_PtrDist;
 
       if ( coverage )
       {
+        unsigned char*  q = p + spans->x;
+
+
         /* For small-spans it is faster to do it by ourselves than
          * calling `memset'.  This is mainly due to the cost of the
          * function call.
          */
-        if ( spans->len >= 8 )
-          FT_MEM_SET( p + spans->x, (unsigned char)coverage, spans->len );
-        else
+        switch ( spans->len )
         {
-          unsigned char*  q = p + spans->x;
-
-
-          switch ( spans->len )
-          {
-          case 7: *q++ = (unsigned char)coverage;
-          case 6: *q++ = (unsigned char)coverage;
-          case 5: *q++ = (unsigned char)coverage;
-          case 4: *q++ = (unsigned char)coverage;
-          case 3: *q++ = (unsigned char)coverage;
-          case 2: *q++ = (unsigned char)coverage;
-          case 1: *q   = (unsigned char)coverage;
-          default:
-            ;
-          }
+        case 7: *q++ = coverage;
+        case 6: *q++ = coverage;
+        case 5: *q++ = coverage;
+        case 4: *q++ = coverage;
+        case 3: *q++ = coverage;
+        case 2: *q++ = coverage;
+        case 1: *q   = coverage;
+        case 0: break;
+        default:
+          FT_MEM_SET( q, coverage, spans->len );
         }
       }
     }
@@ -1457,33 +1479,6 @@ typedef ptrdiff_t  FT_PtrDist;
   }
 
 
-#ifdef FT_DEBUG_LEVEL_TRACE
-
-  /* to be called while in the debugger --                                */
-  /* this function causes a compiler warning since it is unused otherwise */
-  static void
-  gray_dump_cells( RAS_ARG )
-  {
-    int  yindex;
-
-
-    for ( yindex = 0; yindex < ras.ycount; yindex++ )
-    {
-      PCell  cell;
-
-
-      printf( "%3d:", yindex );
-
-      for ( cell = ras.ycells[yindex]; cell != NULL; cell = cell->next )
-        printf( " (%3ld, c:%4ld, a:%6ld)",
-                cell->x, cell->cover, cell->area );
-      printf( "\n" );
-    }
-  }
-
-#endif /* FT_DEBUG_LEVEL_TRACE */
-
-
   static void
   gray_sweep( RAS_ARG_ const FT_Bitmap*  target )
   {



reply via email to

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