From: Stefan Kost Date: Mon, 30 May 2011 20:45:17 +0000 (+0300) Subject: spectrascope: use add_pixel for non-white pixels X-Git-Tag: 1.19.3~507^2~16050^2~28 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7cee23a419d1e73abc7259b0a1af04ced789e651;p=platform%2Fupstream%2Fgstreamer.git spectrascope: use add_pixel for non-white pixels https://bugzilla.gnome.org/show_bug.cgi?id=651536 --- diff --git a/gst/scopes/gstspectrascope.c b/gst/scopes/gstspectrascope.c index 9252484ff2..c1879b68e2 100644 --- a/gst/scopes/gstspectrascope.c +++ b/gst/scopes/gstspectrascope.c @@ -134,6 +134,30 @@ gst_spectra_scope_setup (GstBaseScope * bscope) return TRUE; } +static inline void +add_pixel (guint32 * _p, guint32 _c) +{ + guint8 *p = (guint8 *) _p; + guint8 *c = (guint8 *) & _c; + + if (p[0] < 255 - c[0]) + p[0] += c[0]; + else + p[0] = 255; + if (p[1] < 255 - c[1]) + p[1] += c[1]; + else + p[1] = 255; + if (p[2] < 255 - c[2]) + p[2] += c[2]; + else + p[2] = 255; + if (p[3] < 255 - c[3]) + p[3] += c[3]; + else + p[3] = 255; +} + static gboolean gst_spectra_scope_render (GstBaseScope * bscope, GstBuffer * audio, GstBuffer * video) @@ -180,7 +204,7 @@ gst_spectra_scope_render (GstBaseScope * bscope, GstBuffer * audio, vdata[off] = 0x00FFFFFF; for (l = y + 1; l <= h; l++) { off += w; - vdata[off] = 0x007F7F7F; + add_pixel (&vdata[off], 0x007F7F7F); } } return TRUE;