- *ptr++ = (unsigned char)ctab[v1];
- *ptr = (unsigned char)ctab[(v1 + v2) >> 1];
- ptr += width - 1;
- *ptr++ = (unsigned char)ctab[(v1 + v3) >> 1];
- *ptr = (unsigned char)ctab[(v1 + v4) >> 1];
- ptr -= width - 1;
+
+ ptr[2] = ((unsigned int)st->ctab[v1] & 0x00FF0000) >> 16;
+ ptr[1] = ((unsigned int)st->ctab[v1] & 0x0000FF00) >> 8;
+ ptr[0] = ((unsigned int)st->ctab[v1] & 0x000000FF);
+ ptr += 3;
+
+ ptr[2] = ((unsigned int)st->ctab[(v1 + v2) >> 1] & 0x00FF0000) >> 16;
+ ptr[1] = ((unsigned int)st->ctab[(v1 + v2) >> 1] & 0x0000FF00) >> 8;
+ ptr[0] = ((unsigned int)st->ctab[(v1 + v2) >> 1] & 0x000000FF);
+ ptr += ((st->width - 1) * 3);
+
+ ptr[2] = ((unsigned int)st->ctab[(v1 + v3) >> 1] & 0x00FF0000) >> 16;
+ ptr[1] = ((unsigned int)st->ctab[(v1 + v3) >> 1] & 0x0000FF00) >> 8;
+ ptr[0] = ((unsigned int)st->ctab[(v1 + v3) >> 1] & 0x000000FF);
+ ptr += 3;
+
+ ptr[2] = ((unsigned int)st->ctab[(v1 + v4) >> 1] & 0x00FF0000) >> 16;
+ ptr[1] = ((unsigned int)st->ctab[(v1 + v4) >> 1] & 0x0000FF00) >> 8;
+ ptr[0] = ((unsigned int)st->ctab[(v1 + v4) >> 1] & 0x000000FF);
+ ptr -= ((st->width - 1) * 3);
+ }
+
+ ptr = last_ptr + (st->xim->bytes_per_line << 1);
+ ptr1 += 2;
+ }
+}
+
+static void
+Flame2Image8(struct state *st)
+{
+ int x,y;
+ unsigned char *ptr;
+ unsigned char *ptr1;
+ int v1,v2,v3,v4;
+
+ ptr = (unsigned char *)st->xim->data;
+ ptr += (st->top << 1) * st->width;
+ ptr1 = st->flame + 1 + (st->top * (st->fwidth + 2));
+
+ for(y=st->top;y<st->fheight;y++)
+ {
+ for(x=0;x<st->fwidth;x++)
+ {
+ v1 = (int)*ptr1;
+ v2 = (int)*(ptr1 + 1);
+ v3 = (int)*(ptr1 + st->fwidth + 2);
+ v4 = (int)*(ptr1 + st->fwidth + 2 + 1);
+ ptr1++;
+ *ptr++ = (unsigned char)st->ctab[v1];
+ *ptr = (unsigned char)st->ctab[(v1 + v2) >> 1];
+ ptr += st->width - 1;
+ *ptr++ = (unsigned char)st->ctab[(v1 + v3) >> 1];
+ *ptr = (unsigned char)st->ctab[(v1 + v4) >> 1];
+ ptr -= st->width - 1;