Timeline: Tweak fade drawing.

This commit is contained in:
Jonathan Moore Liles 2012-06-04 17:25:21 -07:00
parent 3cca1e48a5
commit 72a0c0eb3e
1 changed files with 20 additions and 21 deletions

View File

@ -400,43 +400,42 @@ Audio_Region::draw_fade ( const Fade &fade, Fade::fade_dir_e dir, bool line, int
return;
}
fl_push_matrix();
fl_translate( fx, dy );
if ( dir == Fade::In )
fl_scale( width, height );
else
fl_scale( -width, height );
if ( line )
fl_begin_line();
else
fl_begin_polygon();
fl_vertex( 0.0, 0.0 );
fl_vertex( 0.0, 1.0 );
fl_vertex( fx, dy );
fl_vertex( fx, dy + height );
// if ( draw_real_fade_curve )
{
nframes_t tsx = timeline->x_to_ts( 1 );
if ( dir == Fade::In )
{
nframes_t ts = 0;
for ( int i = 0; i < width; ++i, ts += tsx )
fl_vertex( i / (double)width, 1.0f - fade.gain( ts / (double)fade.length ) );
fl_vertex( fx + i, dy + height - ( height * fade.gain( ts / (double)fade.length ) ));
}
else
{
nframes_t ts = tsx * width;
for ( int i = 0; i < width; ++i, ts -= tsx )
fl_vertex( fx - i, dy + ( height * fade.gain( ts / (double)fade.length ) ));
}
}
fl_vertex( 1.0, 0.0 );
if ( dir == Fade::In )
fl_vertex( fx + width, dy );
else
fl_vertex( fx - width, dy );
if ( line )
fl_end_line();
else
fl_end_polygon();
fl_pop_matrix();
}
void