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.

This commit is contained in:
Jürg Lehni 2011-06-01 13:42:22 +01:00
parent c47d281308
commit 69e989f834

View file

@ -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;