Mixer/DPM: Fix bug where peaks are sometimes not drawn.

This commit is contained in:
Jonathan Moore Liles 2020-12-13 19:43:15 -08:00
parent 9f3181b9c7
commit f2aeb8a1f8
1 changed files with 14 additions and 11 deletions

View File

@ -186,7 +186,6 @@ DPM::draw ( void )
draw_box( box(), X, Y, W, H, color() ); draw_box( box(), X, Y, W, H, color() );
} }
fl_push_clip( X, Y, W, H );
const int active = active_r(); const int active = active_r();
@ -195,12 +194,16 @@ DPM::draw ( void )
/* only draw as many segments as necessary */ /* only draw as many segments as necessary */
if ( damage() == FL_DAMAGE_USER1 ) if ( damage() == FL_DAMAGE_USER1 )
{ {
if ( v > _last_drawn_hi_segment ) if ( v == _last_drawn_hi_segment )
{
return;
}
else if ( v > _last_drawn_hi_segment )
{ {
hi = v; hi = v;
lo = _last_drawn_hi_segment; lo = _last_drawn_hi_segment;
} }
else else if ( v < _last_drawn_hi_segment )
{ {
hi = _last_drawn_hi_segment; hi = _last_drawn_hi_segment;
lo = v; lo = v;
@ -213,20 +216,20 @@ DPM::draw ( void )
} }
_last_drawn_hi_segment = v; _last_drawn_hi_segment = v;
for ( int p = lo; p <= hi; p++ ) fl_push_clip( X, Y, W, H );
for ( int p = lo; p <= hi + 1; ++p )
{ {
Fl_Color c; Fl_Color c;
if ( p <= v ) if ( p <= v || p == pv )
{ {
if ( p == clipv ) if ( p == clipv )
c = fl_color_average( FL_YELLOW, div_color( p ), 0.40 ); c = fl_color_average( FL_YELLOW, div_color( p ), 0.40 );
else else
c = div_color( p ); c = div_color( p );
} }
else if ( p == pv )
c = div_color( p );
else else
c = fl_darker( FL_BACKGROUND_COLOR );//FL_DARK1; // fl_color_average( FL_BACKGROUND_COLOR, FL_BLACK, 0.50f );// FL_BACKGROUND_COLOR; //dim_div_color( p ); c = fl_darker( FL_BACKGROUND_COLOR );//FL_DARK1; // fl_color_average( FL_BACKGROUND_COLOR, FL_BLACK, 0.50f );// FL_BACKGROUND_COLOR; //dim_div_color( p );
@ -256,8 +259,8 @@ DPM::update ( void )
{ {
/* do falloff */ /* do falloff */
float f = value() - 0.33f; float f = value() - 0.33f;
if ( f < -70.0f ) if ( f < -80.0f )
f = -78.0f; f = -80.0f;
value(f); value(f);
} }