Re: force entire window redraw?
Re: force entire window redraw?
- Subject: Re: force entire window redraw?
- From: Allan Odgaard <email@hidden>
- Date: Sun, 3 Oct 2004 11:18:34 +0200
On 28. Sep 2004, at 22:25, Michael Hanna wrote:
Hi, I'm performing a short dark "flash" on my NSWindow, but when I
restore the original cached image, it doesn't completely return to its
original state: [...]
[myWindow cacheImageInRect:theRect];
[...]
// add a slight delay
flashTimer = [NSTimer timerWithTimeInterval:1 target:self
selector:@selector(darkenDelay:) userInfo:nil repeats: NO];
[[NSRunLoop currentRunLoop] addTimer:theTimer
forMode:NSEventTrackingRunLoopMode];
[[NSRunLoop currentRunLoop] addTimer:theTimer
forMode:NSDefaultRunLoopMode];
[myWindow setViewsNeedDisplay:YES];
This I don't understand. You cache the image bitmap but use
setViewsNeedDisplay to restore, and *later* restore what you cached?
If you go the refresh-way you may try this instead:
[[myWindow contentView] setNeedsDisplay:YES];
From your image it seems that it skips the content view and only redraw
its children.
- (void)darkenDelay
{
[myWindow restoreCachedImage];
[myWindow flushWindow]; // draw undarkened image
}
I think flushWindow is "buggy" in that it won't flush if there hasn't
been any drawing done. At least doing lockFocus,
NSCopyBits()/scrollRect:by:, unlockFocus, flushWindow is a no-op.
Try just to draw a single pixel or something, and see if it changes the
outcome.
--
http://macromates.com/ ::: TextMate, OS X text editor
http://macromates.com/sigpipe/ ::: Personal weblog about
programming
_______________________________________________
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