[smooth] Partly revert recent changes. * src/smooth/ftgrays.c (gray_conic_to, gray_cubic_to): Rework conditions to fix rendering issues.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
diff --git a/ChangeLog b/ChangeLog
index 4a2a83f..67a0150 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-03-21 Alexei Podtelezhnikov <apodtele@gmail.com>
+
+ [smooth] Partly revert recent changes.
+
+ * src/smooth/ftgrays.c (gray_conic_to, gray_cubic_to): Rework
+ conditions to fix rendering issues.
+
2016-03-20 Werner Lemberg <wl@gnu.org>
[autofit] Show `near' points in tracing.
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 4d3f664..6b4ea1f 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -715,10 +715,10 @@ typedef ptrdiff_t FT_PtrDist;
/* ok, we'll have to render a run of adjacent cells on the same */
/* scanline... */
/* */
- dx = x2 - x1;
p = ( ONE_PIXEL - fx1 ) * ( y2 - y1 );
first = ONE_PIXEL;
incr = 1;
+ dx = x2 - x1;
if ( dx < 0 )
{
@@ -1246,8 +1246,6 @@ typedef ptrdiff_t FT_PtrDist;
gray_PWorker worker )
{
FT_Vector* arc = ras.bez_stack;
- TPos min = SUBPIXELS( ras.min_ey );
- TPos max = SUBPIXELS( ras.max_ey );
arc[0].x = UPSCALE( to->x );
@@ -1257,16 +1255,16 @@ typedef ptrdiff_t FT_PtrDist;
arc[2].x = ras.x;
arc[2].y = ras.y;
- /* only render arc inside the current band */
- if ( ( min <= arc[0].y && arc[0].y < max ) ||
- ( min <= arc[1].y && arc[1].y < max ) ||
- ( min <= arc[2].y && arc[2].y < max ) )
- gray_render_conic( RAS_VAR );
+ /* short-cut the arc that crosses the current band */
+ if ( ( TRUNC( arc[0].y ) >= ras.max_ey &&
+ TRUNC( arc[1].y ) >= ras.max_ey &&
+ TRUNC( arc[2].y ) >= ras.max_ey ) ||
+ ( TRUNC( arc[0].y ) < ras.min_ey &&
+ TRUNC( arc[1].y ) < ras.min_ey &&
+ TRUNC( arc[2].y ) < ras.min_ey ) )
+ gray_render_line( RAS_VAR_ arc[0].x, arc[0].y );
else
- {
- ras.x = arc[0].x;
- ras.y = arc[0].y;
- }
+ gray_render_conic( RAS_VAR );
return 0;
}
@@ -1279,8 +1277,6 @@ typedef ptrdiff_t FT_PtrDist;
gray_PWorker worker )
{
FT_Vector* arc = ras.bez_stack;
- TPos min = SUBPIXELS( ras.min_ey );
- TPos max = SUBPIXELS( ras.max_ey );
arc[0].x = UPSCALE( to->x );
@@ -1292,17 +1288,18 @@ typedef ptrdiff_t FT_PtrDist;
arc[3].x = ras.x;
arc[3].y = ras.y;
- /* only render arc inside the current band */
- if ( ( min <= arc[0].y && arc[0].y < max ) ||
- ( min <= arc[1].y && arc[1].y < max ) ||
- ( min <= arc[2].y && arc[2].y < max ) ||
- ( min <= arc[3].y && arc[3].y < max ) )
- gray_render_cubic( RAS_VAR );
+ /* short-cut the arc that crosses the current band */
+ if ( ( TRUNC( arc[0].y ) >= ras.max_ey &&
+ TRUNC( arc[1].y ) >= ras.max_ey &&
+ TRUNC( arc[2].y ) >= ras.max_ey &&
+ TRUNC( arc[3].y ) >= ras.max_ey ) ||
+ ( TRUNC( arc[0].y ) < ras.min_ey &&
+ TRUNC( arc[1].y ) < ras.min_ey &&
+ TRUNC( arc[2].y ) < ras.min_ey &&
+ TRUNC( arc[3].y ) < ras.min_ey ) )
+ gray_render_line( RAS_VAR_ arc[0].x, arc[0].y );
else
- {
- ras.x = arc[0].x;
- ras.y = arc[0].y;
- }
+ gray_render_cubic( RAS_VAR );
return 0;
}