From 76ddd498e2198aa3c879e0248acdd2fe286c206a Mon Sep 17 00:00:00 2001 From: Mart Raudsepp Date: Wed, 21 Dec 2011 13:00:27 +0200 Subject: [PATCH] dvbsuboverlay: Handle non_modifying_colour_flag correctly in the RLE handlers The check for when to not memset was checking on an undeterministic 'bits' variable value, which is only meant to be used inside the loop earlier when it is supposed to check if clut_index is 1 together with non_mod set, as per spec: "non_modifying_colour_flag: If set to '1' this indicates that the CLUT entry value '1' is a non modifying colour. When the non modifying colour is assigned to an object pixel, then the pixel of the underlying region background or object shall not be modified. This can be used to create "transparent holes" in objects." https://bugzilla.gnome.org/show_bug.cgi?id=666352 --- gst/dvbsuboverlay/dvb-sub.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gst/dvbsuboverlay/dvb-sub.c b/gst/dvbsuboverlay/dvb-sub.c index 6ba3c74292..21061a358f 100644 --- a/gst/dvbsuboverlay/dvb-sub.c +++ b/gst/dvbsuboverlay/dvb-sub.c @@ -715,7 +715,7 @@ _dvb_sub_read_2bit_string (guint8 * destbuf, gint dbuf_len, GST_TRACE ("RUNLEN: setting %u pixels to color 0x%x in destination buffer, " "dbuf_len left is %d pixels", run_length, clut_index, dbuf_len); - if (!(non_mod == 1 && bits == 1)) + if (!(non_mod == 1 && clut_index == 1)) memset (destbuf, clut_index, run_length); destbuf += run_length; @@ -813,7 +813,7 @@ _dvb_sub_read_4bit_string (guint8 * destbuf, gint dbuf_len, GST_TRACE ("RUNLEN: setting %u pixels to color 0x%x in destination buffer; " "dbuf_len left is %d pixels", run_length, clut_index, dbuf_len); - if (!(non_mod == 1 && bits == 1)) + if (!(non_mod == 1 && clut_index == 1)) memset (destbuf, clut_index, run_length); destbuf += run_length; @@ -905,7 +905,7 @@ _dvb_sub_read_8bit_string (guint8 * destbuf, gint dbuf_len, GST_TRACE ("RUNLEN: setting %u pixels to color 0x%x in destination buffer; " "dbuf_len left is %d pixels", run_length, clut_index, dbuf_len); - if (!(non_mod == 1 && bits == 1)) + if (!(non_mod == 1 && clut_index == 1)) memset (destbuf, clut_index, run_length); destbuf += run_length;