Try to avoid excessive drawing.

This commit is contained in:
Jonathan Moore Liles 2008-04-30 01:40:33 -05:00
parent 323a913cf1
commit 0af8d7e124
1 changed files with 5 additions and 3 deletions

View File

@ -556,6 +556,7 @@ damager ( void *v )
{ {
Rectangle *r = (Rectangle*)v; Rectangle *r = (Rectangle*)v;
printf( "damaging from timeout\n" );
timeline->damage( FL_DAMAGE_ALL, r->x, r->y, r->w, r->h ); timeline->damage( FL_DAMAGE_ALL, r->x, r->y, r->w, r->h );
delete r; delete r;
@ -653,9 +654,11 @@ Region::draw ( void )
if ( X - rx > 0 ) if ( X - rx > 0 )
start += timeline->x_to_ts( X - rx ); start += timeline->x_to_ts( X - rx );
const int peaks_needed = min( timeline->ts_to_x( _clip->length() - start ), W );
if ( _clip->read_peaks( timeline->fpp(), if ( _clip->read_peaks( timeline->fpp(),
start, start,
min( _clip->length(), start + timeline->x_to_ts( W ) ), start + timeline->x_to_ts( peaks_needed ),
&peaks, &pbuf, &channels ) && &peaks, &pbuf, &channels ) &&
peaks ) peaks )
{ {
@ -700,8 +703,7 @@ Region::draw ( void )
} }
} }
/* FIXME: this is also sometimes true at the end of regions. */ if ( peaks < peaks_needed )
if ( peaks < timeline->x_to_ts( W ) / timeline->fpp() )
{ {
/* couldn't read peaks--perhaps they're being generated. Try again later. */ /* couldn't read peaks--perhaps they're being generated. Try again later. */