Re: Progress bar jitters
Re: Progress bar jitters
- Subject: Re: Progress bar jitters
- From: John Stiles <email@hidden>
- Date: Thu, 24 Aug 2006 13:58:45 -0700
The World of Warcraft installer does this too, if you look closely. :(
I think it has to do with updating the bar in very small increments.
Perhaps if you increment the bar less than a pixel's worth, bad
things happen.
I'll post my Radar, but don't let that stop you from posting one of
your own. I really would like to see this fixed in Leopard.
rdar://4199129 NSProgressIndicators "jitter" when updated
frequently 29-Jul-2005 06:35 PM Other Bug Duplicate
29-Jul-2005 06:35 PM John Stiles:
The World of Warcraft Installer uses an NSProgressIndicator to show
the progress during installation. If you watch it closely, it seems
to occasionally jitter backwards as if I were sending it numbers that
weren't monotonically increasing (although my code is only sending it
increasing values). Also, if you look at it closely--zooming in with
cmd-opt-plus helps--you can sometimes see that the rightmost pixels
of the bar occasionally have a strange white look, as if there were
some sort of rendering glitch.
The code that updates the progress bar is paranoid about never going
backwards:
- (void) progressSheetUpdateBar:(NSNumber*)amount
{
double newValue = static_cast<double>( [amount floatValue] );
double oldValue = [_progressSheetBar doubleValue];
if( newValue > oldValue )
[_progressSheetBar setDoubleValue:newValue];
}
(The higher-level code that drives the progress bar input values will
also never go backwards; this code was just there to be 100% sure.)
This "progress bar drifting backwards" effect was also somewhat
visible in 10.3 but I think it has gotten more pronounced in 10.4.
I also have internal Blizzard apps which demonstrate the bug, but the
WoW installer should be sufficient to reproduce it.
'System Profile.txt' was successfully uploaded
31-Aug-2005 12:33 PM Stoney Gamble:
Hi John, this is a known issue and is being tracked in our system
under bug#4052858. Once this is addressed, I'll notify you of the
resolution.
On Aug 24, 2006, at 1:39 PM, Trygve Inda wrote:
In the Apple sample code, QTKitProgressTester, why does the
progress bar
jitter... That is it goes up some, then jumps back?
The code in question is in a QTKit callback:
- (BOOL)movie:(QTMovie *)movie shouldContinueOperation:(NSString *)op
withPhase:(QTMovieOperationPhase)phase atPercent:(NSNumber *)percent
withAttributes:(NSDictionary *)attributes
{
BOOL shouldContinue = YES;
NSEvent* event;
double percentDoneDouble = (double)[percent doubleValue]
* 100.0;
double currentPercent;
switch (phase)
{
case QTMovieOperationBeginPhase:
// set up the progress panel
[progressMsg setStringValue:op];
[progressBar setDoubleValue:0];
break;
case QTMovieOperationUpdatePercentPhase:
// update the percent done
currentPercent = [progressBar doubleValue];
if (percentDoneDouble > currentPercent + 0.5)
{
[progressBar setDoubleValue:percentDoneDouble];
[progressBar display];
}
break;
case QTMovieOperationEndPhase:
[NSApp endSheet:progressSheet returnCode:NSOKButton];
[progressSheet close];
break;
}
// cancel (if requested)
event = [progressSheet nextEventMatchingMask:NSLeftMouseUpMask
untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode
dequeue:YES];
if (event && NSPointInRect([event locationInWindow], [progressCancel
frame]))
{
[progressCancel performClick:self];
shouldContinue = NO;
}
return (shouldContinue);
}
I added the currentPercent + 0.5 part to only update if the change is
significant and it helped a bit, but is still jumpy. I am guessing
it has to
do with the value setting being a double? Is it better to make it
an int and
normalize it to 0-1000 for example?
Thanks,
Trygve
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40blizzard.com
This email sent to email@hidden
_______________________________________________
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