File tree Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -1309,8 +1309,12 @@ if (cc._renderType === cc._RENDER_TYPE_CANVAS) {
13091309
13101310 if ( texture ) {
13111311 var _x = rect . x + rect . width , _y = rect . y + rect . height ;
1312- cc . assert ( _x <= texture . width , cc . _LogInfos . RectWidth , texture . url ) ;
1313- cc . assert ( _y <= texture . height , cc . _LogInfos . RectHeight , texture . url ) ;
1312+ if ( _x > texture . width ) {
1313+ cc . error ( cc . _LogInfos . RectWidth , texture . url ) ;
1314+ }
1315+ if ( _y > texture . height ) {
1316+ cc . error ( cc . _LogInfos . RectHeight , texture . url ) ;
1317+ }
13141318 }
13151319 _t . _originalTexture = texture ;
13161320 _t . texture = texture ;
Original file line number Diff line number Diff line change @@ -364,8 +364,12 @@ cc.SpriteFrame = cc.Class.extend(/** @lends cc.SpriteFrame# */{
364364 _x = rect . x + rect . width ;
365365 _y = rect . y + rect . height ;
366366 }
367- cc . assert ( _x <= texture . width , cc . _LogInfos . RectWidth , texture . url ) ;
368- cc . assert ( _y <= texture . height , cc . _LogInfos . RectHeight , texture . url ) ;
367+ if ( _x > texture . width ) {
368+ cc . error ( cc . _LogInfos . RectWidth , texture . url ) ;
369+ }
370+ if ( _y > texture . height ) {
371+ cc . error ( cc . _LogInfos . RectHeight , texture . url ) ;
372+ }
369373 }
370374
371375 this . _rectInPixels = rect ;
Original file line number Diff line number Diff line change @@ -184,8 +184,12 @@ cc._tmp.WebGLSprite = function () {
184184 _x = rect . x + rect . width ;
185185 _y = rect . y + rect . height ;
186186 }
187- cc . assert ( _x <= texture . width , cc . _LogInfos . RectWidth , texture . url ) ;
188- cc . assert ( _y <= texture . height , cc . _LogInfos . RectHeight , texture . url ) ;
187+ if ( _x > texture . width ) {
188+ cc . error ( cc . _LogInfos . RectWidth , texture . url ) ;
189+ }
190+ if ( _y > texture . height ) {
191+ cc . error ( cc . _LogInfos . RectHeight , texture . url ) ;
192+ }
189193 }
190194
191195 _t . texture = texture ;
You can’t perform that action at this time.
0 commit comments