diff options
author | marha <marha@users.sourceforge.net> | 2012-04-23 14:53:52 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-04-23 14:53:52 +0200 |
commit | cd27f58626705bcb561115b8e5b0d1430df83fa6 (patch) | |
tree | 0fea00b96d0cb4a9d55bd0792e5b4634c78864d6 /pixman/test/utils.c | |
parent | 588abfd54eb267dd79fe441e42aee9fc7534eb6e (diff) | |
parent | b68922d51f52ca6ab9daa0105ef5c57f35bfbdcf (diff) | |
download | vcxsrv-cd27f58626705bcb561115b8e5b0d1430df83fa6.tar.gz vcxsrv-cd27f58626705bcb561115b8e5b0d1430df83fa6.tar.bz2 vcxsrv-cd27f58626705bcb561115b8e5b0d1430df83fa6.zip |
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'pixman/test/utils.c')
-rw-r--r-- | pixman/test/utils.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/pixman/test/utils.c b/pixman/test/utils.c index cc0365aa2..c1bf6dc2c 100644 --- a/pixman/test/utils.c +++ b/pixman/test/utils.c @@ -358,9 +358,16 @@ a8r8g8b8_to_rgba_np (uint32_t *dst, uint32_t *src, int n_pixels) if (a != 0) { - r = (r * 255) / a; - g = (g * 255) / a; - b = (b * 255) / a; +#define DIVIDE(c, a) \ + do \ + { \ + int t = ((c) * 255) / a; \ + (c) = t < 0? 0 : t > 255? 255 : t; \ + } while (0) + + DIVIDE (r, a); + DIVIDE (g, a); + DIVIDE (b, a); } *dst8++ = r; |