1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-12 17:48:31 +00:00

Removed unnecessary in GetByteValueFromPercentage

This commit is contained in:
Darth Affe 2024-06-22 19:49:38 +02:00
parent f21acbd767
commit 6f0711564c

View File

@ -91,9 +91,8 @@ public static class FloatExtensions
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte GetByteValueFromPercentage(this float percentage)
{
if (float.IsNaN(percentage)) return 0;
if (float.IsNaN(percentage) || (percentage <= 0)) return 0;
percentage = percentage.Clamp(0, 1.0f);
return (byte)(percentage >= 1.0f ? 255 : percentage * 256.0f);
}