freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft-devel] [patch] on the subject of better splines


From: Алексей Подтележников
Subject: [ft-devel] [patch] on the subject of better splines
Date: Fri, 1 Oct 2010 22:57:32 -0400

Hello,

While you guys are on the subject of better splines. I propose to fix
grey_render_conic too. I think that interpreting the control point as a
corner is a simplistic overestimation. A little algebra gives the
exact boundary position.

Nothing breaks at the firsts glance in my testing. Whether this speeds
things up,
I do not know how to measure. Lastly. the equation below assumes that conic
really means quadratic, in agreement with the logic of grey_split_conic.

Comments?
Alexi



--- a/src/smooth/ftgrays.c      2010-07-12 15:09:25.000000000 -0400
+++ b/src/smooth/ftgrays.c      2010-10-01 21:58:05.182637518 -0400
@@ -936,16 +936,18 @@
         TPos  min, max, y;


+        /* set the boundaries based on the endpoints */
         min = max = arc[0].y;

-        y = arc[1].y;
-        if ( y < min ) min = y;
-        if ( y > max ) max = y;
-
         y = arc[2].y;
         if ( y < min ) min = y;
         if ( y > max ) max = y;

+        /* amend the boundaries based on the control point */
+        y = arc[1].y;
+        if ( y < min ) min = (min * max - y * y) / (min + max - 2 * y);
+        if ( y > max ) max = (min * max - y * y) / (min + max - 2 * y);
+
         if ( TRUNC( min ) >= ras.max_ey || TRUNC( max ) < ras.min_ey )
           goto Draw;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]