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

Commit 9edbe3d

Browse files
author
Yuncong Zhang
committed
Shrink the fill path.
1 parent 8d67f12 commit 9edbe3d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ VertexUV _expandStroke(float w, float fringe, StrokeCap lineCap, StrokeJoin line
401401

402402
VertexUV _expandFill(float fringe) {
403403
float aa = fringe;
404+
float woff = aa * 0.5f;
404405
var points = this._points;
405406
var paths = this._paths;
406407
this._calculateJoins(fringe, StrokeJoin.miter, 4.0f);
@@ -449,7 +450,13 @@ VertexUV _expandFill(float fringe) {
449450
path.ifill = _vertices.Count;
450451
for (var j = 0; j < path.count; j++) {
451452
var p = points[path.first + j];
452-
_vertices.Add(new Vector2(p.x, p.y));
453+
if (aa > 0.0f) {
454+
_vertices.Add(new Vector2(p.x + p.dmx * woff, p.y + p.dmy * woff));
455+
}
456+
else {
457+
_vertices.Add(new Vector2(p.x, p.y));
458+
}
459+
453460
_uv.Add(new Vector2(0.5f, 1.0f));
454461
}
455462

@@ -474,7 +481,6 @@ VertexUV _expandFill(float fringe) {
474481
_strokeVertices.SetCapacity(cvertices);
475482
_strokeUV.SetCapacity(cvertices);
476483

477-
float woff = aa * 0.5f;
478484
float lw = this._fillConvex ? woff : aa + woff;
479485
float rw = aa - woff;
480486
float lu = this._fillConvex ? 0.5f : 0.0f;

0 commit comments

Comments
 (0)