[optm] 杂线减少

This commit is contained in:
2026-06-06 10:24:42 +08:00
Unverified
parent 15e8aedfd2
commit a9ba4457c6
+7 -4
View File
@@ -79,7 +79,11 @@ void ttf_outline_to_segments(const ttf_outline_t* outline,
}
}
}
if (pending >= 0) PUSH_QUAD(anchor, pending, start);
if (pending >= 0) {
PUSH_QUAD(anchor, pending, start);
} else if (anchor != start) {
PUSH_LINE(anchor, start);
}
#undef GET_X
#undef GET_Y
@@ -193,11 +197,10 @@ void ttf_rasterize(const ttf_seg_t* segs, SUINT32 num_segs,
while (j > 0 && xs[j-1] > v) { xs[j] = xs[j-1]; j--; }
xs[j] = v;
}
// Deduplicate: merge intersections within 1 pixel (64 in 26.6)
// Deduplicate: merge intersections within 1/16 pixel (4 in 26.6)
SUINT32 nxd = 0;
for (SUINT32 i = 0; i < nxs; i++) {
if (nxd > 0 && (xs[i] - xs[nxd - 1]) < 64) {
// Near-duplicate — skip to avoid spurious fill slivers
if (nxd > 0 && (xs[i] - xs[nxd - 1]) < 4) {
continue;
}
xs[nxd++] = xs[i];