fix boundary condition when resampling pixel color (https://github.com/ImageMagick/ImageMagick/issues/7415)

This commit is contained in:
Cristy
2024-06-20 20:38:40 -04:00
parent afb8ddf191
commit 3eb67c6227
+3 -3
View File
@@ -598,11 +598,11 @@ MagickExport MagickBooleanType ResamplePixelColor(
weight = 0.0;
#if FILTER_LUT
/* Note that the ellipse has been pre-scaled so F = WLUT_WIDTH */
if ((Q >= 0.0) && ((int) Q < WLUT_WIDTH)) {
weight = resample_filter->filter_lut[(int)Q];
if (((int) Q >= 0) && ((int) Q < WLUT_WIDTH)) {
weight = resample_filter->filter_lut[(int) Q];
#else
/* Note that the ellipse has been pre-scaled so F = support^2 */
if ((Q >= 0.0) && (Q < (double)resample_filter->F)) {
if ((Q >= 0.0) && (Q < resample_filter->F)) {
weight = GetResizeFilterWeight(resample_filter->filter_def,
sqrt(Q)); /* a SquareRoot! Arrggghhhhh... */
#endif