From 6931fcd838f16f11396ea2085ff59bcdd4db1d17 Mon Sep 17 00:00:00 2001 From: martii Date: Sun, 28 Jul 2013 12:33:24 +0200 Subject: [PATCH] libeplayer3/writer/framebuffer: small optimization --- libeplayer3/output/writer/framebuffer.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libeplayer3/output/writer/framebuffer.c b/libeplayer3/output/writer/framebuffer.c index 012a72f..6ffff24 100644 --- a/libeplayer3/output/writer/framebuffer.c +++ b/libeplayer3/output/writer/framebuffer.c @@ -134,12 +134,13 @@ static int writeData(void* _call) uint32_t c = call->color >> 8; uint32_t a = 255 - (call->color & 0xff); int i; - for (i = 0; i < 256; i++) - colortable[i] = c | (((a * i) >> 8) << 24); + for (i = 0; i < 256; i++) { + uint32_t k = (a * i) >> 8; + colortable[i] = k ? (c | (k << 24)) : 0; + } last_color = call->color; } - fb_printf(100, "x %d\n", call->x); fb_printf(100, "y %d\n", call->y); fb_printf(100, "width %d\n", call->Width); @@ -153,7 +154,7 @@ static int writeData(void* _call) for (y=0;yHeight;y++) { for (x = 0; x < call->Width; x++) { uint32_t c = colortable[src[x]]; - if (c >> 24) + if (c) *dst++ = c; else dst++;