Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit 67e9f3c

Browse files
author
Yuncong Zhang
committed
Fix some issues.
1 parent 469afcc commit 67e9f3c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Runtime/ui/renderer/common/geometry/path/path_cache.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public uiMeshMesh strokeMesh {
3131
StrokeCap _lineCap;
3232
StrokeJoin _lineJoin;
3333
float _miterLimit;
34+
float _fringe;
3435

3536
public static uiPathCache create(float scale) {
3637
uiPathCache newPathCache = ObjectPool<uiPathCache>.alloc();
@@ -516,7 +517,9 @@ VertexUV _expandFill(float fringe) {
516517

517518
public uiMeshMesh computeStrokeMesh(float strokeWidth, float fringe, StrokeCap lineCap, StrokeJoin lineJoin, float miterLimit) {
518519
if (this._strokeMesh != null &&
520+
this._fillMesh == null && // Ensure that the cached stroke mesh was not calculated in computeFillMesh
519521
this._strokeWidth == strokeWidth &&
522+
this._fringe == fringe &&
520523
this._lineCap == lineCap &&
521524
this._lineJoin == lineJoin &&
522525
this._miterLimit == miterLimit) {
@@ -568,15 +571,18 @@ public uiMeshMesh computeStrokeMesh(float strokeWidth, float fringe, StrokeCap l
568571

569572
ObjectPool<uiMeshMesh>.release(this._strokeMesh);
570573
this._strokeMesh = uiMeshMesh.create(null, verticesUV.strokeVertices, indices, verticesUV.strokeUV);
574+
ObjectPool<uiMeshMesh>.release(this._fillMesh);
575+
this._fillMesh = null;
571576
this._strokeWidth = strokeWidth;
577+
this._fringe = fringe;
572578
this._lineCap = lineCap;
573579
this._lineJoin = lineJoin;
574580
this._miterLimit = miterLimit;
575581
return this._strokeMesh;
576582
}
577583

578584
public void computeFillMesh(float fringe, out bool convex) {
579-
if (this._fillMesh != null && (fringe != 0.0f || this._strokeMesh != null)) {
585+
if (this._fillMesh != null && (fringe != 0.0f || this._strokeMesh != null) && this._fringe == fringe) {
580586
convex = this._fillConvex;
581587
return;
582588
}
@@ -670,6 +676,7 @@ public void computeFillMesh(float fringe, out bool convex) {
670676

671677
var mesh = uiMeshMesh.create(null, verticesUV.fillVertices, indices, verticesUV.fillUV);
672678
this._fillMesh = mesh;
679+
this._fringe = fringe;
673680
}
674681
}
675682
}

0 commit comments

Comments
 (0)