diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2002-01-18 18:41:58 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2002-01-18 18:41:58 +0000 |
commit | 35e1987b602486028573eb697d68e5ce3c3f46bc (patch) | |
tree | 6efd8a8014417b956f5c8148a0e0b04d8eab506a /gst/flx/flx_color.c | |
parent | 272ae0efe3234d2274abe7669957faf00035949d (diff) | |
download | gst-plugins-bad-35e1987b602486028573eb697d68e5ce3c3f46bc.tar.gz gst-plugins-bad-35e1987b602486028573eb697d68e5ce3c3f46bc.tar.bz2 gst-plugins-bad-35e1987b602486028573eb697d68e5ce3c3f46bc.zip |
Fix the "64 colors flx too dark" bug.
Original commit message from CVS:
Fix the "64 colors flx too dark" bug.
Diffstat (limited to 'gst/flx/flx_color.c')
-rw-r--r-- | gst/flx/flx_color.c | 25 |
1 files changed, 19 insertions, 6 deletions
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; } |