From b3a6a20a805366e0bc7044d1402d04c53f9c1660 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 14 Apr 2024 15:37:57 -0400 Subject: [PATCH] [smooth] Switch to vertical bisections. With horizontal bisections, the smallest section is a whole single scanline. Almost horizontal lines or other complex scanlines can easily overflow the rendering pool. Switching to vertical bisections splits the scanlines and should rule out the overflows. Fixes #1269. * src/smooth/ftgrays.c (gray_convert_glyph): Bisect vertically. --- src/smooth/ftgrays.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index 3345e7991..f011e9f8d 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -1892,18 +1892,17 @@ typedef ptrdiff_t FT_PtrDist; height = ( height + n - 1 ) / n; } - ras.min_ex = ras.cbox.xMin; - ras.max_ex = ras.cbox.xMax; - for ( y = ras.cbox.yMin; y < ras.cbox.yMax; ) { ras.min_ey = y; y += height; ras.max_ey = FT_MIN( y, ras.cbox.yMax ); + ras.count_ey = ras.max_ey - ras.min_ey; + band = bands; - band[1] = ras.min_ey; - band[0] = ras.max_ey; + band[1] = ras.cbox.xMin; + band[0] = ras.cbox.xMax; do { @@ -1911,10 +1910,8 @@ typedef ptrdiff_t FT_PtrDist; int error; - ras.min_ey = band[1]; - ras.max_ey = band[0]; - - ras.count_ey = ras.max_ey - ras.min_ey; + ras.min_ex = band[1]; + ras.max_ex = band[0]; /* memory management: zero out and skip ycells */ for ( i = 0; i < ras.count_ey; ++i )