From 781408dad8cb485b9a4c0df68ec7c81142abee58 Mon Sep 17 00:00:00 2001 From: brianblakely Date: Mon, 20 Jan 2014 17:30:12 -0500 Subject: [PATCH] [CanvasRenderer] Native "alpha" Context Attribute WHATWG Reference: http://wiki.whatwg.org/wiki/CanvasOpaque Chromium Ticket: https://code.google.com/p/chromium/issues/detail?id=234297 This API feature is now shipping in Chrome 32 stable. Tested there, as well as in Safari 7 and Firefox 26 (which do not yet support it). The desired effect is exhibited with no known regressions, and should provide performance improvements, where supported, akin to the same feature in WebGL. NOTE: As is the case with WebGLRenderer, PIXI.Stage.setBackgroundColor will currently have no effect when transparent is false. --- src/pixi/renderers/canvas/CanvasRenderer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pixi/renderers/canvas/CanvasRenderer.js b/src/pixi/renderers/canvas/CanvasRenderer.js index 58dc3f1..e6fe813 100644 --- a/src/pixi/renderers/canvas/CanvasRenderer.js +++ b/src/pixi/renderers/canvas/CanvasRenderer.js @@ -19,7 +19,7 @@ PIXI.CanvasRenderer = function(width, height, view, transparent) this.type = PIXI.CANVAS_RENDERER; - this.transparent = transparent; + this.transparent = !!transparent; if(!PIXI.blendModesCanvas) { @@ -73,7 +73,7 @@ PIXI.CanvasRenderer = function(width, height, view, transparent) * @property context * @type Canvas 2d Context */ - this.context = this.view.getContext( "2d" ); + this.context = this.view.getContext( "2d" , { alpha: this.transparent } ); //some filter variables this.smoothProperty = null;