@@ -22,39 +22,39 @@ PIXI.TilingSprite = function(texture, width, height)
2222 * @property width
2323 * @type Number
2424 */
25- this . _width = width || 100 ;
25+ this . _width = width || 128 ;
2626
2727 /**
2828 * The height of the tiling sprite
2929 *
3030 * @property height
3131 * @type Number
3232 */
33- this . _height = height || 100 ;
33+ this . _height = height || 128 ;
3434
3535 /**
3636 * The scaling of the image that is being tiled
3737 *
3838 * @property tileScale
3939 * @type Point
4040 */
41- this . tileScale = new PIXI . Point ( 1 , 1 ) ;
41+ this . tileScale = new PIXI . Point ( 1 , 1 ) ;
4242
4343 /**
4444 * A point that represents the scale of the texture object
4545 *
4646 * @property tileScaleOffset
4747 * @type Point
4848 */
49- this . tileScaleOffset = new PIXI . Point ( 1 , 1 ) ;
49+ this . tileScaleOffset = new PIXI . Point ( 1 , 1 ) ;
5050
5151 /**
5252 * The offset position of the image that is being tiled
5353 *
5454 * @property tilePosition
5555 * @type Point
5656 */
57- this . tilePosition = new PIXI . Point ( 0 , 0 ) ;
57+ this . tilePosition = new PIXI . Point ( ) ;
5858
5959 /**
6060 * Whether this sprite is renderable or not
@@ -117,6 +117,9 @@ PIXI.TilingSprite = function(texture, width, height)
117117 */
118118 this . refreshTexture = true ;
119119
120+ this . frameWidth = 0 ;
121+ this . frameHeight = 0 ;
122+
120123} ;
121124
122125PIXI . TilingSprite . prototype = Object . create ( PIXI . Sprite . prototype ) ;
@@ -164,20 +167,21 @@ PIXI.TilingSprite.prototype._renderWebGL = function(renderSession)
164167 {
165168 this . generateTilingTexture ( true ) ;
166169
167- if ( this . tilingTexture && this . tilingTexture . needsUpdate )
170+ if ( this . tilingTexture )
168171 {
169- renderSession . renderer . updateTexture ( this . tilingTexture . baseTexture ) ;
170- this . tilingTexture . needsUpdate = false ;
172+ if ( this . tilingTexture . needsUpdate )
173+ {
174+ renderSession . renderer . updateTexture ( this . tilingTexture . baseTexture ) ;
175+ this . tilingTexture . needsUpdate = false ;
176+ }
171177 }
172178 else
173179 {
174180 return ;
175181 }
176182 }
177- else
178- {
179- renderSession . spriteBatch . renderTilingSprite ( this ) ;
180- }
183+
184+ renderSession . spriteBatch . renderTilingSprite ( this ) ;
181185
182186 for ( var i = 0 ; i < this . children . length ; i ++ )
183187 {
@@ -348,8 +352,8 @@ PIXI.TilingSprite.prototype.generateTilingTexture = function(forcePowerOfTwo)
348352
349353 if ( forcePowerOfTwo )
350354 {
351- targetWidth = PIXI . getNextPowerOfTwo ( texture . crop . width ) ;
352- targetHeight = PIXI . getNextPowerOfTwo ( texture . crop . height ) ;
355+ targetWidth = PIXI . getNextPowerOfTwo ( targetWidth ) ;
356+ targetHeight = PIXI . getNextPowerOfTwo ( targetHeight ) ;
353357 }
354358
355359 if ( this . canvasBuffer )
@@ -365,11 +369,11 @@ PIXI.TilingSprite.prototype.generateTilingTexture = function(forcePowerOfTwo)
365369 this . tilingTexture = PIXI . Texture . fromCanvas ( this . canvasBuffer . canvas ) ;
366370 this . tilingTexture . isTiling = true ;
367371 this . tilingTexture . needsUpdate = true ;
368- // Phaser.Canvas.addToDOM(this.canvasBuffer.canvas, document.body, false);
369372 }
370373
371- // this.canvasBuffer.context.fillStyle = 'rgb(0,255,0)';
372- // this.canvasBuffer.context.fillRect(0, 0, targetWidth, targetHeight);
374+ // Debug
375+ this . canvasBuffer . context . strokeStyle = 'rgb(0,255,0)' ;
376+ this . canvasBuffer . context . strokeRect ( 0 , 0 , targetWidth , targetHeight ) ;
373377
374378 this . canvasBuffer . context . drawImage ( texture . baseTexture . source ,
375379 texture . crop . x ,
0 commit comments