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
This commit is contained in:
Mart Raudsepp 2011-12-21 13:00:27 +02:00 committed by Mark Nauwelaerts
parent eabb238b24
commit 76ddd498e2

View file

@ -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;