From 6c3f32669d317af7d6392f4d3c86c95315c093ce Mon Sep 17 00:00:00 2001 From: kenshin <420373550@qq.com> Date: Wed, 20 Jun 2018 15:53:21 +0800 Subject: [PATCH] Fix wechat game issues (#2869) Fix wechat game upload texture with data issue --- cocos2d/core/textures/CCTexture2D.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cocos2d/core/textures/CCTexture2D.js b/cocos2d/core/textures/CCTexture2D.js index 09b5db8416..c9022e59e1 100644 --- a/cocos2d/core/textures/CCTexture2D.js +++ b/cocos2d/core/textures/CCTexture2D.js @@ -803,10 +803,9 @@ game.once(game.EVENT_RENDERER_INITED, function () { _p._setImage = function (img, width, height, glFmt, premultiplyAlpha) { var gl = this._gl; gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, premultiplyAlpha); - if ( - (sys.platform === sys.WECHAT_GAME && !(img instanceof Uint8Array)) || - sys.platform === sys.QQ_PLAY || - img instanceof HTMLCanvasElement || + if ( + sys.platform === sys.QQ_PLAY || + (img instanceof HTMLCanvasElement && !(img instanceof Uint8Array)) || img instanceof HTMLImageElement || img instanceof HTMLVideoElement ) {