diff options
author | Mattias Andrée <maandree@kth.se> | 2020-04-28 20:17:32 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2020-04-28 20:17:32 +0200 |
commit | 1ad21a6b50bb6e45f6eafd4a460bd3b455a180dd (patch) | |
tree | 054ef23b4ffd57273b71c11b472cbe9302698a02 | |
parent | The demo no longer uses libgrapheme (diff) | |
download | libskrift-1ad21a6b50bb6e45f6eafd4a460bd3b455a180dd.tar.gz libskrift-1ad21a6b50bb6e45f6eafd4a460bd3b455a180dd.tar.bz2 libskrift-1ad21a6b50bb6e45f6eafd4a460bd3b455a180dd.tar.xz |
Fix blending function error for non-premultiplied surfaces
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | apply-glyph.h | 12 |
2 files changed, 7 insertions, 7 deletions
@@ -83,4 +83,4 @@ Out of scope: Underline, overline, strike-thought, ... - Superscript, subscript, ... + Superscript and subscript. diff --git a/apply-glyph.h b/apply-glyph.h index 09cb9aa..a179a1b 100644 --- a/apply-glyph.h +++ b/apply-glyph.h @@ -86,9 +86,9 @@ do { bl = RMAP(*B) * RMAP(*A) * (1 - opacity * gly[c + bi]) + gly[c + bi] * blue; al = RMAP(*A) * (1 - opacity * high) + high * alpha; if (fpclassify(al) != FP_ZERO) { - *R = MAP(re); - *G = MAP(gr); - *B = MAP(bl); + *R = MAP(re / al); + *G = MAP(gr / al); + *B = MAP(bl / al); *A = MAP(al); } else { *R = *G = *B = *A = 0; @@ -104,9 +104,9 @@ do { bl = RMAP(*B) * RMAP(*A) * transparency + gly[c + ri] * blue; al = RMAP(*A) * transparency + gly[c + ri] * alpha; if (fpclassify(al) != FP_ZERO) { - *R = MAP(re); - *G = MAP(gr); - *B = MAP(bl); + *R = MAP(re / al); + *G = MAP(gr / al); + *B = MAP(bl / al); *A = MAP(al); } else { *R = *G = *B = *A = 0; |