aboutsummaryrefslogtreecommitdiff
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-09-28 07:53:07 +0200
commit931d24cc296c797ff29edec7536f993090047d15 (patch)
tree4ed95cb7ffe666cab4bb86b83527aa99e5d7de72
parent6deaaf50f3fffe4ac4d5940a0e7bf38b71f7be43 (diff)
downloadnx-libs-931d24cc296c797ff29edec7536f993090047d15.tar.gz
nx-libs-931d24cc296c797ff29edec7536f993090047d15.tar.bz2
nx-libs-931d24cc296c797ff29edec7536f993090047d15.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>
-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;
}