From cd4ad4de785993840e38f9e45f0e47fd616d4b11 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sun, 21 Jul 2024 21:36:04 +0200 Subject: [PATCH] Fixed rounding in quantization reference --- HPPH.Reference/PixelHelper.Quantize.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/HPPH.Reference/PixelHelper.Quantize.cs b/HPPH.Reference/PixelHelper.Quantize.cs index 6d56d4d..3734e01 100644 --- a/HPPH.Reference/PixelHelper.Quantize.cs +++ b/HPPH.Reference/PixelHelper.Quantize.cs @@ -97,10 +97,10 @@ internal class ColorCube int b = _colors.Sum(x => x.B); int a = _colors.Sum(x => x.A); - return T.Create((byte)(r / _colors.Count), - (byte)(g / _colors.Count), - (byte)(b / _colors.Count), - (byte)(a / _colors.Count)); + return T.Create((byte)MathF.Round(r / (float)_colors.Count), + (byte)MathF.Round(g / (float)_colors.Count), + (byte)MathF.Round(b / (float)_colors.Count), + (byte)MathF.Round(a / (float)_colors.Count)); } #endregion