[LayaAirIDE 2.0]oppo CanvasRenderingContext2D 并没有实现 drawImage;报错;

 
引擎版本:2.0.1
 
可以用什么代替呢?
引擎代码:
	/**
*通过图片源填充纹理,可为HTMLImageElement、HTMLCanvasElement、HTMLVideoElement、ImageBitmap、ImageData,
*设置之后纹理宽高可能会发生变化。
*/
__proto.loadImageSource=function(source,premultiplyAlpha){
(premultiplyAlpha===void 0)&& (premultiplyAlpha=false);
var width=source.width;
var height=source.height;
this._width=width;
this._height=height;
this._setWarpMode(/*laya.webgl.WebGLContext.TEXTURE_WRAP_S*/0x2802,this._wrapModeU);
this._setWarpMode(/*laya.webgl.WebGLContext.TEXTURE_WRAP_T*/0x2803,this._wrapModeV);
this._setFilterMode(this._filterMode);
var gl=LayaGL.instance;
WebGLContext.bindTexture(gl,this._glTextureType,this._glTexture);
var glFormat=this._getGLFormat();
if (Render.isConchApp){
source.setPremultiplyAlpha(premultiplyAlpha);
gl.texImage2D(this._glTextureType,0,/*laya.webgl.WebGLContext.RGBA*/0x1908,/*laya.webgl.WebGLContext.RGBA*/0x1908,/*laya.webgl.WebGLContext.UNSIGNED_BYTE*/0x1401,source);
}else {
(premultiplyAlpha)&& (gl.pixelStorei(/*laya.webgl.WebGLContext.UNPACK_PREMULTIPLY_ALPHA_WEBGL*/0x9241,true));
gl.texImage2D(this._glTextureType,0,glFormat,glFormat,/*laya.webgl.WebGLContext.UNSIGNED_BYTE*/0x1401,source);
(premultiplyAlpha)&& (gl.pixelStorei(/*laya.webgl.WebGLContext.UNPACK_PREMULTIPLY_ALPHA_WEBGL*/0x9241,false));
}
if (this._mipmap && this._isPot(width)&& this._isPot(height)){
gl.generateMipmap(this._glTextureType);
this._setGPUMemory(width *height *4 *(1+1 / 3));
}else {
this._setGPUMemory(width *height *4);
}
if (this._canRead){
if (Render.isConchApp){
this._pixels=new Uint8Array(source._nativeObj.getImageData(0,0,width,height));
}else {
Browser.canvas.size(width,height);
Browser.canvas.clear();
Browser.context.drawImage(source,0,0,width,height);
this._pixels=new Uint8Array(Browser.context.getImageData(0,0,width,height).data.buffer);
}
}
this._readyed=true;
this._activeResource();
}

 
参考文档   https://cdofs.oppomobile.com/cdo-activity/static/201810/26/quickgame/documentation/render/canvas.html
 
 
ps:2.1.1.1  一样报错
已邀请:

181*****858

赞同来自:

求问2.0.1 引擎能打包oppo嘛。。各种报错

要回复问题请先

商务合作
商务合作