From 8eef38f0ccd77b0ee3c8620b6be591de7c414e81 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Tue, 5 Jun 2012 02:23:21 -0700 Subject: [PATCH] Timeline: Fix graphics corruption. Also, indicate loop point by modifying waveform color. --- timeline/src/Audio_Region.C | 22 +++------------------- timeline/src/Sequence_Point.C | 13 ++++++++----- timeline/src/Sequence_Point.H | 7 +------ timeline/src/Waveform.C | 23 +++++++++-------------- 4 files changed, 21 insertions(+), 44 deletions(-) diff --git a/timeline/src/Audio_Region.C b/timeline/src/Audio_Region.C index c10b9a9..d66e1e7 100644 --- a/timeline/src/Audio_Region.C +++ b/timeline/src/Audio_Region.C @@ -565,6 +565,8 @@ Audio_Region::draw ( void ) int peaks; Peak *pbuf = NULL; +// Fl_Color c = _color; + do { nframes_t start = _r->offset; @@ -640,9 +642,6 @@ Audio_Region::draw ( void ) // DMESSAGE( "using cached peaks" ); } - Fl_Color c = _color; - - // c = fl_color_average( FL_BLACK, FL_RED, 0.20 ); if ( peaks && pbuf ) @@ -668,27 +667,12 @@ Audio_Region::draw ( void ) xo += loop_peaks_needed; + c = fl_color_average( FL_GRAY, _color, 0.70 ); } while ( _loop && xo < W ); timeline->draw_measure_lines( X, Y, W, H ); - if ( _loop && offset < _loop ) - { - const int x = timeline->ts_to_x( _loop - offset ); - - /* FIXME: is there no way to draw these symbols direclty? */ - - fl_push_matrix(); - - fl_translate( X + x + 2, y() + h() - 7 ); - fl_scale( - 8, 8 ); - - draw_full_arrow_symbol( FL_WHITE ); - - fl_pop_matrix(); - } - if ( _adjusting_gain ) { fl_color( fl_color_add_alpha( FL_DARK1, 127 ) ); diff --git a/timeline/src/Sequence_Point.C b/timeline/src/Sequence_Point.C index c8e52d7..0870ff8 100644 --- a/timeline/src/Sequence_Point.C +++ b/timeline/src/Sequence_Point.C @@ -109,21 +109,24 @@ Sequence_Point::draw_box ( void ) // Sequence_Widget::draw_box(); const int X = x() - (abs_w() >> 1); -// const int Y = y() + Fl::box_dy( box() ); +/* // const int Y = y() + Fl::box_dy( box() ); */ const int Y = y(); - fl_color( color() ); + /* fl_draw_box( FL_ASYM_BOX, x() - ( abs_w() / 2 ), y(), abs_w(), h(), color() ); */ + + /* fl_color( color() ); */ fl_push_matrix(); - fl_translate( X, Y + ( h() >> 3 ) ); - fl_scale( w(), h() - ( h() >> 3 ) ); + fl_translate( X, Y ); + fl_scale( abs_w(), h() ); draw_marker( color() ); fl_pop_matrix(); -// fl_line( X, Y, X, Y + h() - Fl::box_dh( box() ) ); + /* fl_color( FL_WHITE ); */ + /* fl_line( x(), y(), x(), y() + h() ); */ } void diff --git a/timeline/src/Sequence_Point.H b/timeline/src/Sequence_Point.H index bd3b628..f87a06e 100644 --- a/timeline/src/Sequence_Point.H +++ b/timeline/src/Sequence_Point.H @@ -60,12 +60,7 @@ public: virtual int x ( void ) const { - const int x = Sequence_Widget::x(); - - if ( x >= sequence()->x() + sequence()->w() ) - return sequence()->x() + sequence()->w() + abs_w(); - else - return x; + return line_x(); } nframes_t length ( void ) const { return timeline->x_to_ts( abs_w() ); } diff --git a/timeline/src/Waveform.C b/timeline/src/Waveform.C index 0b00122..92fc80b 100644 --- a/timeline/src/Waveform.C +++ b/timeline/src/Waveform.C @@ -66,6 +66,9 @@ Waveform::draw ( int X, int Y, int W, int H, const int ty = Y + halfheight; W = min( peaks, W ); + + if ( ! W ) + return; if ( Waveform::fill ) { @@ -93,29 +96,21 @@ Waveform::draw ( int X, int Y, int W, int H, } else { - -// fl_color( fl_color_add_alpha( color, 127 ) ); fl_color( color ); fl_begin_complex_polygon(); - + j = start; - + for ( int x = X; x < X + W; x++, j += skip ) fl_vertex( x, ty - ( halfheight * pbuf[ j ].min ) ); - -// fl_end_line(); - -// fl_begin_line(); - - j = start + ( W * skip ); - + + // j = start + ( W * skip ); + for ( int x = X + W; x >= X; x--, j -= skip ) fl_vertex( x, ty - ( halfheight * pbuf[ j ].max ) ); - + fl_end_complex_polygon(); - -// fl_line_style( FL_SOLID, 0 ); } }