@@ -25,6 +25,17 @@ Phaser.BitmapData = function (game, key, width, height) {
2525 */
2626 this . game = game ;
2727
28+ /**
29+ * @property {boolean } exists - If exists = false then the BitmapData isn't updated by the core game loop.
30+ * @default
31+ */
32+ this . exists = true ;
33+
34+ /**
35+ * @property {Phaser.Group } group - The parent Group of this BitmapData.
36+ */
37+ this . group = null ;
38+
2839 /**
2940 * @property {string } name - The name of the BitmapData.
3041 */
@@ -120,13 +131,17 @@ Phaser.BitmapData = function (game, key, width, height) {
120131 */
121132 this . globalCompositeOperation = null ;
122133
134+ this . _dirty = false ;
135+
123136}
124137
125138Phaser . BitmapData . prototype = {
126139
127140 clear : function ( ) {
128141
129142 this . context . clearRect ( 0 , 0 , this . width , this . height ) ;
143+
144+ this . _dirty = true ;
130145
131146 } ,
132147
@@ -157,6 +172,8 @@ Phaser.BitmapData.prototype = {
157172 this . imageData . data . set ( this . data8 ) ;
158173
159174 this . context . putImageData ( this . imageData , 0 , 0 ) ;
175+
176+ this . _dirty = true ;
160177 }
161178
162179 } ,
@@ -229,13 +246,18 @@ Phaser.BitmapData.prototype = {
229246
230247 } ,
231248
232- render : function ( ) {
249+ postUpdate : function ( ) {
250+
251+ if ( this . _dirty )
252+ {
253+ // Only needed if running in WebGL, otherwise this array will never get cleared down I don't think!
254+ if ( this . game . renderType == Phaser . WEBGL )
255+ {
256+ PIXI . texturesToUpdate . push ( this . baseTexture ) ;
257+ }
233258
234- // Only needed if running in WebGL, otherwise this array will never get cleared down I don't think!
235- if ( this . game . renderType == Phaser . WEBGL )
236- {
237- PIXI . texturesToUpdate . push ( this . baseTexture ) ;
238- }
259+ this . _dirty = false ;
260+ }
239261
240262 }
241263
0 commit comments