[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] raster_2023 6d6607b8b 2/2: [raster] Modify the split conditi
From: |
Werner Lemberg |
Subject: |
[freetype2] raster_2023 6d6607b8b 2/2: [raster] Modify the split condition. |
Date: |
Thu, 2 Nov 2023 23:10:09 -0400 (EDT) |
branch: raster_2023
commit 6d6607b8b3a78a305cc92d6016c411344c8c7b89
Author: Alexei Podtelezhnikov (Алексей Подтележников) <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>
[raster] Modify the split condition.
While curving close to a pixel center, vertical and horizontal pass
might split the curve differently and cause a rare dropout. This
makes the split condition invariant of the sweep direction and more
robust.
* src/raster/ftraster.c (Bezier_Up): Modify the split condition.
---
src/raster/ftraster.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index a77b57fd1..1182ff4b8 100644
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -1124,7 +1124,8 @@
Long miny,
Long maxy )
{
- Long y1, y2, e, e2, e0;
+ Long y1, y2, e, e2, e0, dy;
+ Long dx, x2;
TPoint* start_arc;
@@ -1189,19 +1190,25 @@
ras.joint = FALSE;
y2 = arc[0].y;
+ x2 = arc[0].x;
if ( y2 > e )
{
- y1 = arc[degree].y;
- if ( y2 - y1 >= ras.precision_step )
+ dy = y2 - arc[degree].y;
+ dx = x2 - arc[degree].x;
+
+
+ /* split condition should be invariant of direction */
+ if ( dy > ras.precision_step ||
+ dx > ras.precision_step ||
+ -dx > ras.precision_step )
{
splitter( arc );
arc += degree;
}
else
{
- *top++ = arc[degree].x + FMulDiv( arc[0].x - arc[degree].x,
- e - y1, y2 - y1 );
+ *top++ = x2 - FMulDiv( y2 - e, dx, dy );
arc -= degree;
e += ras.precision;
}
@@ -1211,7 +1218,7 @@
if ( y2 == e )
{
ras.joint = TRUE;
- *top++ = arc[0].x;
+ *top++ = x2;
e += ras.precision;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] raster_2023 6d6607b8b 2/2: [raster] Modify the split condition.,
Werner Lemberg <=