Re: Fastest way to push strings to the screen in an NSView?
Re: Fastest way to push strings to the screen in an NSView?
- Subject: Re: Fastest way to push strings to the screen in an NSView?
- From: Douglas Davidson <email@hidden>
- Date: Wed, 17 Nov 2004 18:39:09 -0800
On Nov 17, 2004, at 6:24 PM, Robbie Haertel wrote:
The drawAtPoint: and drawInRect: methods are designed for drawing
small amounts of text or text that must be drawn rarely. They create
and dispose of various supporting text objects every time you call
them. To draw strings repeatedly, it is more efficient to use
NSLayoutManager, as described in "Drawing Strings".
This isn't necessarily always the case; the drawAtPoint: and
drawInRect: methods have been optimized for certain common cases, and
continue to be further optimized with each new release. However, they
can be called with arbitrary attributed strings--anything from "Hello,
world" to a novel--and they certainly cannot be optimized for all
cases; in the general case the use of an NSLayoutManager to retain
layout information is definitely faster when the same string is drawn
more than once. I would recommend moving to the use of a layout
manager only if testing shows that the string drawing methods are a
bottleneck.
Douglas Davidson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden