aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib
diff options
context:
space:
mode:
authorEmanuele Giaquinta <emanuele.giaquinta@gmail.com>2015-06-23 16:09:50 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2015-06-23 16:13:08 +0200
commitffc87da60b2262432d56f15332b3edd15b7e00b2 (patch)
tree00628d0f77be1bf1bb76ff0e8d29fd724ada2210 /nx-X11/lib
parent8cf9283bd23a2824c16601eca10b38065374e012 (diff)
downloadnx-libs-ffc87da60b2262432d56f15332b3edd15b7e00b2.tar.gz
nx-libs-ffc87da60b2262432d56f15332b3edd15b7e00b2.tar.bz2
nx-libs-ffc87da60b2262432d56f15332b3edd15b7e00b2.zip
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. Fixes ArcticaProject/nx-libs#55. Author: Emanuele Giaquinta <emanuele.giaquinta@gmail.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Rebased against NX: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Diffstat (limited to 'nx-X11/lib')
-rw-r--r--nx-X11/lib/Xrender/Color.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/nx-X11/lib/Xrender/Color.c b/nx-X11/lib/Xrender/Color.c
index 4f934f038..6875204e6 100644
--- a/nx-X11/lib/Xrender/Color.c
+++ b/nx-X11/lib/Xrender/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;
}