We were passing a hardcoded number of 256 entries to the framebuffer,
while the source surface could have a smaller color lookup table.
For instance, most dvb subtitle graphics have a palette of only 16 colors.
This would cause frequent segfaults.
pal_addr = src->stride * src->y;
unsigned long *pal = (unsigned long*)(((unsigned char*)src->data) + pal_addr);
pal_addr += src->data_phys;
pal_addr = src->stride * src->y;
unsigned long *pal = (unsigned long*)(((unsigned char*)src->data) + pal_addr);
pal_addr += src->data_phys;
- for (i = 0; i < 256; ++i)
+ for (i = 0; i < src->clut.colors; ++i)
*pal++ = src->clut.data[i].argb() ^ 0xFF000000;
} else
return -1; /* unsupported source format */
*pal++ = src->clut.data[i].argb() ^ 0xFF000000;
} else
return -1; /* unsupported source format */