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;
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;
}
FlxColorSpaceConverter * flx_colorspace_converter_new(gint width, gint height);
void flx_set_palette_vector(FlxColorSpaceConverter *flxpal, guint start, guint num,
- guchar *newpal);
+ guchar *newpal, gint scale);
void flx_set_color(FlxColorSpaceConverter *flxpal, guint colr, guint red, guint green,
- guint blue);
+ guint blue, gint scale);
static void gst_flxdec_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-static void flx_decode_color(GstFlxDec *, guchar *, guchar *);
-static void flx_decode_brun(GstFlxDec *, guchar *, guchar *);
-static void flx_decode_delta_fli(GstFlxDec *, guchar *, guchar *);
-static void flx_decode_delta_flc(GstFlxDec *, guchar *, guchar *);
+static void flx_decode_color (GstFlxDec *, guchar *, guchar *, gint);
+static void flx_decode_brun (GstFlxDec *, guchar *, guchar *);
+static void flx_decode_delta_fli (GstFlxDec *, guchar *, guchar *);
+static void flx_decode_delta_flc (GstFlxDec *, guchar *, guchar *);
#define rndalign(off) ((off) + ((off) % 2))
switch(hdr->id)
{
case FLX_COLOR64:
+ flx_decode_color(flxdec, data, dest, 2);
+ data += rndalign(hdr->size) - FlxFrameChunkSize;
+ break;
+
case FLX_COLOR256:
- flx_decode_color(flxdec, data, dest);
+ flx_decode_color(flxdec, data, dest, 0);
data += rndalign(hdr->size) - FlxFrameChunkSize;
break;
static void
-flx_decode_color(GstFlxDec *flxdec, guchar *data, guchar *dest)
+flx_decode_color(GstFlxDec *flxdec, guchar *data, guchar *dest, gint scale)
{
guint packs, count, indx;
count = 256;
g_print("GstFlxDec: cmap count: %d (indx: %d)\n", count, indx);
- flx_set_palette_vector(flxdec->converter, indx, count, data);
+ flx_set_palette_vector(flxdec->converter, indx, count, data, scale);
data += (count * 3);
}