diff --git a/src/core/sprites/Sprite.js b/src/core/sprites/Sprite.js index 0aeda37..dad38fb 100644 --- a/src/core/sprites/Sprite.js +++ b/src/core/sprites/Sprite.js @@ -143,6 +143,7 @@ { this._textureID = -1; this._textureTrimmedID = -1; + this.cachedTint = 0xFFFFFF; // so if _width is 0 then width was not set.. if (this._width) diff --git a/src/core/sprites/Sprite.js b/src/core/sprites/Sprite.js index 0aeda37..dad38fb 100644 --- a/src/core/sprites/Sprite.js +++ b/src/core/sprites/Sprite.js @@ -143,6 +143,7 @@ { this._textureID = -1; this._textureTrimmedID = -1; + this.cachedTint = 0xFFFFFF; // so if _width is 0 then width was not set.. if (this._width) diff --git a/src/extras/AnimatedSprite.js b/src/extras/AnimatedSprite.js index 1754e0e..c605fa8 100644 --- a/src/extras/AnimatedSprite.js +++ b/src/extras/AnimatedSprite.js @@ -271,6 +271,7 @@ { this._texture = this._textures[this.currentFrame]; this._textureID = -1; + this.cachedTint = 0xFFFFFF; if (this.onFrameChange) { diff --git a/src/core/sprites/Sprite.js b/src/core/sprites/Sprite.js index 0aeda37..dad38fb 100644 --- a/src/core/sprites/Sprite.js +++ b/src/core/sprites/Sprite.js @@ -143,6 +143,7 @@ { this._textureID = -1; this._textureTrimmedID = -1; + this.cachedTint = 0xFFFFFF; // so if _width is 0 then width was not set.. if (this._width) diff --git a/src/extras/AnimatedSprite.js b/src/extras/AnimatedSprite.js index 1754e0e..c605fa8 100644 --- a/src/extras/AnimatedSprite.js +++ b/src/extras/AnimatedSprite.js @@ -271,6 +271,7 @@ { this._texture = this._textures[this.currentFrame]; this._textureID = -1; + this.cachedTint = 0xFFFFFF; if (this.onFrameChange) { diff --git a/src/extras/TilingSprite.js b/src/extras/TilingSprite.js index f676737..736b207 100644 --- a/src/extras/TilingSprite.js +++ b/src/extras/TilingSprite.js @@ -56,15 +56,6 @@ this._canvasPattern = null; /** - * flag indicating the texture has changed but hasn't - * been updated yet - * - * @member {boolean} - * @private - */ - this._textureDirtyFlag = true; - - /** * transform that is applied to UV to get the texture coords * * @member {PIXI.extras.TextureTransform} @@ -145,7 +136,7 @@ { this.uvTransform.texture = this._texture; } - this._textureDirtyFlag = true; + this.cachedTint = 0xFFFFFF; } /** @@ -169,7 +160,6 @@ renderer.setObjectRenderer(renderer.plugins[this.pluginName]); renderer.plugins[this.pluginName].render(this); - this._textureDirtyFlag = false; } /** @@ -196,8 +186,9 @@ const modY = ((this.tilePosition.y / this.tileScale.y) % texture._frame.height) * baseTextureResolution; // create a nice shiny pattern! - if (this._textureDirtyFlag) + if (this._textureID !== this._texture._updateID || this.cachedTint !== this.tint) { + this._textureID = this._texture._updateID; // cut an object from a spritesheet.. const tempCanvas = new core.CanvasRenderTarget(texture._frame.width, texture._frame.height, @@ -206,12 +197,7 @@ // Tint the tiling sprite if (this.tint !== 0xFFFFFF) { - if (this.cachedTint !== this.tint) - { - this.cachedTint = this.tint; - - this.tintedTexture = CanvasTinter.getTintedTexture(this, this.tint); - } + this.tintedTexture = CanvasTinter.getTintedTexture(this, this.tint); tempCanvas.context.drawImage(this.tintedTexture, 0, 0); } else @@ -219,8 +205,8 @@ tempCanvas.context.drawImage(baseTexture.source, -texture._frame.x * baseTextureResolution, -texture._frame.y * baseTextureResolution); } + this.cachedTint = this.tint; this._canvasPattern = tempCanvas.context.createPattern(tempCanvas.canvas, 'repeat'); - this._textureDirtyFlag = false; } // set context state..