freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master efc6fa2c 1/2: [graph] Minor fixes.


From: Werner Lemberg
Subject: [freetype2-demos] master efc6fa2c 1/2: [graph] Minor fixes.
Date: Sat, 27 Aug 2022 23:19:16 -0400 (EDT)

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

    [graph] Minor fixes.
    
    (gblender_clear): Initialize with black background, whereas
    foreground stays invalid.
    (gblender_lookup_channel): Increase cache utilization.
---
 graph/gblender.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/graph/gblender.c b/graph/gblender.c
index 39418692..f4ee39e4 100644
--- a/graph/gblender.c
+++ b/graph/gblender.c
@@ -129,15 +129,15 @@ gblender_clear( GBlender  blender )
     for ( nn = 0; nn < GBLENDER_KEY_COUNT; nn++ )
       chan_keys[nn].index = -1;
 
-    blender->cache_r_back  = ~0U;
+    blender->cache_r_back  = 0;
     blender->cache_r_fore  = ~0U;
     blender->cache_r_cells = NULL;
 
-    blender->cache_g_back  = ~0U;
+    blender->cache_g_back  = 0;
     blender->cache_g_fore  = ~0U;
     blender->cache_g_cells = NULL;
 
-    blender->cache_b_back  = ~0U;
+    blender->cache_b_back  = 0;
     blender->cache_b_fore  = ~0U;
     blender->cache_b_cells = NULL;
   }
@@ -146,7 +146,7 @@ gblender_clear( GBlender  blender )
     for ( nn = 0; nn < GBLENDER_KEY_COUNT; nn++ )
       keys[nn].cells = NULL;
 
-    blender->cache_back  = ~0U;
+    blender->cache_back  = 0;
     blender->cache_fore  = ~0U;
     blender->cache_cells = NULL;
   }
@@ -352,7 +352,8 @@ gblender_lookup_channel( GBlender      blender,
   blender->stat_lookups++;
 #endif
 
-  idx = ( background ^ foreground * 7 ) % (GBLENDER_KEY_COUNT-1);
+  idx = ( background ^ foreground * 7 ) %
+        ( GBLENDER_KEY_COUNT*GBLENDER_CELL_SIZE*sizeof(GBlenderCell) - 1);
 
   key = (GBlenderChanKey)blender->keys + idx;
 



reply via email to

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