[cairo] Tessellator performance patch

M Joonas Pihlaja jpihlaja at cc.helsinki.fi
Sun Dec 3 20:13:26 PST 2006


Hi Rafael,

On Mon, 4 Dec 2006, Rafael Villar Burke wrote:

> Subject: [PATCH] Additional fast path tests to avoid intersection computation
[snip]
> + cairo_bo_point32_t a = edge1->top;
> + cairo_bo_point32_t b = edge1->bottom;
> + cairo_bo_point32_t c = edge2->top;
> + cairo_bo_point32_t d = edge2->bottom;
> +
> + int crossp_abc = (b.x - a.x)*(c.y - a.y) - (c.x - a.x)*(b.y - a.y);
> + int crossp_abd = (b.x - a.x)*(d.y - a.y) - (d.x - a.x)*(b.y - a.y);
> + int crossp_cda = (d.x - c.x)*(a.y - c.y) - (a.x - c.x)*(d.y - c.y);
> + int crossp_cdb = (d.x - c.x)*(b.y - c.y) - (b.x - c.x)*(d.y - c.y);

These multiplications are liable to overflow 32 bits and throw 
off the later sign checks.  Could you replace them with a 64 bit 
version and rerun your tests?

Cheers,

Joonas


More information about the cairo mailing list