|
|
|
|
|
|
this.___drawTextDrawMeshCallback = this._drawTextDrawMeshCallback; |
|
|
|
this.___drawPathDrawMeshCallback2 = this._drawPathDrawMeshCallback2; |
|
|
|
this.___drawPathDrawMeshCallback = this._drawPathDrawMeshCallback; |
|
|
|
|
|
|
|
this.setupComputeBuffer(); |
|
|
|
} |
|
|
|
|
|
|
|
readonly _drawPathDrawMeshCallbackDelegate ___drawTextDrawMeshCallback; |
|
|
|
|
|
|
this._saveLayer_Points[2], |
|
|
|
this._saveLayer_Points[3], |
|
|
|
bounds); |
|
|
|
var renderDraw = CanvasShader.texRT(layer, layer.layerPaint.Value, mesh, parentLayer, this.supportComputeBuffer); |
|
|
|
var renderDraw = CanvasShader.texRT(layer, layer.layerPaint.Value, mesh, parentLayer, supportComputeBuffer); |
|
|
|
layer.draws.Add(CanvasShader.texRT(layer, paint, blurMesh, blurLayer, this.supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.texRT(layer, paint, blurMesh, blurLayer, supportComputeBuffer)); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (paint.backdrop is _MatrixImageFilter) { |
|
|
|
|
|
|
this._saveLayer_Points[2], |
|
|
|
this._saveLayer_Points[3], |
|
|
|
bounds); |
|
|
|
var renderDraw = CanvasShader.texRT(layer, layer.layerPaint.Value, mesh, parentLayer, this.supportComputeBuffer); |
|
|
|
var renderDraw = CanvasShader.texRT(layer, layer.layerPaint.Value, mesh, parentLayer, supportComputeBuffer); |
|
|
|
layer.draws.Add(renderDraw); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
var renderDraw = CanvasShader.texRT(currentLayer, layer.layerPaint.Value, mesh, layer, this.supportComputeBuffer); |
|
|
|
var renderDraw = CanvasShader.texRT(currentLayer, layer.layerPaint.Value, mesh, layer, supportComputeBuffer); |
|
|
|
currentLayer.draws.Add(renderDraw); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
// need to inflate a bit to make sure all area is cleared.
|
|
|
|
var inflatedScissor = uiRectHelper.inflate(reducedClip.scissor.Value, this._fringeWidth); |
|
|
|
var boundsMesh = uiMeshMesh.create(inflatedScissor); |
|
|
|
layer.draws.Add(CanvasShader.stencilClear(layer, boundsMesh, this.supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.stencilClear(layer, boundsMesh, supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.stencil0(layer, maskElement.mesh.duplicate(), this.supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.stencil1(layer, boundsMesh.duplicate(), this.supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.stencil0(layer, maskElement.mesh.duplicate(), supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.stencil1(layer, boundsMesh.duplicate(), supportComputeBuffer)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
blurXLayer.draws.Add(CanvasShader.maskFilter( |
|
|
|
blurXLayer, blurMesh, maskLayer, |
|
|
|
radiusX, new Vector2(1f / textureWidth, 0), kernelX, this.supportComputeBuffer)); |
|
|
|
radiusX, new Vector2(1f / textureWidth, 0), kernelX, supportComputeBuffer)); |
|
|
|
radiusY, new Vector2(0, -1f / textureHeight), kernelY, this.supportComputeBuffer)); |
|
|
|
radiusY, new Vector2(0, -1f / textureHeight), kernelY, supportComputeBuffer)); |
|
|
|
|
|
|
|
return blurYLayer; |
|
|
|
} |
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
layer.draws.Add(CanvasShader.texRT(layer, paint, blurMesh, blurLayer, this.supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.texRT(layer, paint, blurMesh, blurLayer, supportComputeBuffer)); |
|
|
|
} |
|
|
|
|
|
|
|
delegate void _drawPathDrawMeshCallbackDelegate(uiPaint p, uiMeshMesh fillMesh, uiMeshMesh strokeMesh, |
|
|
|
|
|
|
|
|
|
|
var layer = this._currentLayer; |
|
|
|
if (convex) { |
|
|
|
layer.draws.Add(CanvasShader.convexFill(layer, p, fillMesh, this.supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.convexFill(layer, p, fillMesh, supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.fill0(layer, fillMesh, this.supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.fill1(layer, p, fillMesh.boundsMesh, this.supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.fill0(layer, fillMesh, supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.fill1(layer, p, fillMesh.boundsMesh, supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.strokeAlpha(layer, p, alpha, strokeMult, strokeMesh, this.supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.stroke1(layer, strokeMesh.duplicate(), this.supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.strokeAlpha(layer, p, alpha, strokeMult, strokeMesh, supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.stroke1(layer, strokeMesh.duplicate(), supportComputeBuffer)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var layer = this._currentLayer; |
|
|
|
|
|
|
|
layer.draws.Add(CanvasShader.strokeAlpha(layer, p, alpha, strokeMult, strokeMesh, this.supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.stroke1(layer, strokeMesh.duplicate(), this.supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.strokeAlpha(layer, p, alpha, strokeMult, strokeMesh, supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.stroke1(layer, strokeMesh.duplicate(), supportComputeBuffer)); |
|
|
|
} |
|
|
|
|
|
|
|
void _drawTextDrawMeshCallback(uiPaint p, uiMeshMesh fillMesh, uiMeshMesh strokeMesh, bool convex, float alpha, |
|
|
|
|
|
|
|
|
|
|
var layer = this._currentLayer; |
|
|
|
if (notEmoji) { |
|
|
|
layer.draws.Add(CanvasShader.texAlpha(layer, p, textMesh, tex, this.supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.texAlpha(layer, p, textMesh, tex, supportComputeBuffer)); |
|
|
|
} |
|
|
|
else { |
|
|
|
uiPaint paintWithWhite = new uiPaint(p); |
|
|
|
|
|
|
var raw_mesh = textMesh.resolveMesh(); |
|
|
|
var meshmesh = raw_mesh.duplicate(); |
|
|
|
ObjectPool<TextBlobMesh>.release(textMesh); |
|
|
|
layer.draws.Add(CanvasShader.tex(layer, paintWithWhite, meshmesh, EmojiUtils.image, this.supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.tex(layer, paintWithWhite, meshmesh, EmojiUtils.image, supportComputeBuffer)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
layer.draws.Add(CanvasShader.tex(layer, paint, mesh, image, this.supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.tex(layer, paint, mesh, image, supportComputeBuffer)); |
|
|
|
} |
|
|
|
|
|
|
|
void _drawImageNine(Image image, uiRect? src, uiRect center, uiRect dst, uiPaint paint) { |
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
layer.draws.Add(CanvasShader.tex(layer, paint, mesh, image, this.supportComputeBuffer)); |
|
|
|
layer.draws.Add(CanvasShader.tex(layer, paint, mesh, image, supportComputeBuffer)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
D.assert(mesh.vertices.Count > 0); |
|
|
|
if (this.supportComputeBuffer) { |
|
|
|
if (supportComputeBuffer) { |
|
|
|
cmd.properties.SetBuffer(CmdDraw.vertexBufferId, this.computeBuffer); |
|
|
|
cmd.properties.SetBuffer(CmdDraw.indexBufferId, this.indexBuffer); |
|
|
|
cmd.properties.SetInt(CmdDraw.startIndexId, this.startIndex); |
|
|
|
cmd.properties.SetBuffer(CmdDraw.vertexBufferId, computeBuffer); |
|
|
|
cmd.properties.SetBuffer(CmdDraw.indexBufferId, indexBuffer); |
|
|
|
cmd.properties.SetInt(CmdDraw.startIndexId, startIndex); |
|
|
|
cmdBuf.DrawProcedural(Matrix4x4.identity, cmd.material, cmd.pass, MeshTopology.Triangles, mesh.triangles.Count, 1, cmd.properties.mpb); |
|
|
|
} |
|
|
|
else { |
|
|
|