From 0a28c4282e8f16205960d0eb6a1fef03b08b50a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=CC=8Ans=20Beckman?= Date: Wed, 23 Sep 2015 19:38:12 +0200 Subject: [PATCH] Adding check to see if already loaded images taints the canvas --- src/ol/style/iconstyle.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ol/style/iconstyle.js b/src/ol/style/iconstyle.js index 92e72face4..2f3675c27f 100644 --- a/src/ol/style/iconstyle.js +++ b/src/ol/style/iconstyle.js @@ -426,7 +426,7 @@ ol.style.IconImage_ = function(image, src, size, crossOrigin, imageState) { * @type {boolean} */ this.tainting_ = false; - + if (this.imageState_ == ol.style.ImageState.LOADED)this.determineTainting_(); }; goog.inherits(ol.style.IconImage_, goog.events.EventTarget); @@ -456,8 +456,8 @@ ol.style.IconImage_.get = function(image, src, size, crossOrigin, imageState) { */ ol.style.IconImage_.prototype.determineTainting_ = function() { var context = ol.dom.createCanvasContext2D(1, 1); - context.drawImage(this.image_, 0, 0); try { + context.drawImage(this.image_, 0, 0); context.getImageData(0, 0, 1, 1); } catch (e) { this.tainting_ = true;