Re: Drawing from secondary thread erases resize corner in window? [solved, for now]
Re: Drawing from secondary thread erases resize corner in window? [solved, for now]
- Subject: Re: Drawing from secondary thread erases resize corner in window? [solved, for now]
- From: Hank Heijink <email@hidden>
- Date: Thu, 28 Feb 2008 12:45:54 -0500
I haven't found out what I need to do to avoid drawing over the resize
corner on a secondary thread. There's something that the system does
when it calls drawRect: as a result of a call to
setNeedsDisplayInRect: that I can't reproduce. I'm pretty sure it's
not a multithreading issue, but since I have no idea who draws the
resize corner and when that happens, I'm not sure where to start
looking.
However, Hamish pointed out a way I can use to get around it:
On Feb 28, 2008, at 11:45 AM, Hamish Allan wrote:
Assuming you're drawing on a secondary thread because it's
computationally expensive: have that thread draw to a cache e.g.
NSImage and call setNeedsDisplay:, then in your drawRect: (on the main
thread) just transfer the contents of the cache to your rect.
I'm not drawing on the secondary thread because it's expensive - the
drawing I need to do is very simple and fast. Your idea solved my
problem though: the only reason I'm trying to draw on another thread
is that my drawing is timer-driven, and the timer gets suspended if
it's on the main thread and the user clicks on a menu or a scrollbar
or some such thing.
By moving the timer to a secondary thread and calling my callback on
the main thread that problem is solved. Much simpler and more elegant.
Thanks all!
Hank
Hank Heijink
email@hidden
_______________________________________________
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