summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmanuele Giaquinta <emanuele.giaquinta@gmail.com>2012-01-02 19:58:15 +0000
committerJeremy Huddleston <jeremyhu@apple.com>2012-02-28 13:54:58 -0800
commitbb6568cbec24ae2c84bb5d9fe418f0021291a0af (patch)
tree1714f952421434d21b083c889e0a5bd63eff264f
parentb3cfeecf2bddbbb120a9c796a4c9fb8fd08e15fc (diff)
Fix alpha premultiplication in XRenderParseColor.
Due to C arithmetic conversion rules we must use an unsigned constant (or a cast) to perform the multiplication using unsigned arithmetic. Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--src/Color.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Color.c b/src/Color.c
index 9c76e58..23ef800 100644
--- a/src/Color.c
+++ b/src/Color.c
@@ -85,8 +85,8 @@ XRenderParseColor(Display *dpy, char *spec, XRenderColor *def)
def->blue = coreColor.blue;
def->alpha = 0xffff;
}
- def->red = (def->red * def->alpha) / 65535;
- def->green = (def->green * def->alpha) / 65535;
- def->blue = (def->blue * def->alpha) / 65535;
+ def->red = (def->red * def->alpha) / 0xffffU;
+ def->green = (def->green * def->alpha) / 0xffffU;
+ def->blue = (def->blue * def->alpha) / 0xffffU;
return 1;
}