diff options
author | Pierre Joye <pierre.php@gmail.com> | 2021-08-25 00:09:05 +0700 |
---|---|---|
committer | Pierre Joye <pierre.php@gmail.com> | 2021-08-25 00:09:05 +0700 |
commit | 49ecef1bf4c1982831e1a39f00ab437ed03e2a2e (patch) | |
tree | 74daa07aaa30d4c226da1f3da11ec8e166357eb3 | |
parent | 8890f527b2a9b013678da4df17585aea0e65a021 (diff) | |
download | libgd-49ecef1bf4c1982831e1a39f00ab437ed03e2a2e.tar.gz |
avoid case w/255.5+0.5 (kudos @cmb69)bug/661
-rw-r--r-- | src/gd.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -3540,10 +3540,10 @@ BGD_DECLARE(void) gdImageCopyResampled (gdImagePtr dst, blue /= alpha_sum; } /* Round up closest next channel value and clamp to max channel value */ - red = red > 255.5 ? 255 : red+0.5; - blue = blue > 255.5 ? 255 : blue+0.5; - green = green > 255.5 ? 255 : green+0.5; - alpha = alpha > gdAlphaMax+0.5 ? 255 : alpha+0.5; + red = red >= 255.5 ? 255 : red+0.5; + blue = blue >= 255.5 ? 255 : blue+0.5; + green = green >= 255.5 ? 255 : green+0.5; + alpha = alpha >= gdAlphaMax+0.5 ? 255 : alpha+0.5; gdImageSetPixel(dst, x, y, gdTrueColorAlpha ((int)red, (int)green, (int)blue, (int)alpha)); } } |