Browse Source

Revert "Potential fix for pull request finding 'Equality check on floating point values'"

This reverts commit ba4d1df1e1.
pull/3154/head
James Jackson-South 4 weeks ago
parent
commit
42f6fb6276
  1. 4
      src/ImageSharp/PixelFormats/Utils/Vector4Converters.AssociatedRgbaCompatible.cs

4
src/ImageSharp/PixelFormats/Utils/Vector4Converters.AssociatedRgbaCompatible.cs

@ -371,10 +371,8 @@ internal static partial class Vector4Converters
float byteAlpha = alpha * byte.MaxValue; float byteAlpha = alpha * byte.MaxValue;
float storedAlpha = (byte)Numerics.Clamp(byteAlpha + 0.5F, 0, byte.MaxValue); float storedAlpha = (byte)Numerics.Clamp(byteAlpha + 0.5F, 0, byte.MaxValue);
byte quantizedAlpha = (byte)storedAlpha;
byte sourceAlphaByte = (byte)Numerics.Clamp(byteAlpha + 0.5F, 0, byte.MaxValue);
if (sourceAlphaByte == quantizedAlpha) if (byteAlpha == storedAlpha)
{ {
// Quantization leaves alpha unchanged, so RGB is already associated correctly. Avoiding division preserves exact byte midpoints produced by scaling stored components. // Quantization leaves alpha unchanged, so RGB is already associated correctly. Avoiding division preserves exact byte midpoints produced by scaling stored components.
source *= byte.MaxValue; source *= byte.MaxValue;

Loading…
Cancel
Save