@@ -979,7 +979,7 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
979979 this . _newTextureWhenChangeColor = false ;
980980 this . _textureLoaded = true ;
981981 this . _loadedEventListeners = [ ] ;
982- this . _textureRect_Canvas = { x : 0 , y : 0 , width : 0 , height :0 } ;
982+ this . _textureRect_Canvas = { x : 0 , y : 0 , width : 0 , height :0 , validRect : false } ;
983983 this . _drawSize_Canvas = cc . size ( 0 , 0 ) ;
984984
985985 if ( fileName ) {
@@ -1394,13 +1394,13 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
13941394
13951395 this . setContentSize ( untrimmedSize ) ;
13961396 this . setVertexRect ( rect ) ;
1397- //this._textureRect_Canvas = cc.RECT_POINTS_TO_PIXELS(rect); //this._setTextureCoords(rect);
1398- var locTextureRect = this . _textureRect_Canvas ;
1399- var scaleFactor = cc . CONTENT_SCALE_FACTOR ( ) ;
1397+
1398+ var locTextureRect = this . _textureRect_Canvas , scaleFactor = cc . CONTENT_SCALE_FACTOR ( ) ;
14001399 locTextureRect . x = 0 | ( rect . x * scaleFactor ) ;
14011400 locTextureRect . y = 0 | ( rect . y * scaleFactor ) ;
14021401 locTextureRect . width = 0 | ( rect . width * scaleFactor ) ;
14031402 locTextureRect . height = 0 | ( rect . height * scaleFactor ) ;
1403+ locTextureRect . validRect = ! ( locTextureRect . width === 0 || locTextureRect . height === 0 ) ;
14041404
14051405 var relativeOffset = this . _unflippedOffsetPositionFromCenter ;
14061406 if ( this . _flippedX )
@@ -1891,7 +1891,7 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
18911891
18921892 _changeTextureColor : function ( ) {
18931893 var locElement , locTexture = this . _texture , locRect = this . _textureRect_Canvas ; //this.getTextureRect();
1894- if ( locTexture && locRect . width > 0 && this . _originalTexture ) {
1894+ if ( locTexture && locRect . validRect && this . _originalTexture ) {
18951895 locElement = locTexture . getHtmlElementObj ( ) ;
18961896 if ( ! locElement )
18971897 return ;
@@ -2099,7 +2099,7 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
20992099 flipXOffset *= locEGL_ScaleX ;
21002100 flipYOffset *= locEGL_ScaleY ;
21012101
2102- if ( this . _texture && locTextureCoord . width > 0 ) {
2102+ if ( this . _texture && locTextureCoord . validRect ) {
21032103 var image = this . _texture . getHtmlElementObj ( ) ;
21042104 if ( this . _colorized ) {
21052105 context . drawImage ( image ,
0 commit comments