NSString drawAt: ...
NSString drawAt: ...
- Subject: NSString drawAt: ...
- From: Paul Fox <email@hidden>
- Date: Fri, 21 Jun 2002 20:37:12 +0000
I have a question regarding NSString and drawing. Drawing is slow -
unimaginably slow, and I have seen questions about this before.
But something strange is going on which I do not understand.
Specifically, everytime I call
[<NSString> drawAtPoint: ... withAttributes: ...]
my view tracking cursors get reset. This might not be so bad (another
post of mine talks about memory leaks in this area which got me into
investigating).
By judicious placement of breakpoints on the Cocoa NSView/NSWindow methods,
I note that drawing a string causes the addSubview and removeFromSuperview
methods to be called, thus triggering resetCursorRects.
Now this seems incredibly expensive, and I am wondering whether the
guts of string drawing creates a temporary NSView, draws inside it
and then discards it. If this is so - what form of caching can I do.
The details of this are that I implement my own flashing cursor. Every 0.5s
I draw my cursor, and then alternately redraw the text around the cursor
to hide it. This involves redrawing the characters
to the left and right of the cursor and on the line below. On any
other OS - its a cheap set of calls to make, but on my iBook it
is killing the cpu to do this. I know this may not be the preferred
Cocoa way of doing things (maybe cacheImageInRect would be), but
I am totally disgusted that one of the most important functions -
character drawing - is so seemingly expensive.
BTW I am on MacOSX 10.1.4.
thanks
+-------------------------------------------------------------------------+
| CRiSP - Flexible editor | CRiSP, syn. for BRIEF |#
| | Internet: email@hidden |#
| If you get no reply for | WWW: (mine)
http://www.crisp.demon.co.uk |#
| support, please check your | WWW:
http://www.crisp.com |#
| Reply-To: email address. | WWW:
http://www.pacemaker.co.uk |#
+-------------------------------------------------------------------------+#
###########################################################################
_______________________________________________
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.