mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-23 07:49:48 -05:00
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:
parent
c47d281308
commit
69e989f834
1 changed files with 3 additions and 4 deletions
|
@ -143,22 +143,21 @@ var BlendMode = {
|
||||||
// Only differs from Photoshop in low - opacity areas
|
// Only differs from Photoshop in low - opacity areas
|
||||||
dA2 = sA * dA;
|
dA2 = sA * dA;
|
||||||
demultiply = 255 / dA2;
|
demultiply = 255 / dA2;
|
||||||
dst[i + 3] = dA2 * 255;
|
|
||||||
dst[i] = sRA * dA * demultiply;
|
dst[i] = sRA * dA * demultiply;
|
||||||
dst[i + 1] = sGA * dA * demultiply;
|
dst[i + 1] = sGA * dA * demultiply;
|
||||||
dst[i + 2] = sBA * dA * demultiply;
|
dst[i + 2] = sBA * dA * demultiply;
|
||||||
},
|
},
|
||||||
|
|
||||||
add: function(i) {
|
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);
|
dA2 = min(1, sA + dA);
|
||||||
dst[i + 3] = dA2 * 255;
|
|
||||||
demultiply = 255 / dA2;
|
demultiply = 255 / dA2;
|
||||||
dst[i] = min(sRA + dRA, 1) * demultiply;
|
dst[i] = min(sRA + dRA, 1) * demultiply;
|
||||||
dst[i + 1] = min(sGA + dGA, 1) * demultiply;
|
dst[i + 1] = min(sGA + dGA, 1) * demultiply;
|
||||||
dst[i + 2] = min(sBA + dBA, 1) * demultiply;
|
dst[i + 2] = min(sBA + dBA, 1) * demultiply;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
var process = modes[blendMode] || modes.unsupported;
|
var process = modes[blendMode] || modes.unsupported;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue