Allow tainting images to be drawn if option enabled

This commit is contained in:
Niklas von Hertzen 2014-09-08 21:24:26 +03:00
parent c20e679f2c
commit 2a020e5a21
2 changed files with 2 additions and 2 deletions

View File

@ -34,7 +34,7 @@ ImageLoader.prototype.loadImage = function(imageData) {
var src = imageData.args[0];
if (src.match(/data:image\/.*;base64,/i)) {
return new ImageContainer(src.replace(/url\(['"]{0,}|['"]{0,}\)$/ig, ''), false);
} else if (/(.+).svg$/i.test(src) && !this.support.svg) {
} else if (/(.+).svg$/i.test(src) && !this.support.svg && !this.options.allowTaint) {
return new SVGContainer(src);
} else if (this.isSameOrigin(src) || this.options.allowTaint === true) {
return new ImageContainer(src, false);

View File

@ -42,7 +42,7 @@ CanvasRenderer.prototype.taints = function(imageContainer) {
};
CanvasRenderer.prototype.drawImage = function(imageContainer, sx, sy, sw, sh, dx, dy, dw, dh) {
if (!this.taints(imageContainer)) {
if (!this.taints(imageContainer) || this.options.allowTaint) {
this.ctx.drawImage(imageContainer.image, sx, sy, sw, sh, dx, dy, dw, dh);
}
};