@@ -354,7 +354,6 @@ cc.TMXLayer = cc.SpriteBatchNode.extend(/** @lends cc.TMXLayer# */{
354
354
tile . anchorX = 0 ;
355
355
tile . anchorY = 0 ;
356
356
tile . opacity = this . _opacity ;
357
- tile . _renderCmd . _cachedParent = this . _renderCmd ;
358
357
359
358
var indexForZ = this . _atlasIndexForExistantZ ( z ) ;
360
359
this . addSpriteWithoutQuad ( tile , indexForZ , z ) ;
@@ -691,7 +690,7 @@ cc.TMXLayer = cc.SpriteBatchNode.extend(/** @lends cc.TMXLayer# */{
691
690
rect = cc . rectPixelsToPoints ( rect ) ;
692
691
693
692
var z = 0 | ( pos . x + pos . y * this . _layerSize . width ) ;
694
- var tile = this . _reusedTileWithRect ( rect ) ;
693
+ var tile = this . _renderCmd . _reusedTileWithRect ( rect ) ;
695
694
this . _setupTileSprite ( tile , pos , gid ) ;
696
695
697
696
// optimization:
@@ -712,7 +711,7 @@ cc.TMXLayer = cc.SpriteBatchNode.extend(/** @lends cc.TMXLayer# */{
712
711
rect = cc . rectPixelsToPoints ( rect ) ;
713
712
714
713
var z = 0 | ( pos . x + pos . y * this . _layerSize . width ) ;
715
- var tile = this . _reusedTileWithRect ( rect ) ;
714
+ var tile = this . _renderCmd . _reusedTileWithRect ( rect ) ;
716
715
this . _setupTileSprite ( tile , pos , gid ) ;
717
716
718
717
// get atlas index
@@ -746,7 +745,7 @@ cc.TMXLayer = cc.SpriteBatchNode.extend(/** @lends cc.TMXLayer# */{
746
745
rect . width / locScaleFactor , rect . height / locScaleFactor ) ;
747
746
var z = pos . x + pos . y * this . _layerSize . width ;
748
747
749
- var tile = this . _reusedTileWithRect ( rect ) ;
748
+ var tile = this . _renderCmd . _reusedTileWithRect ( rect ) ;
750
749
this . _setupTileSprite ( tile , pos , gid ) ;
751
750
752
751
// get atlas index
@@ -832,33 +831,6 @@ cc.TMXLayer = cc.SpriteBatchNode.extend(/** @lends cc.TMXLayer# */{
832
831
}
833
832
} ,
834
833
835
- _reusedTileWithRect :function ( rect ) {
836
- if ( cc . _renderType === cc . _RENDER_TYPE_WEBGL ) {
837
- if ( ! this . _reusedTile ) {
838
- this . _reusedTile = new cc . Sprite ( ) ;
839
- this . _reusedTile . initWithTexture ( this . texture , rect , false ) ;
840
- this . _reusedTile . batchNode = this ;
841
- } else {
842
- // XXX HACK: Needed because if "batch node" is nil,
843
- // then the Sprite'squad will be reset
844
- this . _reusedTile . batchNode = null ;
845
-
846
- // Re-init the sprite
847
- this . _reusedTile . setTextureRect ( rect , false ) ;
848
-
849
- // restore the batch node
850
- this . _reusedTile . batchNode = this ;
851
- }
852
- } else {
853
- this . _reusedTile = new cc . Sprite ( ) ;
854
- this . _reusedTile . initWithTexture ( this . _renderCmd . _texture , rect , false ) ;
855
- this . _reusedTile . batchNode = this ;
856
- this . _reusedTile . parent = this ;
857
- this . _reusedTile . _renderCmd . _cachedParent = this . _renderCmd ;
858
- }
859
- return this . _reusedTile ;
860
- } ,
861
-
862
834
_vertexZForPos :function ( pos ) {
863
835
var ret = 0 ;
864
836
var maxVal = 0 ;
0 commit comments