• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Getting the best frame rate for NSView drawing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting the best frame rate for NSView drawing


  • Subject: Getting the best frame rate for NSView drawing
  • From: Kenneth Baxter <email@hidden>
  • Date: Wed, 28 Mar 2012 07:36:21 +0000 (GMT)

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 (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


  • Follow-Ups:
    • Re: Getting the best frame rate for NSView drawing
      • From: Uli Kusterer <email@hidden>
    • Re: Getting the best frame rate for NSView drawing
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: How to throttle rate of NSInputStream?
  • Next by Date: Re: Example implementation of NSAnimatablePropertyContainer?
  • Previous by thread: Re: Is there a list solely for ObjC/compiler language issues?
  • Next by thread: Re: Getting the best frame rate for NSView drawing
  • Index(es):
    • Date
    • Thread