diff --git a/src/pixi/textures/BaseTexture.js b/src/pixi/textures/BaseTexture.js index a4922e6..2a2a375 100644 --- a/src/pixi/textures/BaseTexture.js +++ b/src/pixi/textures/BaseTexture.js @@ -63,34 +63,7 @@ if(!source)return; - if(this.source instanceof Image || this.source instanceof HTMLImageElement) - { - if(this.source.complete) - { - this.hasLoaded = true; - this.width = this.source.width; - this.height = this.source.height; - - PIXI.texturesToUpdate.push(this); - } - else - { - - var scope = this; - this.source.onload = function() { - - scope.hasLoaded = true; - scope.width = scope.source.width; - scope.height = scope.source.height; - - // add it to somewhere... - PIXI.texturesToUpdate.push(scope); - scope.dispatchEvent( { type: 'loaded', content: scope } ); - }; - //this.image.src = imageUrl; - } - } - else + if(this.source.complete || this.source.getContext) { this.hasLoaded = true; this.width = this.source.width; @@ -98,6 +71,22 @@ PIXI.texturesToUpdate.push(this); } + else + { + + var scope = this; + this.source.onload = function() { + + scope.hasLoaded = true; + scope.width = scope.source.width; + scope.height = scope.source.height; + + // add it to somewhere... + PIXI.texturesToUpdate.push(scope); + scope.dispatchEvent( { type: 'loaded', content: scope } ); + }; + //this.image.src = imageUrl; + } this.imageUrl = null; this._powerOf2 = false; @@ -117,10 +106,9 @@ */ PIXI.BaseTexture.prototype.destroy = function() { - if(this.source instanceof Image) + if(this.imageUrl) { - if (this.imageUrl in PIXI.BaseTextureCache) - delete PIXI.BaseTextureCache[this.imageUrl]; + delete PIXI.BaseTextureCache[this.imageUrl]; this.imageUrl = null; this.source.src = null; }