commit 9a39f4ae22b8c523dfd0245d6e7f272756d148f0
parent 995e0f7df6b59611a4407d51b30e94dbac5aa1be
Author: Christopher A. Oliver <caowasteland@gmail.com>
Date: Mon, 19 Oct 2015 10:35:47 -0400
This hack attempts to remove artifacts stray pixels in small o'scopes.
I suspect a better tiny scope algorithm would make it unnecessary, or
maybe we've uncovered a bug in line drawing at a lower level.
Diffstat:
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/UI/Fl_Oscilloscope.h b/src/UI/Fl_Oscilloscope.h
@@ -21,6 +21,7 @@ class Fl_Oscilloscope : public Fl_Box, public Fl_Osc_Widget
{
phase=64;
box(FL_FLAT_BOX);
+ bkgnd = fl_color_average( FL_BLACK, FL_BACKGROUND_COLOR, 0.5 );
}
~Fl_Oscilloscope(void)
@@ -80,8 +81,11 @@ class Fl_Oscilloscope : public Fl_Box, public Fl_Osc_Widget
{
int ox=x(),oy=y(),lx=w(),ly=h()-1;
- if (damage()!=1){
- fl_color( fl_color_average( FL_BLACK, FL_BACKGROUND_COLOR, 0.5 ));
+ if (ly < 32) {
+ fl_color(bkgnd);
+ fl_rectf(ox-1,oy-1,lx+2,ly+2);
+ } else if (damage()!=1) {
+ fl_color(bkgnd);
fl_rectf(ox,oy,lx,ly);
}
@@ -117,12 +121,16 @@ class Fl_Oscilloscope : public Fl_Box, public Fl_Osc_Widget
double ph=((phase-64.0)/128.0*oscilsize+oscilsize);
for (int i=1;i<lx;i++){
int k2=(oscilsize*i/lx)+ph;
- double y2=smps[k2%oscilsize];
- fl_vertex(i+ox,y2*ly/2.0+oy+ly/2);
+ fl_vertex(i+ox,(smps[k2%oscilsize]+1)*ly/2+oy-0.5);
}
fl_end_line();
}
+ if (ly < 32) {
+ fl_color(bkgnd);
+ fl_line_style(FL_SOLID,1);
+ fl_rect(ox-1,oy-2,lx+2,ly+3);
+ }
fl_line_style(FL_SOLID,0);
}
@@ -143,4 +151,5 @@ class Fl_Oscilloscope : public Fl_Box, public Fl_Osc_Widget
float *smps;
int oscilsize;
+ Fl_Color bkgnd;
};