diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-02-06 19:18:09 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-02-06 19:18:09 +0000 |
commit | e008f62627e01a064db9f73f16fb3c2e9b198f3f (patch) | |
tree | 1317fef568ab2ac15efe21c4b06ff000e8e05e23 /spudec.c | |
parent | a5bb20514a6cd85392e789f6e1e75b5abac4d560 (diff) | |
download | mpv-e008f62627e01a064db9f73f16fb3c2e9b198f3f.tar.bz2 mpv-e008f62627e01a064db9f73f16fb3c2e9b198f3f.tar.xz |
Make mkalpha function simpler, faster and more correct.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30523 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'spudec.c')
-rw-r--r-- | spudec.c | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -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 */ |