changeset 30481:d155e2899ad7

Make mkalpha function simpler, faster and more correct.
author reimar
date Sat, 06 Feb 2010 19:18:09 +0000
parents f22bbe6fc0f6
children 794b61a63cc7
files spudec.c
diffstat 1 files changed, 3 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/spudec.c	Sat Feb 06 17:43:04 2010 +0000
+++ b/spudec.c	Sat Feb 06 19:18:09 2010 +0000
@@ -175,14 +175,9 @@
 {
   /* 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 */