From 2a020e5a211bdfa39bfd1e584ba4f6142f136299 Mon Sep 17 00:00:00 2001 From: Niklas von Hertzen Date: Mon, 8 Sep 2014 21:24:26 +0300 Subject: [PATCH] Allow tainting images to be drawn if option enabled --- src/imageloader.js | 2 +- src/renderers/canvas.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/imageloader.js b/src/imageloader.js index 2155762..9f41250 100644 --- a/src/imageloader.js +++ b/src/imageloader.js @@ -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); diff --git a/src/renderers/canvas.js b/src/renderers/canvas.js index d05056d..015317b 100644 --- a/src/renderers/canvas.js +++ b/src/renderers/canvas.js @@ -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); } };