From 574863ec8d43671a8fd8f9adcdadb77a75d8ce24 Mon Sep 17 00:00:00 2001 From: pieterg Date: Thu, 13 Jan 2011 00:30:13 +0100 Subject: [PATCH 1/1] 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. --- lib/gdi/accel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 */ -- 2.30.2