[0]设置cacheAs = bitmap时, drawCanvas 的一个bug
drawCanvas(canvas: HTMLCanvas, x: number, y: number, width: number, height: number): void {
if (!canvas) return;
var src: Context = canvas.context as Context;
var submit: ISubmit;
if (src._targets) {
//生成渲染结果到src._targets上
/*
this._submits[this._submits._length++] = SubmitCanvas.create(src, 0, null);
_curSubmit = SubmitBase.RENDERBASE;
//画出src._targets
//drawTexture(src._targets.target.getTexture(), x, y, width, height, 0, 0);
*/
//应用并清空canvas中的指令。如果内容需要重画,RenderSprite会给他重新加入submit
if (src._submits._length > 0) {
submit = SubmitCMD.create([src, src._targets], this._flushToTarget, this);
this._submits[this._submits._length++] = submit;
}
//在这之前就已经渲染出结果了。
this._drawRenderTexture(src._targets, x, y, width, height, null, 1.0, RenderTexture2D.flipyuv);
this._curSubmit = SubmitBase.RENDERBASE;
这里当该bitmap节点下面的所有子节点隐藏时,为src._submits._length 等于0。 _targets并没有清空,而是用了上一次的绘制结果。这样会导致最后一个节点隐藏失败
if (!canvas) return;
var src: Context = canvas.context as Context;
var submit: ISubmit;
if (src._targets) {
//生成渲染结果到src._targets上
/*
this._submits[this._submits._length++] = SubmitCanvas.create(src, 0, null);
_curSubmit = SubmitBase.RENDERBASE;
//画出src._targets
//drawTexture(src._targets.target.getTexture(), x, y, width, height, 0, 0);
*/
//应用并清空canvas中的指令。如果内容需要重画,RenderSprite会给他重新加入submit
if (src._submits._length > 0) {
submit = SubmitCMD.create([src, src._targets], this._flushToTarget, this);
this._submits[this._submits._length++] = submit;
}
//在这之前就已经渲染出结果了。
this._drawRenderTexture(src._targets, x, y, width, height, null, 1.0, RenderTexture2D.flipyuv);
this._curSubmit = SubmitBase.RENDERBASE;
这里当该bitmap节点下面的所有子节点隐藏时,为src._submits._length 等于0。 _targets并没有清空,而是用了上一次的绘制结果。这样会导致最后一个节点隐藏失败
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
Laya_z
赞同来自: