Make mkalpha function simpler, faster and more correct.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30523 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2010-02-06 19:18:09 +00:00
parent a5bb20514a
commit e008f62627
1 changed files with 3 additions and 8 deletions

View File

@ -175,14 +175,9 @@ static inline int mkalpha(int i)
{
/* In mplayer's alpha planes, 0 is transparent, then 1 is nearly
opaque upto 255 which is transparent */
switch (i) {
case 0xf:
return 1;
case 0:
return 0;
default:
return (0xf - i) << 4;
}
// extend 4 -> 8 bit
i |= i << 4;
return (uint8_t)(-i);
}
/* Cut the sub to visible part */