Code: Select all
static inline Quantum ClampPixel(const MagickRealType value)
{
if (value < 0.0f)
return(0);
if (value >= (MagickRealType) QuantumRange)
return((Quantum) QuantumRange);
#if !defined(MAGICKCORE_HDRI_SUPPORT)
return((Quantum) (value+0.5f));
#else
return((Quantum) value);
#endif
}
Code: Select all
static inline Quantum ClampToQuantum(const MagickRealType value)
{
#if defined(MAGICKCORE_HDRI_SUPPORT)
return((Quantum) value);
#else
if (value <= 0.0f)
return((Quantum) 0);
if (value >= (MagickRealType) QuantumRange)
return(QuantumRange);
return((Quantum) (value+0.5f));
#endif
}
Code: Select all
@@ -2850,14 +2847,14 @@
composite.blue=(MagickRealType) QuantumRange-composite.blue;
composite.index=(MagickRealType) QuantumRange-composite.index;
}
- SetPixelRed(q,ClampToQuantum(composite.red));
- SetPixelGreen(q,ClampToQuantum(composite.green));
- SetPixelBlue(q,ClampToQuantum(composite.blue));
- SetPixelOpacity(q,ClampToQuantum(composite.opacity));
+ SetPixelRed(q,ClampPixel(composite.red));
+ SetPixelGreen(q,ClampPixel(composite.green));
+ SetPixelBlue(q,ClampPixel(composite.blue));
+ SetPixelOpacity(q,ClampPixel(composite.opacity));
if (image->colorspace == CMYKColorspace)
- SetPixelIndex(indexes+x,ClampToQuantum(composite.index));
+ SetPixelIndex(indexes+x,ClampPixel(composite.index));
p++;
- if (p >= (pixels+composite_image->columns))
+ if (p >= (pixels+source_image->columns))
p=pixels;
q++;
}
Composite operations in ImageMagick-6.9.0-2 doesn't clamp floating-point image.