freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master e73055c: [smooth] Streamline pixmap drawing.


From: Alexei Podtelezhnikov
Subject: [freetype2] master e73055c: [smooth] Streamline pixmap drawing.
Date: Tue, 30 Aug 2016 03:24:07 +0000 (UTC)

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

    [smooth] Streamline pixmap drawing.
    
    This gives 2% speed improvement in rendering simple glyphs.
    
    * src/smooth/ftgrays.c (TPixmap): Reduced pixmap descriptor with a
    pointer to its bottom-left and pitch to be used in...
    (gray_TWorker): ... here.
    (gray_render_span): Move pixmap flow check from here...
    (gray_raster_render): .. to here.
---
 ChangeLog            |   12 ++++++++++++
 src/smooth/ftgrays.c |   25 ++++++++++++++++---------
 2 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 38eb21b..c3cb03a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2016-08-29  Alexei Podtelezhnikov  <address@hidden>
+
+       [smooth] Streamline pixmap drawing.
+
+       This gives 2% speed improvement in rendering simple glyphs.
+
+       * src/smooth/ftgrays.c (TPixmap): Reduced pixmap descriptor with a
+       pointer to its bottom-left and pitch to be used in...
+       (gray_TWorker): ... here.
+       (gray_render_span): Move pixmap flow check from here...
+       (gray_raster_render): .. to here.
+
 2016-08-27  Alexei Podtelezhnikov  <address@hidden>
 
        [smooth] Reduce stack of band boundaries.
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 296daa49..814749b 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -403,6 +403,12 @@ typedef ptrdiff_t  FT_PtrDist;
 
   } TCell;
 
+  typedef struct TPixmap_
+  {
+    unsigned char*  origin;  /* pixmap origin at the bottom-left */
+    int             pitch;   /* pitch to go down one row */
+
+  } TPixmap;
 
   /* maximum number of gray cells in the buffer */
 #if FT_RENDER_POOL_SIZE > 2048
@@ -440,7 +446,7 @@ typedef ptrdiff_t  FT_PtrDist;
     TPos    x,  y;
 
     FT_Outline  outline;
-    FT_Bitmap   target;
+    TPixmap     target;
 
     FT_Raster_Span_Func  render_span;
     void*                render_span_data;
@@ -1270,14 +1276,8 @@ typedef ptrdiff_t  FT_PtrDist;
                     const FT_Span*  spans,
                     gray_PWorker    worker )
   {
-    unsigned char*  p;
-    FT_Bitmap*      map = &worker->target;
-
+    unsigned char*  p = worker->target.origin - y * worker->target.pitch;
 
-    /* first of all, compute the scanline offset */
-    p = (unsigned char*)map->buffer - y * map->pitch;
-    if ( map->pitch >= 0 )
-      p += ( map->rows - 1 ) * (unsigned int)map->pitch;
 
     for ( ; count > 0; count--, spans++ )
     {
@@ -1962,7 +1962,14 @@ typedef ptrdiff_t  FT_PtrDist;
       if ( !target_map->buffer )
         return FT_THROW( Invalid_Argument );
 
-      ras.target           = *target_map;
+      if ( target_map->pitch < 0 )
+        ras.target.origin = target_map->buffer;
+      else
+        ras.target.origin = target_map->buffer
+              + ( target_map->rows - 1 ) * (unsigned int)target_map->pitch;
+
+      ras.target.pitch = target_map->pitch;
+
       ras.render_span      = (FT_Raster_Span_Func)gray_render_span;
       ras.render_span_data = &ras;
     }



reply via email to

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