freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master 4a3b07c: * src/ftcommon.c (FTDemo_Display_Gamma


From: Alexei Podtelezhnikov
Subject: [freetype2-demos] master 4a3b07c: * src/ftcommon.c (FTDemo_Display_Gamma_Change): Improve readability.
Date: Thu, 14 May 2020 22:07:19 -0400 (EDT)

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

    * src/ftcommon.c (FTDemo_Display_Gamma_Change): Improve readability.
---
 ChangeLog      |  4 ++++
 src/ftcommon.c | 15 ++++++++++-----
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 204f556..484c303 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2020-05-13  Alexei Podtelezhnikov  <address@hidden>
 
+       * src/ftcommon.c (FTDemo_Display_Gamma_Change): Improve readability.
+
+2020-05-13  Alexei Podtelezhnikov  <address@hidden>
+
        [ftview,ftstring,ftgrid] Unify gamma adjustments.
 
        * src/ftcommon.[ch] (FTDemo_Display_Gamma_Change): New function to
diff --git a/src/ftcommon.c b/src/ftcommon.c
index 72c9f8d..8f01264 100644
--- a/src/ftcommon.c
+++ b/src/ftcommon.c
@@ -172,24 +172,29 @@
   FTDemo_Display_Gamma_Change( FTDemo_Display*  display,
                                int              dir )
   {
-    /* interrupt sequence between 2.2 and 2.3 to apply sRGB transformation */
+    /* the sequence of gamma values is limited between 0.3 and 3.0 and */ 
+    /* interrupted between 2.2 and 2.3 to apply sRGB transformation    */
     if ( dir > 0 )
     {
       if ( display->gamma == 0.0 )
         display->gamma  = 2.3;
-      else if ( 2.25 - 0.1 < display->gamma && display->gamma < 2.25 )
+      else if ( display->gamma < 2.25 - 0.1 )
+        display->gamma += 0.1;
+      else if ( display->gamma < 2.25 )
         display->gamma  = 0.0;  /* sRGB */
       else if ( display->gamma < 2.95 )
         display->gamma += 0.1;
     }
     else if ( dir < 0 )
     {
-      if ( display->gamma == 0.0 )
-        display->gamma  = 2.2;
-      else if ( 2.25 + 0.1 > display->gamma && display->gamma > 2.25 )
+      if ( display->gamma > 2.25 + 0.1 )
+        display->gamma -= 0.1;
+      else if ( display->gamma > 2.25 )
         display->gamma  = 0.0;  /* sRGB */
       else if ( display->gamma > 0.35 )
         display->gamma -= 0.1;
+      else if ( display->gamma == 0.0 )
+        display->gamma  = 2.2;
     }
 
     grSetTargetGamma( display->bitmap, display->gamma );



reply via email to

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