fix bugs for new renderer (#2574)

* gulp task: add clean cache & support native renderer

* fix binding codes of Texture2D.updateSubImage

* fix some issues

* fix Texture2D.updateSubImage()
This commit is contained in:
minggo
2018-04-20 14:43:58 +08:00
committed by pandamicro
parent 02110c664a
commit 92241e4ca9
2 changed files with 25 additions and 1 deletions
+3
View File
@@ -588,6 +588,9 @@ function initSys () {
DELAY_CREATE_CTX: false,
format: ['.mp3']
};
// Adaptation
wx.getOpenDataContext = function () {return {canvas: null};}
}
else if (CC_WECHATGAME) {
var env = wx.getSystemInfoSync();
+22 -1
View File
@@ -94,7 +94,28 @@ _p.destroy = function() {
};
_p.update = function(options) {
convertImages(options.images);
this.updateBinding(options);
this.updateNative(options);
};
_p.updateSubImage = function(option) {
var images = [option.image];
convertImages(images);
var data = new Uint16Array(8 +
(images[0].length + 1) / 2);
data[0] = option.x;
data[1] = option.y;
data[2] = option.width;
data[3] = option.height;
data[4] = option.level;
data[5] = option.flipY;
data[6] = false;
data[7] = images[0].length;
var imageData = new Uint8Array(data.buffer);
imageData.set(images[0], 16);
this.updateSubImageNative(data);
};
cc.defineGetterSetter(_p, "_width", _p.getWidth);
cc.defineGetterSetter(_p, "_height", _p.getHeight);