freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master a902227: [ftview] Display more dramatic waterfa


From: Alexei Podtelezhnikov
Subject: [freetype2-demos] master a902227: [ftview] Display more dramatic waterfalls.
Date: Fri, 20 Apr 2018 23:55:11 -0400 (EDT)

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

    [ftview] Display more dramatic waterfalls.
    
    * src/ftview.c (Render_Waterfall): Start from a small size and
    increment so that the requested size is in the middle.
---
 ChangeLog    |  7 +++++++
 src/ftview.c | 14 ++++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4efb093..394a554 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2018-04-20  Alexei Podtelezhnikov  <address@hidden>
+
+       [ftview] Display more dramatic waterfalls.
+
+       * src/ftview.c (Render_Waterfall): Start from a small size and
+       increment so that the requested size is in the middle.
+
 2018-04-19  Alexei Podtelezhnikov  <address@hidden>
 
        * graph/grobjs.c (grFindColor): Missing case added.
diff --git a/src/ftview.c b/src/ftview.c
index c35debb..050fec6 100644
--- a/src/ftview.c
+++ b/src/ftview.c
@@ -570,11 +570,11 @@
 
 
   static FT_Error
-  Render_Waterfall( int  first_size,
+  Render_Waterfall( int  mid_size,
                     int  offset )
   {
     int      start_x, start_y, step_y, x, y;
-    int      pt_size, max_size = 100000;
+    int      pt_size, step, pt_height;
     FT_Size  size;
     int      have_topleft, start;
 
@@ -588,12 +588,18 @@
 
     have_topleft = 0;
 
-    for ( pt_size = first_size; pt_size < max_size; pt_size += 64 )
+    pt_height = 64 * 72 * status.height / status.res;
+    step      = 64 * ( mid_size * mid_size / ( 64 * pt_height ) + 1 );
+    pt_size   = mid_size - step * ( mid_size / step );  /* remainder */
+
+    while ( 1 )
     {
       int first = offset;
       int ch;
 
 
+      pt_size += step;
+
       FTDemo_Set_Current_Charsize( handle, pt_size, status.res );
 
       error = FTDemo_Get_Size( handle, &size );
@@ -673,7 +679,7 @@
       }
     }
 
-    FTDemo_Set_Current_Charsize( handle, first_size, status.res );
+    FTDemo_Set_Current_Charsize( handle, mid_size, status.res );
     FTDemo_Get_Size( handle, &size );
 
     return FT_Err_Ok;



reply via email to

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