diff --git a/Runtime/ui/renderer/common/geometry/path/path.cs b/Runtime/ui/renderer/common/geometry/path/path.cs index 37dc421c..19141c9b 100644 --- a/Runtime/ui/renderer/common/geometry/path/path.cs +++ b/Runtime/ui/renderer/common/geometry/path/path.cs @@ -102,7 +102,7 @@ internal uiPathCache flatten(float scale) { return this._cache; } - var _cache = uiPathCache.create(scale); + var _cache = uiPathCache.create(scale, this._shapeHint); var i = 0; while (i < this._commands.Count) { diff --git a/Runtime/ui/renderer/common/geometry/path/path_cache.cs b/Runtime/ui/renderer/common/geometry/path/path_cache.cs index 656d32b4..1cfd08f1 100644 --- a/Runtime/ui/renderer/common/geometry/path/path_cache.cs +++ b/Runtime/ui/renderer/common/geometry/path/path_cache.cs @@ -33,11 +33,14 @@ public uiMeshMesh strokeMesh { float _miterLimit; float _fringe; - public static uiPathCache create(float scale) { + uiPath.uiPathShapeHint _shapeHint; + + public static uiPathCache create(float scale, uiPath.uiPathShapeHint shapeHint) { uiPathCache newPathCache = ObjectPool.alloc(); newPathCache._distTol = 0.01f / scale; newPathCache._tessTol = 0.25f / scale; newPathCache._scale = scale; + newPathCache._shapeHint = shapeHint; return newPathCache; } @@ -49,6 +52,10 @@ public bool canReuse(float scale) { return true; } + public bool canSkipAAHairline { + get { return this._shapeHint == uiPath.uiPathShapeHint.Rect; } + } + public override void clear() { this._paths.Clear(); this._points.Clear(); @@ -57,6 +64,8 @@ public override void clear() { ObjectPool.release(this._strokeMesh); this._strokeMesh = null; + + this._shapeHint = uiPath.uiPathShapeHint.Other; } public uiPathCache() { @@ -460,7 +469,7 @@ uiVertexUV _expandFill(float fringe) { uiList _strokeVertices = null; uiList _strokeUV = null; - if (aa > 0.0f) { + if (aa > 0.0f && !this.canSkipAAHairline) { _strokeVertices = ObjectPool>.alloc(); _strokeUV = ObjectPool>.alloc(); cvertices = 0;