From 05bc4ce787e6065b81b6e9b037ca092294c67202 Mon Sep 17 00:00:00 2001 From: wuzhiming Date: Fri, 20 Apr 2018 17:45:28 +0800 Subject: [PATCH] fix texture bug --- jsb/jsb-tex-sprite-frame.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/jsb/jsb-tex-sprite-frame.js b/jsb/jsb-tex-sprite-frame.js index 4ca18cb1c5..8a64472cbd 100644 --- a/jsb/jsb-tex-sprite-frame.js +++ b/jsb/jsb-tex-sprite-frame.js @@ -197,7 +197,6 @@ cc.Class._fastDefine('cc.SpriteFrame', cc.SpriteFrame, []); cc.SpriteFrame.$super = cc.Asset; prototype = cc.SpriteFrame.prototype; -prototype._setTexture = prototype.setTexture; cc.js.mixin(prototype, cc.EventTarget.prototype); @@ -213,6 +212,18 @@ prototype._ctor = function (filename, rect, rotated, offset, originalSize) { } }; +prototype._getTexture = prototype.getTexture; +prototype.getTexture = function () { + var tex = this._getTexture(); + this._texture = tex; + return tex; +}; +prototype.__setTexture = prototype.setTexture; +prototype._setTexture = function (tex) { + this.__setTexture(tex); + this._texture = tex; +}; + prototype.textureLoaded = function () { return this.getTexture() !== null; }; @@ -333,13 +344,6 @@ prototype._checkRect = function (texture) { } }; -prototype._getTexture = prototype.getTexture; -prototype.getTexture = function () { - var tex = this._getTexture(); - this._texture = tex; - return tex; -}; - prototype._clone = prototype.clone; prototype.clone = function () { var cloned = this._clone();