freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master 20e347a: * graph/grobjs.c (grFindColor): Fortif


From: Alexei Podtelezhnikov
Subject: [freetype2-demos] master 20e347a: * graph/grobjs.c (grFindColor): Fortify gray luminance.
Date: Wed, 24 Jun 2020 22:06:41 -0400 (EDT)

branch: master
commit 20e347a1d43b7c8be5eb4550e692ba36043f16e2
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    * graph/grobjs.c (grFindColor): Fortify gray luminance.
    * graph/gblblit.c (GRGB*_TO_GRAY8): Synchronize with `grFindColor'.
---
 ChangeLog       | 5 +++++
 graph/gblblit.c | 6 +++---
 graph/grobjs.c  | 4 +++-
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 43bab9a..892bc68 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2020-06-20  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+       * graph/grobjs.c (grFindColor): Fortify gray luminance.
+       * graph/gblblit.c (GRGB*_TO_GRAY8): Synchronize with `grFindColor'.
+
 2020-06-24  Jan Alexander Steffens  <jan.steffens@gmail.com>
 
        * Makefile (COMPILE): Prioritize FreeType path.
diff --git a/graph/gblblit.c b/graph/gblblit.c
index a03821a..098d0a8 100644
--- a/graph/gblblit.c
+++ b/graph/gblblit.c
@@ -59,12 +59,12 @@
 
 /* */
 
-#define  GRGB_TO_GRAY8(r,g,b)  ( (unsigned char)( ( 2*(r) + 7*(g) + (b) ) / 10 
) )
+#define  GRGB_TO_GRAY8(r,g,b)  ( (unsigned char)( ( 3*(r) + 6*(g) + (b) ) / 10 
) )
 
 #define  GGRAY8_TO_RGB24(p)    GRGB_PACK(p,p,p)
 
-#define  GRGB24_TO_GRAY8(p)   ( (unsigned char)( ( 2*( ((p) >> 16) & 0xFF ) +  
       \
-                                                   7*( ((p) >>  8) & 0xFF ) +  
       \
+#define  GRGB24_TO_GRAY8(p)   ( (unsigned char)( ( 3*( ((p) >> 16) & 0xFF ) +  
       \
+                                                   6*( ((p) >>  8) & 0xFF ) +  
       \
                                                      ( ((p))       & 0xFF ) ) 
/ 10 ) )
 
 /* */
diff --git a/graph/grobjs.c b/graph/grobjs.c
index 477716e..0e932b7 100644
--- a/graph/grobjs.c
+++ b/graph/grobjs.c
@@ -24,7 +24,9 @@
         break;
 
       case gr_pixel_mode_gray:
-        color.value = (3*red + 6*green + blue)/10;
+        color.value = ( 3*(red   & 0xFF) +
+                        6*(green & 0xFF) +
+                          (blue  & 0xFF) ) / 10;
         break;
 
       case gr_pixel_mode_rgb555:



reply via email to

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