mirror of
https://github.com/DarthAffe/HPPH.git
synced 2026-11-09 18:36:34 +00:00
Changed ColorFormat-ByteMapping to use constants
This commit is contained in:
1 parent
7a67f77168
commit
e34af1fbd3
8 files changed
+19
-21
No files matched your search
@@ -44,7 +44,7 @@ internal readonly struct ColorFormatData(string typeName, int bpp, char firstEnt
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Methods
|
||||
|
||||
private string CreateByteMapping()
|
||||
@@ -52,19 +52,19 @@ internal readonly struct ColorFormatData(string typeName, int bpp, char firstEnt
|
||||
string[] mapping = new string[Bpp];
|
||||
if (Bpp > 0)
|
||||
{
|
||||
mapping[0] = GetByteMappingIndex(FirstEntry).ToString();
|
||||
mapping[0] = "Color." + FirstEntry.ToUpper();
|
||||
|
||||
if (Bpp > 1)
|
||||
{
|
||||
mapping[1] = GetByteMappingIndex(SecondEntry).ToString();
|
||||
mapping[1] = "Color." + SecondEntry.ToUpper();
|
||||
|
||||
if (Bpp > 2)
|
||||
{
|
||||
mapping[2] = GetByteMappingIndex(ThirdEntry).ToString();
|
||||
mapping[2] = "Color." + ThirdEntry.ToUpper();
|
||||
|
||||
if (Bpp > 3)
|
||||
{
|
||||
mapping[3] = GetByteMappingIndex(FourthEntry).ToString();
|
||||
mapping[3] = "Color." + FourthEntry.ToUpper();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,15 +83,5 @@ internal readonly struct ColorFormatData(string typeName, int bpp, char firstEnt
|
||||
_ => string.Empty
|
||||
};
|
||||
|
||||
private static int GetByteMappingIndex(string entry)
|
||||
=> entry switch
|
||||
{
|
||||
"r" => 0,
|
||||
"g" => 1,
|
||||
"b" => 2,
|
||||
"a" => 3,
|
||||
_ => throw new IndexOutOfRangeException()
|
||||
};
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in new issue
Block a user