From 69e989f8343811f4edb0457d49c20d8af88191ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Wed, 1 Jun 2011 13:42:22 +0100 Subject: [PATCH] No need to set dst[i + 3] again after changing dA2, since we are now only setting it after calling process() from the main loop. --- src/util/BlendMode.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/util/BlendMode.js b/src/util/BlendMode.js index c620a14a..bf5e5d70 100644 --- a/src/util/BlendMode.js +++ b/src/util/BlendMode.js @@ -143,22 +143,21 @@ var BlendMode = { // Only differs from Photoshop in low - opacity areas dA2 = sA * dA; demultiply = 255 / dA2; - dst[i + 3] = dA2 * 255; dst[i] = sRA * dA * demultiply; dst[i + 1] = sGA * dA * demultiply; dst[i + 2] = sBA * dA * demultiply; }, add: function(i) { - // Photoshop doesn't simply add the alpha channels; this might be correct wrt SVG 1.2 + // Photoshop doesn't simply add the alpha channels, + // this might be correct wrt SVG 1.2 dA2 = min(1, sA + dA); - dst[i + 3] = dA2 * 255; demultiply = 255 / dA2; dst[i] = min(sRA + dRA, 1) * demultiply; dst[i + 1] = min(sGA + dGA, 1) * demultiply; dst[i + 2] = min(sBA + dBA, 1) * demultiply; } - } + }; var process = modes[blendMode] || modes.unsupported;