summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derek.foreman@collabora.co.uk>2012-04-23 18:56:56 (GMT)
committerDerek Foreman <derek.foreman@collabora.co.uk>2012-04-23 18:56:56 (GMT)
commitcf94745e773f5bcf581fd107a1079c5c6f9f806b (patch)
treea7e8b1a55c4e76d35ffc12b95c0b2072089da035
parent14bd13312d44c2b7f154aefc85735e80091c5de9 (diff)
downloadxf86-video-ti81xx-cf94745e773f5bcf581fd107a1079c5c6f9f806b.tar.gz
xf86-video-ti81xx-cf94745e773f5bcf581fd107a1079c5c6f9f806b.tar.xz
Change color key conversion formula for better 16-bit color key support
-rw-r--r--src/xv.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/xv.c b/src/xv.c
index 11b4038..55e8b6d 100644
--- a/src/xv.c
+++ b/src/xv.c
@@ -764,9 +764,9 @@ static int colorkey(ScrnInfoPtr xf86_screen, int color)
red = (color >> 16) & 0xFF;
green = (color >> 8) & 0xFF;
blue = color & 0xFF;
- outred = red * ((1 << xf86_screen->weight.red) - 1) / 255;
- outgreen =green * ((1 << xf86_screen->weight.green) - 1) / 255;
- outblue = blue * ((1 << xf86_screen->weight.blue) - 1) / 255;
+ outred = red >> (8 - xf86_screen->weight.red);
+ outgreen = green >> (8 - xf86_screen->weight.green);
+ outblue = blue >> (8 - xf86_screen->weight.blue);
color = outred << xf86_screen->offset.red;
color |= outgreen << xf86_screen->offset.green;
color |= outblue << xf86_screen->offset.blue;