aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2020-04-28 20:17:32 +0200
committerMattias Andrée <maandree@kth.se>2020-04-28 20:17:32 +0200
commit1ad21a6b50bb6e45f6eafd4a460bd3b455a180dd (patch)
tree054ef23b4ffd57273b71c11b472cbe9302698a02
parentThe demo no longer uses libgrapheme (diff)
downloadlibskrift-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--README2
-rw-r--r--apply-glyph.h12
2 files changed, 7 insertions, 7 deletions
diff --git a/README b/README
index 19fcc4d..8ab597f 100644
--- a/README
+++ b/README
@@ -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;