[cairo] Optimizing trap rasterization?
linuxhippy at gmail.com
Thu Feb 4 11:43:21 PST 2010
Especially for larger fills, trapezoid rasterization seems to be quite slow.
The edge rasterization code seems to have a few fast-paths implemented
(ADD_SATURATE_8) & MEMSET_WRAPPED
however a in a simple benchmark i wrote those are never triggered
(ADD_SATURATE a few times, but only with length 1 which is pointless).
I don't think I can modify rasterize_edge directly, it seems way too
complex and cryptic to me.
However cairo generates long horizontal traps, which could be
optimized quite well by seperating the "edge" part from the "fill"
part of the trapezoid.
Instead of ADD'ing byte-by-byte with manual overflow-detection, the
fill part could be done using MMX filling 64 bytes at once :)
However I've heard cairo will be moving away from trapezoids anyway,
so is there any point optimizing this at all?
This was the test-trapezoid used:
trap.top = 1 << 16;
trap.bottom = 50 << 16;
trap.left.p1.x = 10 << 16;
trap.left.p2.x = 20 << 16;
trap.right.p1.x = 500 << 16;
trap.right.p2.x = 510 << 16;
trap.left.p1.y = trap.top;
trap.left.p2.y = trap.bottom;
trap.right.p1.y = trap.top;
trap.right.p2.y = trap.bottom;
More information about the cairo