freetype-devel
[Top][All Lists]
Advanced

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

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


From: Graham Asher
Subject: Re: [ft-devel] [patch] on the subject of better splines
Date: Sun, 03 Oct 2010 12:21:15 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4

 Alexi,

I think it's a good idea if you can benchmark the code to see if the extra arithmetic results in any speed improvement. I suspect it might slow things down slightly for ordinary glyphs which always fit in a single band, but there's a chance it might help at high resolutions where more than one band is needed.

Also, at first glance your code looks as if it might be subject to integer overflow or division by zero.

The patch that's just been checked in result from work by David Bevan and myself does in fact make some improvements to gray_render_conic, though it doesn't address the point you are making.

Best regards,

Graham

On 02/10/2010 03:57, Алексей Подтележников wrote:
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;

_______________________________________________
Freetype-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/freetype-devel





reply via email to

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