[cairo] perf: long dashed lines

Koen Kooi koen at dominion.kabel.utwente.nl
Sun Feb 3 15:16:16 PST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vladimir Vukicevic schreef:
| On Feb 3, 2008, at 11:20 AM, Behdad Esfahbod wrote:

|> +    cairo_matrix_transform_distance (ctm_inverse, &dx0, &dy0);
|> +    mag = sqrt (dx0 * dx0 + dy0 * dy0);
|> +    if (mag < 1e-12) {
|> +       if (mag_out)
|> +           *mag_out = 0.0;
|> +       return FALSE;
|> +    }
|>
|> mag is in user space, you shouldn't make such size assumptions on
|> it.  I
|> suggest reworking it a bit such that we have the fixed values there
|> too,
|> then you can check fixed ints for zero.  Or just check dx0 and dy0
|> before the transformation.
|
| Well, should I just check for exact 0?  It seems that we should at
| least use an epsilon value that's smaller than the smallest number we
| can represent in fixed point.  But I'll go and replace the check with
| dx0 == 0.0 and dy0 == 0.0 before the sqrt.  I wasn't too worried about
| this sqrt since it's only called once per line segment, but you're
| right, if we can avoid it we should.  Can't do this whole calculation
| in fixed point though as there's a bunch of floating point math,
| mainly in _compute_face.  Not sure if it needs that full precision, or
| if we should go and convert this to fixed.  That can be done as a
| followup patch, though.

Speaking of (fast) sqrt implementations:
http://www.qoheleth.uklinux.net/blog/?p=139

regards,

Koen



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFHpks/MkyGM64RGpERArLjAKCqrbrrxwo+qy/Yo6vElPWDtQOYXQCePBB4
+9krJMGfsRaMMFraMyVLsag=
=XmKy
-----END PGP SIGNATURE-----



More information about the cairo mailing list