If the clip path is larger than the target surface, cairo ends up creating a clip surface big enough to contain the clip trapezoids. When the pan&zoom apis are being used, this can cause very serious performance problems.
Created attachment 199086 [details] [diff] [review] bound clip surface to target surface
marking critical and adding hang keyword
I've reviewed this patch, and it seems an obviously correct performance fix. I've tested it with cairo's test suite as well as with a cairo-using svg2png on the W3C SVG suite, and in both cases found no differences in the output result. The patch can only affect performance in a positive way, and can do so dramatically, as you have noted. Will you please commit this (with an appropriate ChangeLog entry) to both cairo HEAD and cairo BRANCH_1_0. Thanks, -Carl
Comment on attachment 199086 [details] [diff] [review] bound clip surface to target surface Setting review flag based on comment 3 by Carl Worth (cairo author), as he doesn't have permission to change the flags. Checked into cairo cvs trunk and branch. Requesting 1.8rc1 approval as this is a denial of service problem that content developers can stumble into accidentally. Cartography is an example of a userbase whose document structures are prone to experience this. Patch has been reviewed by the author of cairo, and is merged upstream. Risk is very small.
Checked in on branch.