Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CGContextSetLineWidth / performance issues



Is there an optimization route for rendering lines >1.0f ?


The first thing that comes to mind is CGContextStrokeLineSegments. This is a Tiger only routine that strokes lines very, very quickly.

If you can't be Tiger only, you should consider using  CGContextAddLines instead of explicitly using moveto-lineto-lineto....

If your path is very complex and intersects itself a lot then turning off antialiasing may help (it's not clear what it's state is in your sample code).

If you ask for a wider stroke, then the computer has to calculate the joints between each segment.  If having the joins perfect is not as important, you might try using bevel joins instead of miter or round joins.  I don't know that bevel joins are faster to calculate and render, but it might be worth a shot.

What do these lines represent?  Is it strictly necessary to draw 800 of them?  If you're trying to draw 800 lines in a window that's only 300 pixels wide... you may be wasting a lot of time drawing things that the user will never see.

Above all visit:

<http://developer.apple.com/samplecode/QuartzLines/QuartzLines.html>

Scott
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartz-dev/email@hidden

This email sent to email@hidden

References: 
 >CGContextSetLineWidth / performance issues (From: nick briggs <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.