Browse Source

fixed broken rounding

af/merge-core
Anton Firszov 9 years ago
parent
commit
01ebd8e1d6
  1. 28
      src/ImageSharp/PixelFormats/HalfSingle.cs
  2. 16
      src/ImageSharp/PixelFormats/HalfVector2.cs

28
src/ImageSharp/PixelFormats/HalfSingle.cs

@ -114,9 +114,9 @@ namespace ImageSharp.PixelFormats
public void ToRgb24(ref Rgb24 dest)
{
Vector4 vector = this.ToScaledVector4();
dest.R = (byte)MathF.Round(vector.X);
dest.G = (byte)MathF.Round(vector.Y);
dest.B = (byte)MathF.Round(vector.Z);
dest.R = (byte)vector.X;
dest.G = (byte)vector.Y;
dest.B = (byte)vector.Z;
}
/// <inheritdoc />
@ -124,10 +124,10 @@ namespace ImageSharp.PixelFormats
public void ToRgba32(ref Rgba32 dest)
{
Vector4 vector = this.ToScaledVector4();
dest.R = (byte)MathF.Round(vector.X);
dest.G = (byte)MathF.Round(vector.Y);
dest.B = (byte)MathF.Round(vector.Z);
dest.A = (byte)MathF.Round(vector.W);
dest.R = (byte)vector.X;
dest.G = (byte)vector.Y;
dest.B = (byte)vector.Z;
dest.A = (byte)vector.W;
}
/// <inheritdoc />
@ -135,9 +135,9 @@ namespace ImageSharp.PixelFormats
public void ToBgr24(ref Bgr24 dest)
{
Vector4 vector = this.ToScaledVector4();
dest.R = (byte)MathF.Round(vector.X);
dest.G = (byte)MathF.Round(vector.Y);
dest.B = (byte)MathF.Round(vector.Z);
dest.R = (byte)vector.X;
dest.G = (byte)vector.Y;
dest.B = (byte)vector.Z;
}
/// <inheritdoc />
@ -145,10 +145,10 @@ namespace ImageSharp.PixelFormats
public void ToBgra32(ref Bgra32 dest)
{
Vector4 vector = this.ToScaledVector4();
dest.R = (byte)MathF.Round(vector.X);
dest.G = (byte)MathF.Round(vector.Y);
dest.B = (byte)MathF.Round(vector.Z);
dest.A = (byte)MathF.Round(vector.W);
dest.R = (byte)vector.X;
dest.G = (byte)vector.Y;
dest.B = (byte)vector.Z;
dest.A = (byte)vector.W;
}
/// <inheritdoc />

16
src/ImageSharp/PixelFormats/HalfVector2.cs

@ -128,8 +128,8 @@ namespace ImageSharp.PixelFormats
public void ToRgb24(ref Rgb24 dest)
{
Vector4 vector = this.ToScaledVector4();
dest.R = (byte)MathF.Round(vector.X);
dest.G = (byte)MathF.Round(vector.Y);
dest.R = (byte)vector.X;
dest.G = (byte)vector.Y;
dest.B = 0;
}
@ -138,8 +138,8 @@ namespace ImageSharp.PixelFormats
public void ToRgba32(ref Rgba32 dest)
{
Vector4 vector = this.ToScaledVector4();
dest.R = (byte)MathF.Round(vector.X);
dest.G = (byte)MathF.Round(vector.Y);
dest.R = (byte)vector.X;
dest.G = (byte)vector.Y;
dest.B = 0;
dest.A = 255;
}
@ -149,8 +149,8 @@ namespace ImageSharp.PixelFormats
public void ToBgr24(ref Bgr24 dest)
{
Vector4 vector = this.ToScaledVector4();
dest.R = (byte)MathF.Round(vector.X);
dest.G = (byte)MathF.Round(vector.Y);
dest.R = (byte)vector.X;
dest.G = (byte)vector.Y;
dest.B = 0;
}
@ -159,8 +159,8 @@ namespace ImageSharp.PixelFormats
public void ToBgra32(ref Bgra32 dest)
{
Vector4 vector = this.ToScaledVector4();
dest.R = (byte)MathF.Round(vector.X);
dest.G = (byte)MathF.Round(vector.Y);
dest.R = (byte)vector.X;
dest.G = (byte)vector.Y;
dest.B = 0;
dest.A = 255;
}

Loading…
Cancel
Save