wg_engine: fix vertices while line joining

Vertex ordering during line join needed adjustment.
Vertices were forming two partialy overlapping triangles
instead of a rectangle. The issue was rarely visible since
the resulting rectangle often overlapped significantly
with other rectangles.
This commit is contained in:
Mira Grudzinska 2024-09-17 23:00:13 +02:00 committed by Hermet Park
parent 915acd2ec3
commit 8acb135cb0

View file

@ -336,7 +336,7 @@ void WgGeometryData::appendStrokeJoin(const WgPoint& v0, const WgPoint& v1, cons
if (join == StrokeJoin::Round) {
appendCircle(v1, halfWidth);
} else if (join == StrokeJoin::Bevel) {
appendRect(v1 - offset0, v1 + offset0, v1 - offset1, v1 + offset1);
appendRect(v1 - offset0, v1 + offset1, v1 - offset1, v1 + offset0);
} else if (join == StrokeJoin::Miter) {
WgPoint nrm = (nrm0 + nrm1);
if (!tvg::zero(dir0.x * dir1.y - dir0.y * dir1.x)) {
@ -348,7 +348,7 @@ void WgGeometryData::appendStrokeJoin(const WgPoint& v0, const WgPoint& v1, cons
appendRect(v1 + nrm * (halfWidth / cosine), v1 + offset0, v1 + offset1, v1);
appendRect(v1 - nrm * (halfWidth / cosine), v1 - offset0, v1 - offset1, v1);
} else {
appendRect(v1 - offset0, v1 + offset0, v1 - offset1, v1 + offset1);
appendRect(v1 - offset0, v1 + offset1, v1 - offset1, v1 + offset0);
}
}
}