mirror of
https://github.com/mpv-player/mpv.git
synced 2024-09-20 20:03:10 +02:00
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:
parent
a5bb20514a
commit
e008f62627
11
spudec.c
11
spudec.c
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user