summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2013-07-24 22:57:25 +0200
committerRobin Gareus <robin@gareus.org>2013-07-24 22:57:25 +0200
commit2ec45cfd1b09343b874726f1b3f38ac6a1ed49e3 (patch)
tree2c7be819cc964284097dba6f27a203392b2bbb31 /libs
parenta9975f44a518dd978234d6e067943dbc84a4ac21 (diff)
align gradient with meter-metrics
Diffstat (limited to 'libs')
-rw-r--r--libs/gtkmm2ext/fastmeter.cc27
1 files changed, 14 insertions, 13 deletions
diff --git a/libs/gtkmm2ext/fastmeter.cc b/libs/gtkmm2ext/fastmeter.cc
index bac0ba0c92..c930e60be3 100644
--- a/libs/gtkmm2ext/fastmeter.cc
+++ b/libs/gtkmm2ext/fastmeter.cc
@@ -123,7 +123,8 @@ FastMeter::generate_meter_pattern (
{
guint8 r,g,b,a;
double knee;
- double soft = 1.5 / (double) height;
+ const double soft = 2.5 / (double) height;
+ const double offs = -1.0 / (double) height;
cairo_pattern_t* pat = cairo_pattern_create_linear (0.0, 0.0, 0.0, height);
@@ -136,44 +137,44 @@ FastMeter::generate_meter_pattern (
cairo_pattern_add_color_stop_rgb (pat, 0.0,
r/255.0, g/255.0, b/255.0);
- knee = ((float)height * stp[3] / 115.0f); // -0dB
+ knee = offs + stp[3] / 115.0f; // -0dB
UINT_TO_RGBA (clr[8], &r, &g, &b, &a);
- cairo_pattern_add_color_stop_rgb (pat, 1.0 - (knee/(double)height) - soft,
+ cairo_pattern_add_color_stop_rgb (pat, 1.0 - knee,
r/255.0, g/255.0, b/255.0);
UINT_TO_RGBA (clr[7], &r, &g, &b, &a);
- cairo_pattern_add_color_stop_rgb (pat, 1.0 - (knee/(double)height) + soft,
+ cairo_pattern_add_color_stop_rgb (pat, 1.0 - knee + soft,
r/255.0, g/255.0, b/255.0);
- knee = ((float)height * stp[2]/ 115.0f); // -3dB || -2dB
+ knee = offs + stp[2]/ 115.0f; // -3dB || -2dB
UINT_TO_RGBA (clr[6], &r, &g, &b, &a);
- cairo_pattern_add_color_stop_rgb (pat, 1.0 - (knee/(double)height) - soft,
+ cairo_pattern_add_color_stop_rgb (pat, 1.0 - knee,
r/255.0, g/255.0, b/255.0);
UINT_TO_RGBA (clr[5], &r, &g, &b, &a);
- cairo_pattern_add_color_stop_rgb (pat, 1.0 - (knee/(double)height) + soft,
+ cairo_pattern_add_color_stop_rgb (pat, 1.0 - knee + soft,
r/255.0, g/255.0, b/255.0);
- knee = ((float)height * stp[1] / 115.0f); // -9dB
+ knee = offs + stp[1] / 115.0f; // -9dB
UINT_TO_RGBA (clr[4], &r, &g, &b, &a);
- cairo_pattern_add_color_stop_rgb (pat, 1.0 - (knee/(double)height) - soft,
+ cairo_pattern_add_color_stop_rgb (pat, 1.0 - knee,
r/255.0, g/255.0, b/255.0);
UINT_TO_RGBA (clr[3], &r, &g, &b, &a);
- cairo_pattern_add_color_stop_rgb (pat, 1.0 - (knee/(double)height) + soft,
+ cairo_pattern_add_color_stop_rgb (pat, 1.0 - knee + soft,
r/255.0, g/255.0, b/255.0);
- knee = ((float)height * stp[0] / 115.0f); // -18dB
+ knee = offs + stp[0] / 115.0f; // -18dB
UINT_TO_RGBA (clr[2], &r, &g, &b, &a);
- cairo_pattern_add_color_stop_rgb (pat, 1.0 - (knee/(double)height) - soft,
+ cairo_pattern_add_color_stop_rgb (pat, 1.0 - knee,
r/255.0, g/255.0, b/255.0);
UINT_TO_RGBA (clr[1], &r, &g, &b, &a);
- cairo_pattern_add_color_stop_rgb (pat, 1.0 - (knee/(double)height) + soft,
+ cairo_pattern_add_color_stop_rgb (pat, 1.0 - knee + soft,
r/255.0, g/255.0, b/255.0);
UINT_TO_RGBA (clr[0], &r, &g, &b, &a); // bottom