Speed up cursor validity decision

This commit is contained in:
Keith Winstein
2012-02-02 02:54:55 -05:00
parent 248830c9d5
commit b10a94df83
+6 -5
View File
@@ -31,6 +31,7 @@ void ConditionalOverlayCell::apply( Framebuffer &fb, uint64_t confirmed_epoch, i
if ( unknown ) { if ( unknown ) {
// fb.get_mutable_cell( row, col )->contents.clear(); // fb.get_mutable_cell( row, col )->contents.clear();
fb.get_mutable_cell( row, col )->renditions.underlined = true;
return; return;
} }
@@ -114,23 +115,23 @@ Validity ConditionalCursorMove::get_validity( const Framebuffer &fb, uint64_t cu
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 ( now < expiration_time ) { if ( now < expiration_time ) {
return Pending; return Pending;
} }
if ( (fb.ds.get_cursor_col() == col)
&& (fb.ds.get_cursor_row() == row) ) {
return Correct;
} else {
/* /*
fprintf( stderr, "Bad cursor in %d (I thought (%d,%d) vs actual (%d,%d)).\n", (int)current_frame, fprintf( stderr, "Bad cursor in %d (I thought (%d,%d) vs actual (%d,%d)).\n", (int)current_frame,
row, col, fb.ds.get_cursor_row(), fb.ds.get_cursor_col() ); row, col, fb.ds.get_cursor_row(), fb.ds.get_cursor_col() );
*/ */
return IncorrectOrExpired; return IncorrectOrExpired;
} }
}
void ConditionalCursorMove::apply( Framebuffer &fb, uint64_t confirmed_epoch ) const void ConditionalCursorMove::apply( Framebuffer &fb, uint64_t confirmed_epoch ) const
{ {