From 35e1987b602486028573eb697d68e5ce3c3f46bc Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 18 Jan 2002 18:41:58 +0000 Subject: Fix the "64 colors flx too dark" bug. Original commit message from CVS: Fix the "64 colors flx too dark" bug. --- gst/flx/flx_color.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'gst/flx/flx_color.c') diff --git a/gst/flx/flx_color.c b/gst/flx/flx_color.c index c61052d0..8b505c9d 100644 --- a/gst/flx/flx_color.c +++ b/gst/flx/flx_color.c @@ -66,7 +66,7 @@ flx_colorspace_convert(FlxColorSpaceConverter *flxpal, guchar *src, guchar *dest void -flx_set_palette_vector(FlxColorSpaceConverter *flxpal, guint start, guint num, guchar *newpal) +flx_set_palette_vector(FlxColorSpaceConverter *flxpal, guint start, guint num, guchar *newpal, gint scale) { guint grab; @@ -75,20 +75,33 @@ flx_set_palette_vector(FlxColorSpaceConverter *flxpal, guint start, guint num, g grab = ((start + num) > 0x100 ? 0x100 - start : num); - memcpy(&flxpal->palvec[start * 3], newpal, grab*3); + if (scale) { + gint i = 0; + + start *= 3; + while (grab) { + flxpal->palvec[start++] = newpal[i++] << scale; + flxpal->palvec[start++] = newpal[i++] << scale; + flxpal->palvec[start++] = newpal[i++] << scale; + grab--; + } + } + else { + memcpy(&flxpal->palvec[start * 3], newpal, grab * 3); + } } void -flx_set_color(FlxColorSpaceConverter *flxpal, guint colr, guint red, guint green, guint blue) +flx_set_color(FlxColorSpaceConverter *flxpal, guint colr, guint red, guint green, guint blue, gint scale) { g_return_if_fail(flxpal != NULL); g_return_if_fail(colr < 0x100); - flxpal->palvec[(colr * 3)] = red; - flxpal->palvec[(colr * 3) + 1] = green; - flxpal->palvec[(colr * 3) + 2] = blue; + flxpal->palvec[(colr * 3)] = red << scale; + flxpal->palvec[(colr * 3) + 1] = green << scale; + flxpal->palvec[(colr * 3) + 2] = blue << scale; } -- cgit v1.2.1