[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2-demos] master 2be63f7: [graph] Unravel blending, part 2.
From: |
Alexei Podtelezhnikov |
Subject: |
[freetype2-demos] master 2be63f7: [graph] Unravel blending, part 2. |
Date: |
Sun, 06 Dec 2015 04:22:37 +0000 |
branch: master
commit 2be63f7a4e0feeb49e948117da6a7cc930d85fc3
Author: Alexei Podtelezhnikov <address@hidden>
Commit: Alexei Podtelezhnikov <address@hidden>
[graph] Unravel blending, part 2.
* graph/gblender.c (gblender_reset_key, gblender_reset_channel_key):
Set alpha grid values explicitly.
---
ChangeLog | 7 +++++++
graph/gblender.c | 24 ++----------------------
2 files changed, 9 insertions(+), 22 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 12f6dea..1e4399e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-12-05 Alexei Podtelezhnikov <address@hidden>
+
+ [graph] Unravel blending, part 2.
+
+ * graph/gblender.c (gblender_reset_key, gblender_reset_channel_key):
+ Set alpha grid values explicitly.
+
2015-12-03 Alexei Podtelezhnikov <address@hidden>
[graph] Unravel blending.
diff --git a/graph/gblender.c b/graph/gblender.c
index 5fa120d..2ea27fd 100644
--- a/graph/gblender.c
+++ b/graph/gblender.c
@@ -207,20 +207,9 @@ gblender_reset_key( GBlender blender,
for ( nn = 1; nn < GBLENDER_SHADE_COUNT; nn++ )
{
- unsigned int bits = 8;
- unsigned int a = 0;
+ unsigned int a = 255 * nn / ( GBLENDER_SHADE_COUNT - 1 );
unsigned int r, g, b;
- while ( bits >= GBLENDER_SHADE_BITS )
- {
- bits -= GBLENDER_SHADE_BITS;
- a += (nn << bits);
- }
- if ( bits > 0 )
- {
- bits = GBLENDER_SHADE_BITS - bits;
- a += (nn >> bits);
- }
r = ( r2 * a + r1 * ( 255 - a ) + 127 ) / 255;
g = ( g2 * a + g1 * ( 255 - a ) + 127 ) / 255;
@@ -329,23 +318,14 @@ gblender_reset_channel_key( GBlender blender,
gr[0] = (unsigned char)r1;
gr++;
-
r1 = gamma_ramp[r1];
r2 = gamma_ramp[r2];
for ( nn = 1; nn < GBLENDER_SHADE_COUNT; nn++ )
{
- unsigned int bits = 8;
- unsigned int a = 0;
+ unsigned int a = 255 * nn / ( GBLENDER_SHADE_COUNT - 1 );
unsigned int r;
- while ( bits >= GBLENDER_SHADE_BITS )
- {
- a += (nn << (bits - GBLENDER_SHADE_BITS));
- bits -= GBLENDER_SHADE_BITS;
- }
- if ( bits > 0 )
- a += (nn >> (GBLENDER_SHADE_BITS-bits));
r = ( r2 * a + r1 * ( 255 - a ) + 127 ) / 255;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2-demos] master 2be63f7: [graph] Unravel blending, part 2.,
Alexei Podtelezhnikov <=