diff options
author | Luis de Bethencourt <luis.bg@samsung.com> | 2015-01-09 17:56:09 +0000 |
---|---|---|
committer | Luis de Bethencourt <luis.bg@samsung.com> | 2015-01-09 17:56:09 +0000 |
commit | c01af3aa8fbc76495a571b639357d155a4256b1f (patch) | |
tree | 8defaff56dcbc43252445ac667a5dfe4739526ad /gst/audiovisualizers | |
parent | 542c77ab3831388f162a78878ba8902cd5c4d9f9 (diff) | |
download | gstreamer-plugins-bad-c01af3aa8fbc76495a571b639357d155a4256b1f.tar.gz |
audiovisualizer: remove check for below zero for unsigned value
CLAMP checks both if value is '< 0' and '> max'. Value will never be a negative
number since it is an unsigned integer. Removing that check and only checking if
it is bigger than max and setting it appropriately.
Also converting the previous instance of this into MIN() for consistency.
CID 1139793
Diffstat (limited to 'gst/audiovisualizers')
-rw-r--r-- | gst/audiovisualizers/gstwavescope.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/gst/audiovisualizers/gstwavescope.c b/gst/audiovisualizers/gstwavescope.c index b8a9e1f64..cd83990d5 100644 --- a/gst/audiovisualizers/gstwavescope.c +++ b/gst/audiovisualizers/gstwavescope.c @@ -325,18 +325,15 @@ render_color_dots (GstAudioVisualizer * base, guint32 * vdata, filter ((gfloat) adata[s]); y = (guint) (oy + flt[0] * dy); - if (y > h1) - y = h1; + y = MIN (y, h1); draw_dot_c (vdata, x, y, w, 0x00FF0000); y = (guint) (oy + flt[3] * dy); - if (y > h1) - y = h1; + y = MIN (y, h1); draw_dot_c (vdata, x, y, w, 0x0000FF00); y = (guint) (oy + (flt[4] + flt[5]) * dy); - if (y > h1) - y = h1; + y = MIN (y, h1); draw_dot_c (vdata, x, y, w, 0x000000FF); s += channels; @@ -370,30 +367,30 @@ render_color_lines (GstAudioVisualizer * base, guint32 * vdata, filter ((gfloat) adata[s]); y = (guint) (oy + flt[0] * dy); - y2 = CLAMP (y, 0, h1); + y2 = MIN (y, h1); y = (guint) (oy + flt[3] * dy); - y3 = CLAMP (y, 0, h1); + y3 = MIN (y, h1); y = (guint) (oy + (flt[4] + flt[5]) * dy); - y4 = CLAMP (y, 0, h1); + y4 = MIN (y, h1); for (i = 1; i < num_samples; i++) { x = (guint) ((gfloat) i * dx); filter ((gfloat) adata[s]); y = (guint) (oy + flt[0] * dy); - y = CLAMP (y, 0, h1); + y = MIN (y, h1); draw_line_aa (vdata, x2, x, y2, y, w, 0x00FF0000); y2 = y; y = (guint) (oy + flt[3] * dy); - y = CLAMP (y, 0, h1); + y = MIN (y, h1); draw_line_aa (vdata, x2, x, y3, y, w, 0x0000FF00); y3 = y; y = (guint) (oy + (flt[4] + flt[5]) * dy); - y = CLAMP (y, 0, h1); + y = MIN (y, h1); draw_line_aa (vdata, x2, x, y4, y, w, 0x000000FF); y4 = y; |