Drawing performance in CALayer
Drawing performance in CALayer
- Subject: Drawing performance in CALayer
- From: Graham Cox <email@hidden>
- Date: Fri, 29 Jul 2011 16:23:03 +1000
In my iTunes visualizer, I'm using layers to draw many, many small rectangles (to represent segments of a spectrum analyser display). There can be up to 32 bands x 40 segments x 2 channels = 2,560 segments, all redrawn 30 times per second or more.
One layer is used for one bar, which is 40 rectangles. In my override of -drawInContext: I draw these using NSRectFill() in a loop.
Am I right in thinking that using calls such as NSRectFill within a CALayer like this is really making OpenGL calls behind the scenes? If so it's probably going as fast as it can. On my middling iMac it's acceptably fast, but laptops start to show a bit of a slow-down.
I can think of ways to optimise this, but first I want to know whether this is truly the fastest way to draw a simple solid rectangle in this situation. If not, what's better?
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden