diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index b00cd54..70bed19 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -877,6 +877,7 @@ this.filling = false; this.boundsDirty = -1; + this.canvasTintDirty = -1; this.dirty++; this.clearDirty++; this.graphicsData.length = 0; diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index b00cd54..70bed19 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -877,6 +877,7 @@ this.filling = false; this.boundsDirty = -1; + this.canvasTintDirty = -1; this.dirty++; this.clearDirty++; this.graphicsData.length = 0; diff --git a/src/core/graphics/canvas/CanvasGraphicsRenderer.js b/src/core/graphics/canvas/CanvasGraphicsRenderer.js index 593ccb0..47412af 100644 --- a/src/core/graphics/canvas/CanvasGraphicsRenderer.js +++ b/src/core/graphics/canvas/CanvasGraphicsRenderer.js @@ -43,12 +43,6 @@ const transform = graphics.transform.worldTransform; const resolution = renderer.resolution; - // if the tint has changed, set the graphics object to dirty. - if (graphics._prevTint !== graphics.tint) - { - graphics.dirty = true; - } - context.setTransform( transform.a * resolution, transform.b * resolution, @@ -58,10 +52,11 @@ transform.ty * resolution ); - if (graphics.dirty) + // update tint if graphics was dirty + if (graphics.canvasTintDirty !== graphics.dirty + || graphics._prevTint !== graphics.tint) { this.updateGraphicsTint(graphics); - graphics.dirty = false; } renderer.setBlendMode(graphics.blendMode); @@ -226,6 +221,7 @@ updateGraphicsTint(graphics) { graphics._prevTint = graphics.tint; + graphics.canvasTintDirty = graphics.dirty; const tintR = ((graphics.tint >> 16) & 0xFF) / 255; const tintG = ((graphics.tint >> 8) & 0xFF) / 255;