New clear Objective-C

I have come here to chew bubblegum and write code ... and I'm all out of bubblegum.

Friday, June 06, 2008

CoreGraphics line rendering performance bug

In general CoreGraphics is brutally fast, but I've been noticing some situations where it isn't which I narrowed down to non-uniform scaling of the CTM.

This program demonstrates how non-uniform scaling the CTM can adversely affect line rendering performance. It draws a grid of lines with scaling in X and Y adjustable by sliders and a rotate slider to get feedback on how fast it can render.

There's no voodoo here, the bottleneck is CGContextDrawPath(), drawing the grid scaled 0.5/0.6, or 0.2/0.5 on my MBP can take half a second, whereas if it is scaled 0.5/0.5 rendering is a couple orders of magnitude faster.

CTMScaleBug.zip

10.5.3

0 Comments:

Post a Comment

<< Home