1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Optimization in AlphaBlend()

This commit is contained in:
Klaus Schmidinger 2011-02-20 21:35:48 +01:00
parent 76d9240395
commit e145ee45e2

8
osd.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: osd.c 2.12 2011/02/20 14:48:01 kls Exp $ * $Id: osd.c 2.13 2011/02/20 21:35:48 kls Exp $
*/ */
#include "osd.h" #include "osd.h"
@ -72,10 +72,8 @@ cInitAlphaLut initAlphaLut;
tColor AlphaBlend(tColor ColorFg, tColor ColorBg, tColor AlphaLayer) tColor AlphaBlend(tColor ColorFg, tColor ColorBg, tColor AlphaLayer)
{ {
tColor Alpha = (ColorFg & 0xFF000000) >> 24; tColor Alpha = (ColorFg & 0xFF000000) >> 24;
if (AlphaLayer < ALPHA_OPAQUE) { Alpha *= AlphaLayer;
Alpha *= AlphaLayer; Alpha = ((Alpha + ((Alpha >> 8) & 0x000000FF) + 0x00000080) >> 8) & 0x000000FF;
Alpha = ((Alpha + ((Alpha >> 8) & 0x000000FF) + 0x00000080) >> 8) & 0x000000FF;
}
uint16_t *lut = &AlphaLut[Alpha][(ColorBg & 0xFF000000) >> 24][0]; uint16_t *lut = &AlphaLut[Alpha][(ColorBg & 0xFF000000) >> 24][0];
return (tColor)((lut[3] << 24) return (tColor)((lut[3] << 24)
| (((((ColorFg & 0x00FF0000) >> 16) * lut[0] + ((ColorBg & 0x00FF0000) >> 16) * lut[1]) << 8) & 0x00FF0000) | (((((ColorFg & 0x00FF0000) >> 16) * lut[0] + ((ColorBg & 0x00FF0000) >> 16) * lut[1]) << 8) & 0x00FF0000)