I am trying out some different ideas for animating portions of a view, but am 
having problems with performance. 

Essentially I have an animation running using a CABasicAnimation, and when it 
calls back to my view, it invalidates the rect where the object was drawn, and 
the new place where it is going to be drawn. Then in my drawRect code, I ask 
each of my objects that overlap the dirty rect to redraw itself.

For testing purposes, I have a view that is 5,000 x 5,000 and have 100 of my 
objects which are placed randomly and size 200 x 400.

For each object, I save the graphics state, transform my coordinates, clip to 
the bounds of the object, draw it, and then restore the graphics state.

At the moment, on my test machine (which is admittedly not the latest and 
greatest, but it probably representative of our typical customer), I have tried 
the following scenarios:

Draw each object individually (admittedly it's just a simple oval in rect which 
is filled and stroked): 12fps
Generate an NSImage of the object once and cache it, then just drawInRect...: 
8fps
Cache a CIImage and draw that: 8fps
Cache a CGLayer and draw that: 8fps

This sure does seem to be awfully slow. Instruments tell that the time is all 
being spent in drawing the object, no matter how I do the drawing.

Is there some better way to get decent drawing performance from drawing into an 
NSView?

Thanks

Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to