@@ -17,9 +17,10 @@ PIXI.glContexts = []; // this is where we store the webGL contexts for easy acce
1717 * @param view {HTMLCanvasElement} the canvas to use as a view, optional
1818 * @param transparent=false {Boolean} If the render view is transparent, default false
1919 * @param antialias=false {Boolean} sets antialias (only applicable in chrome at the moment)
20+ * @param preserveDrawingBuffer=false {Boolean} enables drawing buffer preservation, enable this if you need to call toDataUrl on the webgl context
2021 *
2122 */
22- PIXI . WebGLRenderer = function ( width , height , view , transparent , antialias )
23+ PIXI . WebGLRenderer = function ( width , height , view , transparent , antialias , preserveDrawingBuffer )
2324{
2425 if ( ! PIXI . defaultRenderer )
2526 {
@@ -38,6 +39,14 @@ PIXI.WebGLRenderer = function(width, height, view, transparent, antialias)
3839 */
3940 this . transparent = ! ! transparent ;
4041
42+ /**
43+ * The value of the preserveDrawingBuffer flag affects whether or not the contents of the stencil buffer is retained after rendering.
44+ *
45+ * @property preserveDrawingBuffer
46+ * @type Boolean
47+ */
48+ this . preserveDrawingBuffer = preserveDrawingBuffer ;
49+
4150 /**
4251 * The width of the canvas view
4352 *
@@ -77,7 +86,8 @@ PIXI.WebGLRenderer = function(width, height, view, transparent, antialias)
7786 alpha : this . transparent ,
7887 antialias :! ! antialias , // SPEED UP??
7988 premultipliedAlpha :! ! transparent ,
80- stencil :true
89+ stencil :true ,
90+ preserveDrawingBuffer : preserveDrawingBuffer
8191 } ;
8292
8393 var gl = null ;
0 commit comments