Incrementally redraw as peaks become available.

This commit is contained in:
Jonathan Moore Liles 2008-04-29 19:38:28 -05:00
parent 95b7fab478
commit b307642224
2 changed files with 24 additions and 5 deletions

View File

@ -246,11 +246,11 @@ Region::handle ( int m )
{
case FL_ENTER:
Sequence_Widget::handle( m );
redraw();
// redraw();
break;
case FL_LEAVE:
Sequence_Widget::handle( m );
redraw();
// redraw();
break;
case FL_KEYBOARD:
{
@ -551,6 +551,15 @@ Region::draw_fade ( const Fade &fade, Fade::fade_dir_e dir, bool line, int X, in
fl_pop_matrix();
}
static void
damager ( void *v )
{
Rectangle *r = (Rectangle*)v;
timeline->damage( FL_DAMAGE_ALL, r->x, r->y, r->w, r->h );
delete r;
}
void
Region::draw_box( void )
@ -642,8 +651,9 @@ Region::draw ( void )
if ( _clip->read_peaks( timeline->fpp(),
start,
start + timeline->x_to_ts( W ),
&peaks, &pbuf, &channels ) )
min( _clip->length(), start + timeline->x_to_ts( W ) ),
&peaks, &pbuf, &channels ) &&
peaks )
{
assert( pbuf );
@ -686,6 +696,15 @@ Region::draw ( void )
}
}
/* FIXME: this is also sometimes true at the end of regions. */
if ( peaks < timeline->x_to_ts( W ) / timeline->fpp() )
{
/* couldn't read peaks--perhaps they're being generated. Try again later. */
Fl::add_timeout( 0.1f, damager, new Rectangle( X, y(), W, h() ) );
}
/* FIXME: only draw as many as are necessary! */
timeline->draw_measure_lines( rx, Y, rw, H, _box_color );

View File

@ -507,7 +507,7 @@ Timeline::draw ( void )
/* return; */
/* } */
if ( damage() & FL_DAMAGE_ALL || damage() & FL_DAMAGE_EXPOSE )
if ( ( damage() & FL_DAMAGE_ALL ) || ( damage() & FL_DAMAGE_EXPOSE ) )
{
printf( "complete redraw\n" );