From: pieterg Date: Wed, 12 Jan 2011 23:30:13 +0000 (+0100) Subject: bcm accelerated blit: avoid running out of clut data X-Git-Tag: experimental-2011.02~6^2 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/574863ec8d43671a8fd8f9adcdadb77a75d8ce24?ds=sidebyside bcm accelerated blit: avoid running out of clut data 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. --- diff --git a/lib/gdi/accel.cpp b/lib/gdi/accel.cpp index 9450ecca..fc739e92 100644 --- a/lib/gdi/accel.cpp +++ b/lib/gdi/accel.cpp @@ -112,7 +112,7 @@ int gAccel::blit(gSurface *dst, const gSurface *src, const eRect &p, const eRect 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 */