[cairo] [PATCH] Some rounding fixes
psychon at znc.in
Fri Nov 5 11:33:45 PDT 2010
-----BEGIN PGP SIGNED MESSAGE-----
Attached are the non-xcb-specific patches I got laying around. The first patch
should be obvious. It just fixes a wrong comment.
The second one changes the default implementation of _cairo_lround. This change
makes the implementation match the expected and documented behavior.
This is necessary because the rounding mode if _cairo_lround changed over time.
Since the dawn of time, _cairo_lround was using away-from-zero rounding, just
like lround. This was changed in 2006 by commit ce58f874fe253 to fix bug #214819
. Ever since then, _cairo_lround was supposed to use arithmetic rounding to
fix this exact bug. However, January commit c000824 turned _cairo_lround into a
#define to lround for performance reasons (unless DISABLE_SOME_FLOATING_POINT
was enabled). This effectively reverted the commit from 2006.
My second patch now makes _cairo_lround use _cairo_round unless
DISABLE_SOME_FLOATING_POINT is defined which means it uses floor (r + 0.5) to do
its job. I hope the above makes clear why this should be correct and it fixes a
text position error in the Xlib backend here.
Chris Wilson already looked at this patch once and had a problem with a compiler
warning (_cairo_round returns a double while _cairo_lround returns an int). I
changed something and then Andrea Canciani got a compiler warning. I didn't have
any compiler warnings with this at all, so if the compiler warns about a cast,
please provide the whole compiler warning.
The third patch is a simpler one again. The dash-state test needs a surface with
a width of 1500. This means that for xlib-window and xcb-window, the screen has
to be at least 1500 pixel wide. The Xvfb call from the README is updated to be
large enough for this test.
Let's see how much stuff I broke and if I can get some of these patches through. :)
Q: Because it reverses the logical flow of conversation.
A: Why is putting a reply at the top of the message frowned upon?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
-----END PGP SIGNATURE-----
More information about the cairo