Skip to content

Commit 27f653c

Browse files
committed
Closed #3048: refactoring codes for performance
1 parent f7f72e3 commit 27f653c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

cocos2d/cocoa/CCGeometry.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,16 +236,17 @@ cc.RectMake = function (x, y, width, height) {
236236

237237
// backward compatible
238238
cc.rect = function (x, y, w, h) {
239-
if(arguments.length === 0)
239+
var argLen =arguments.length;
240+
if(argLen === 0)
240241
return new cc.Rect(0,0,0,0);
241242

242-
if(arguments.length === 1)
243+
if(argLen === 1)
243244
return new cc.Rect(x.x, x.y, x.width, x.height);
244245

245-
if(arguments.length === 2)
246+
if(argLen === 2)
246247
return new cc.Rect(x.x, x.y, y.width, y.height);
247248

248-
if(arguments.length === 4)
249+
if(argLen === 4)
249250
return new cc.Rect(x,y,w,h);
250251

251252
throw "unknown argument type";

0 commit comments

Comments
 (0)