mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
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:
@@ -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
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user