• 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
Optimizing drawing by caching
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Optimizing drawing by caching


  • Subject: Optimizing drawing by caching
  • From: Drew McCormack <email@hidden>
  • Date: Sun, 29 Sep 2002 17:18:49 +0200

I have some drawing which is expensive to perform, but only needs to be performed occasionally. If I use it in a scrollview as is, resizing and scrolling performance is worse than it was under Mac OS X public beta ;-) In other words, it isn't good enough.

Since what is drawn changes infrequently, I thought I should cache the drawing in an NSImage or something like that. Rather than draw to screen, I would draw to the image, and then draw the image on the screen whenever needed. I thought the best place to do the caching would be the "display" method: this could rebuild the image if necessary, and then call the super's display, which in turn would call "drawRect:" where the image would actually be drawn on the screen.

Is this approach a good idea, or am I missing something? Are there any pitfalls? Does anyone know any sample code for this? Can anyone give me any idea what NSImage or NSBitmapImageRep classes I should use for this purpose?

One more thing: All my drawn makes use of Quartz, so a postscript format may be my best bet. Could I/Should I use a PDF image rep for this caching, or a bitmap image rep?

Drew

... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
Dr. Drew McCormack
Trade Strategist (www.trade-strategist.com)
Trading simulation software for Mac OS X
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • Re: Optimizing drawing by caching
      • From: Marco Binder <email@hidden>
    • Re: Optimizing drawing by caching
      • From: Shawn Erickson <email@hidden>
  • Prev by Date: Re: How come bundle is just compiling as a folder?
  • Next by Date: Re: DateFormatter in a table?
  • Previous by thread: Re: How come bundle is just compiling as a folder?
  • Next by thread: Re: Optimizing drawing by caching
  • Index(es):
    • Date
    • Thread