summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPierre Joye <pierre.php@gmail.com>2021-08-25 00:09:05 +0700
committerPierre Joye <pierre.php@gmail.com>2021-08-25 00:09:05 +0700
commit49ecef1bf4c1982831e1a39f00ab437ed03e2a2e (patch)
tree74daa07aaa30d4c226da1f3da11ec8e166357eb3 /src
parent8890f527b2a9b013678da4df17585aea0e65a021 (diff)
downloadlibgd-49ecef1bf4c1982831e1a39f00ab437ed03e2a2e.tar.gz
avoid case w/255.5+0.5 (kudos @cmb69)bug/661
Diffstat (limited to 'src')
-rw-r--r--src/gd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gd.c b/src/gd.c
index bf749ca..51d87d1 100644
--- a/src/gd.c
+++ b/src/gd.c
@@ -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));
}
}