From e59bf5e742edce3d2b7d1d8b88ac30d141da00a8 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Thu, 21 Jul 2016 10:39:34 +0800 Subject: [PATCH] Fix texture pixelWidth & pixelHeight property issue in JSB --- jsb/jsb-tex-sprite-frame.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/jsb/jsb-tex-sprite-frame.js b/jsb/jsb-tex-sprite-frame.js index e12017b99a..0da03497f3 100644 --- a/jsb/jsb-tex-sprite-frame.js +++ b/jsb/jsb-tex-sprite-frame.js @@ -51,18 +51,22 @@ cc.textureCache.getTextureForKey = function (key) { cc.Class._fastDefine('cc.Texture2D', cc.Texture2D, []); cc.Texture2D.$super = cc.RawAsset; -cc.Texture2D.prototype.isLoaded = function () { +var prototype = cc.Texture2D.prototype; + +prototype.isLoaded = function () { return true; }; -cc.Texture2D.prototype.getPixelWidth = cc.Texture2D.prototype.getPixelsWide; -cc.Texture2D.prototype.getPixelHeight = cc.Texture2D.prototype.getPixelsHigh; +prototype.getPixelWidth = prototype.getPixelsWide; +prototype.getPixelHeight = prototype.getPixelsHigh; +cc.js.get(prototype, 'pixelWidth', prototype.getPixelWidth); +cc.js.get(prototype, 'pixelHeight', prototype.getPixelHeight); // cc.SpriteFrame cc.Class._fastDefine('cc.SpriteFrame', cc.SpriteFrame, []); cc.SpriteFrame.$super = cc.Asset; -var prototype = cc.SpriteFrame.prototype; +prototype = cc.SpriteFrame.prototype; cc.js.mixin(prototype, cc.EventTarget.prototype); prototype.textureLoaded = function () {