mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 10:08:31 +00:00
Removed unnecessary in GetByteValueFromPercentage
This commit is contained in:
parent
f21acbd767
commit
6f0711564c
@ -91,9 +91,8 @@ public static class FloatExtensions
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static byte GetByteValueFromPercentage(this float percentage)
|
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);
|
return (byte)(percentage >= 1.0f ? 255 : percentage * 256.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user