From 7cee23a419d1e73abc7259b0a1af04ced789e651 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Mon, 30 May 2011 23:45:17 +0300 Subject: [PATCH] spectrascope: use add_pixel for non-white pixels https://bugzilla.gnome.org/show_bug.cgi?id=651536 --- gst/scopes/gstspectrascope.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) 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; -- 2.34.1