• 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
Re: Drawing strings at 20fps
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drawing strings at 20fps


  • Subject: Re: Drawing strings at 20fps
  • From: John Stiles <email@hidden>
  • Date: Thu, 22 Jul 2004 14:15:09 -0700

From personal experience, I've found that trying to draw text via
drawGlyphs is not very fast, but drawing text into an NSImage and then
drawing that NSImage on-screen is super-fast (it rasterizes the text
once and then essentially does CopyBits from then on). I had code that
needed to draw text several times a second; originally I tried saving
the glyphs into an NSBezierPath, but that was just terrible
performance-wise (literally an order of magnitude slower than QD or
Win32 text). The NSImage technique was a lifesaver. The downside was
that I needed a separate NSImage for each color of text (I was drawing
the same strings in varying colors) but no big deal; I looked at it in
MallocDebug and it wasn't using a huge amount of memory. The
performance boost was worth it.


On Jul 22, 2004, at 1:02 PM, Douglas Davidson wrote:

> On Jul 21, 2004, at 6:33 PM, Jules Bonin-Ducharme wrote:
>
> > I get a really slow result. Things are not updated smoothly
> > especially when
> > my app is full screen.
> >
> > How would I go about drawing what is essentially something that
> looks
> > like a
> > spreadsheet with changing values at 20fps?
>
> Generally speaking it is necessary to sample to find out what the
> bottleneck really is. You don't say how you are drawing the strings,
> and the results can vary greatly depending on the details of what is
> being drawn and how. However, here is one possibility that might
> improve matters: create a text storage/layout manager/text container
> combination containing the numbers from 0 to 127, once each, each on a
> separate line. Adapt the code in the CircleView or Worm examples to
> draw the appropriate range of glyphs to the appropriate location as
> needed. If that seems too complicated, you could just create 128
> different images and draw the numbers from 0 to 127 into them, then
> draw the images as needed into your view; however, the CircleView
> technique should have similar performance characteristics and use less
> memory.
>
> Douglas Davidson
> _______________________________________________
> 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.
_______________________________________________
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: Drawing strings at 20fps
      • From: Douglas Davidson <email@hidden>
References: 
 >Re: Drawing strings at 20fps (From: Douglas Davidson <email@hidden>)

  • Prev by Date: When did NSURLConnection start working with NSURLHandles?
  • Next by Date: UnArchiving Mutable Array problem...
  • Previous by thread: Re: Drawing strings at 20fps
  • Next by thread: Re: Drawing strings at 20fps
  • Index(es):
    • Date
    • Thread