Merge pull request #2576 from wuzhiming/fix_texture

fix getTexture bug
This commit is contained in:
Jare Guo
2018-04-20 17:55:08 +08:00
committed by GitHub
+12 -8
View File
@@ -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();