summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2010-11-26 00:19:58 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2010-11-26 00:19:58 +0000
commitc547f0ac8e54073711df679b5ebca7614eb27b31 (patch)
tree0e9e684b7b309a27ad34f8ec2286af7c08b7e177 /src
parentMerge from trunk (diff)
downloadinkscape-c547f0ac8e54073711df679b5ebca7614eb27b31.tar.gz
inkscape-c547f0ac8e54073711df679b5ebca7614eb27b31.zip
Fix mask luminance calculation, so the coeffs add up to 1
(bzr r9508.1.71)
Diffstat (limited to 'src')
-rw-r--r--src/display/nr-arena-item.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/display/nr-arena-item.cpp b/src/display/nr-arena-item.cpp
index e6b98e78e..c4c42b8b5 100644
--- a/src/display/nr-arena-item.cpp
+++ b/src/display/nr-arena-item.cpp
@@ -317,8 +317,8 @@ struct MaskLuminanceToAlpha {
// the operation of unpremul -> luminance-to-alpha -> multiply by alpha
// is equivalent to luminance-to-alpha on premultiplied color values
// original computation in double: r*0.2125 + g*0.7154 + b*0.0721
- guint32 ao = r*54 + g*182 + b*18;
- return ((ao + 127) / 255) << 24;
+ guint32 ao = r*109 + g*366 + b*37; // coeffs add up to 512
+ return ((ao + 256) << 15) & 0xff000000; // equivalent to ((ao + 256) / 512) << 24
}
};