diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index 6b31e6e..e8a89fa 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -149,6 +149,7 @@ this._spriteRect = null; + this._fastRect = false; /** * When cacheAsBitmap is set to true the graphics object will be rendered as if it was a sprite. @@ -719,17 +720,16 @@ { this.dirty = true; this.glDirty = false; + this._fastRect = this.graphicsData.length === 1 && this.graphicsData[0].shape.type === CONST.SHAPES.RECT && !this.graphicsData[0].lineWidth; } - if(this.graphicsData.length === 1 - && this.graphicsData[0].shape.type === CONST.SHAPES.RECT - && !this.graphicsData[0].lineWidth) + //TODO this check can be moved to dirty? + if(this._fastRect) { this._renderSpriteRect(renderer); } else { - renderer.setObjectRenderer(renderer.plugins.graphics); renderer.plugins.graphics.render(this); } @@ -755,10 +755,14 @@ this._spriteRect.tint = this.graphicsData[0].fillColor; } + this._spriteRect.worldAlpha = this.worldAlpha; + Graphics._SPRITE_TEXTURE.crop.width = rect.width; Graphics._SPRITE_TEXTURE.crop.height = rect.height; + this._spriteRect.transform.worldTransform = this.transform.worldTransform; + this._spriteRect.anchor.x = -rect.x / rect.width; this._spriteRect.anchor.y = -rect.y / rect.height;