summaryrefslogtreecommitdiffstats
path: root/gst/flx/flx_color.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2002-01-18 18:41:58 +0000
committerWim Taymans <wim.taymans@gmail.com>2002-01-18 18:41:58 +0000
commitf34f00f438b35148d063185c3c8940b10768561e (patch)
tree3ec9feefd0713e82b1764be333f6fe789c7a18c6 /gst/flx/flx_color.c
parent5c285187280eb38b5a2265c6675044b59372fc7e (diff)
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.c25
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;
}