Eliminate early adjudication to get rid of different flicker

This commit is contained in:
Keith Winstein
2012-02-03 23:45:53 -05:00
parent 3d2676ace0
commit bed4e859c1
+20 -21
View File
@@ -36,18 +36,17 @@ void ConditionalOverlayCell::apply( Framebuffer &fb, uint64_t confirmed_epoch, i
return; return;
} }
/*
fprintf( stderr, "APPLYING char %lc to (%d, %d)\n",
replacement.debug_contents(), row, col );
*/
if ( !(*(fb.get_cell( row, col )) == replacement) ) { if ( !(*(fb.get_cell( row, col )) == replacement) ) {
if ( replacement.is_blank() && fb.get_cell( row, col )->is_blank() ) {
return;
}
*(fb.get_mutable_cell( row, col )) = replacement; *(fb.get_mutable_cell( row, col )) = replacement;
uint64_t now = timestamp(); uint64_t now = timestamp();
if ( display_time >= now ) { if ( display_time >= now ) {
display_time = now; display_time = now;
} }
if ( flag && (!replacement.is_blank()) ) { if ( flag ) {
fb.get_mutable_cell( row, col )->renditions.underlined = true; fb.get_mutable_cell( row, col )->renditions.underlined = true;
} }
} }
@@ -66,6 +65,10 @@ Validity ConditionalOverlayCell::get_validity( const Framebuffer &fb, int row,
return IncorrectOrExpired; return IncorrectOrExpired;
} }
if ( unknown ) {
return CorrectNoCredit;
}
const Cell &current = *( fb.get_cell( row, col ) ); const Cell &current = *( fb.get_cell( row, col ) );
/* see if it hasn't been updated yet */ /* see if it hasn't been updated yet */
@@ -73,15 +76,15 @@ Validity ConditionalOverlayCell::get_validity( const Framebuffer &fb, int row,
return Pending; return Pending;
} }
assert( expiration_time != uint64_t(-1) );
if ( (late_ack >= expiration_frame)
|| ( (sent_frame <= early_ack) && (expiration_time <= now) ) ) {
/* special case deletion */ /* special case deletion */
if ( current.is_blank() && replacement.is_blank() ) { if ( current.is_blank() && replacement.is_blank() ) {
return CorrectNoCredit; return CorrectNoCredit;
} }
if ( unknown ) {
return CorrectNoCredit;
}
if ( current.contents == replacement.contents ) { if ( current.contents == replacement.contents ) {
auto it = find_if( original_contents.begin(), original_contents.end(), auto it = find_if( original_contents.begin(), original_contents.end(),
[&]( const Cell &x ) { return replacement.contents == x.contents; } ); [&]( const Cell &x ) { return replacement.contents == x.contents; } );
@@ -90,14 +93,10 @@ Validity ConditionalOverlayCell::get_validity( const Framebuffer &fb, int row,
} else { } else {
return CorrectNoCredit; return CorrectNoCredit;
} }
} } else {
assert( expiration_time != uint64_t(-1) );
if ( (late_ack >= expiration_frame)
|| ( (sent_frame <= early_ack) && (expiration_time <= now) ) ) {
return IncorrectOrExpired; return IncorrectOrExpired;
} }
}
return Pending; return Pending;
} }
@@ -119,17 +118,17 @@ Validity ConditionalCursorMove::get_validity( const Framebuffer &fb, uint64_t se
return Pending; return Pending;
} }
if ( (fb.ds.get_cursor_col() == col)
&& (fb.ds.get_cursor_row() == row) ) {
return Correct;
}
assert( expiration_time != uint64_t(-1) ); assert( expiration_time != uint64_t(-1) );
if ( (late_ack >= expiration_frame) if ( (late_ack >= expiration_frame)
|| ( (sent_frame <= early_ack) && (expiration_time <= now) ) ) { || ( (sent_frame <= early_ack) && (expiration_time <= now) ) ) {
if ( (fb.ds.get_cursor_col() == col)
&& (fb.ds.get_cursor_row() == row) ) {
return Correct;
} else {
return IncorrectOrExpired; return IncorrectOrExpired;
} }
}
return Pending; return Pending;
} }