From 7781dc57dcb1264318c2cf54efa5fa4cac775244 Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Tue, 22 Dec 2015 18:52:40 +0800 Subject: [PATCH] fix cc.SpriteFrame._frameWithTextureForCanvas --- cocos2d/core/sprites/CCSpriteFrame.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/cocos2d/core/sprites/CCSpriteFrame.js b/cocos2d/core/sprites/CCSpriteFrame.js index 7b16ca3f06..fabc7bd03b 100644 --- a/cocos2d/core/sprites/CCSpriteFrame.js +++ b/cocos2d/core/sprites/CCSpriteFrame.js @@ -73,7 +73,7 @@ cc.SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{ } } } - }, + } }, ctor: function () { @@ -448,12 +448,6 @@ cc.SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{ setTexture: function (textureOrTextureFile, rect, rotated, offset, originalSize) { - rect = rect || null; - offset = offset || null; - originalSize = originalSize || null; - rotated = rotated || false; - - if (rect) { this.setRectInPixels(rect); } else { @@ -472,7 +466,7 @@ cc.SpriteFrame = cc.Class(/** @lends cc.SpriteFrame# */{ this._originalSize = this._originalSizeInPixels = null; } - this._rotated = rotated; + this._rotated = rotated || false; //loading texture var texture = textureOrTextureFile; @@ -620,6 +614,6 @@ cc.SpriteFrame.create = function (filename, rect, rotated, offset, originalSize) */ cc.SpriteFrame.createWithTexture = cc.SpriteFrame.create; -cc.SpriteFrame._frameWithTextureForCanvas = function () { +cc.SpriteFrame._frameWithTextureForCanvas = function (texture, rect, rotated, offset, originalSize) { return new cc.SpriteFrame(texture, rect, rotated, offset, originalSize); };