Le 28 avr. 2010 à 20:29, Bill Appleton a écrit : > this appears to only work from inside the drawRect routine, if i get here > from some other event it doesn't work > > so is it "legal" to draw on an NSWindow from some other event? > if not, what the heck does QDEndCGContext do that makes it work?
If I remember correctly what David Duncan said here a while ago, graphics rendering in Core graphics, and maybe also in Cocoa, is heavily dependent on the Run loop. Normally, when you want to recache and redraw a layer, you set needsDisplay to YES (or just call - setNeedsDisplay: on a CALayer), and -drawRect or -drawInContext: gets called when the current event finishes and the Run loop regains control. I am not sure it is legal to draw outside this window. That's why if you want to redraw in background under the control of a "display" thread, that thread must set up a run loop of its own, or nothing gets drawn at all. Vincent_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com