Skip to content

Commit bed45ee

Browse files
committed
Rename IColorBase to IColor
1 parent d891877 commit bed45ee

17 files changed

Lines changed: 130 additions & 127 deletions

File tree

AssetRipper.TextureDecoder.ColorGenerator/AssetRipper.TextureDecoder.ColorGenerator.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
</PropertyGroup>
6+
37
<ItemGroup>
48
<PackageReference Include="AssetRipper.Text.SourceGeneration" Version="1.1.0" />
59
</ItemGroup>

AssetRipper.TextureDecoder.ColorGenerator/Program.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private static void WriteCustomColor(IndentedTextWriter writer, string name, Typ
7676
writer.WriteLine($"public partial struct {name} : IColor<{typeName}>");
7777
using (new CurlyBrackets(writer))
7878
{
79-
WriteColorBaseStaticProperties(writer, hasRed, hasGreen, hasBlue, hasAlpha, fullyUtilized, typeName);
79+
WriteNonGenericStaticProperties(writer, hasRed, hasGreen, hasBlue, hasAlpha, fullyUtilized, typeName);
8080
writer.WriteLineNoTabs();
8181
WriteToString(writer, hasRed, hasGreen, hasBlue, hasAlpha);
8282
}
@@ -127,14 +127,14 @@ private static void WriteToString(IndentedTextWriter writer, bool hasRed, bool h
127127
}
128128
}
129129

130-
private static void WriteColorBaseStaticProperties(IndentedTextWriter writer, bool hasRed, bool hasGreen, bool hasBlue, bool hasAlpha, bool fullyUtilized, string typeName)
130+
private static void WriteNonGenericStaticProperties(IndentedTextWriter writer, bool hasRed, bool hasGreen, bool hasBlue, bool hasAlpha, bool fullyUtilized, string typeName)
131131
{
132-
writer.WriteLine($"static bool IColorBase.HasRedChannel => {hasRed.ToLowerString()};");
133-
writer.WriteLine($"static bool IColorBase.HasGreenChannel => {hasGreen.ToLowerString()};");
134-
writer.WriteLine($"static bool IColorBase.HasBlueChannel => {hasBlue.ToLowerString()};");
135-
writer.WriteLine($"static bool IColorBase.HasAlphaChannel => {hasAlpha.ToLowerString()};");
136-
writer.WriteLine($"static bool IColorBase.ChannelsAreFullyUtilized => {fullyUtilized.ToLowerString()};");
137-
writer.WriteLine($"static Type IColorBase.ChannelType => typeof({typeName});");
132+
writer.WriteLine($"static bool IColor.HasRedChannel => {hasRed.ToLowerString()};");
133+
writer.WriteLine($"static bool IColor.HasGreenChannel => {hasGreen.ToLowerString()};");
134+
writer.WriteLine($"static bool IColor.HasBlueChannel => {hasBlue.ToLowerString()};");
135+
writer.WriteLine($"static bool IColor.HasAlphaChannel => {hasAlpha.ToLowerString()};");
136+
writer.WriteLine($"static bool IColor.ChannelsAreFullyUtilized => {fullyUtilized.ToLowerString()};");
137+
writer.WriteLine($"static Type IColor.ChannelType => typeof({typeName});");
138138
}
139139

140140
private static void WriteGenericColor(IndentedTextWriter writer, string name, bool hasRed, bool hasGreen, bool hasBlue, bool hasAlpha)
@@ -170,7 +170,7 @@ private static void WriteGenericColor(IndentedTextWriter writer, string name, bo
170170
writer.WriteLineNoTabs();
171171
WriteSetChannels(writer, typeName, hasRed, hasGreen, hasBlue, hasAlpha);
172172
writer.WriteLineNoTabs();
173-
WriteColorBaseStaticProperties(writer, hasRed, hasGreen, hasBlue, hasAlpha, true, typeName);
173+
WriteNonGenericStaticProperties(writer, hasRed, hasGreen, hasBlue, hasAlpha, true, typeName);
174174
writer.WriteLineNoTabs();
175175
WriteToString(writer, hasRed, hasGreen, hasBlue, hasAlpha);
176176
}

AssetRipper.TextureDecoder.TestGenerator/GenerationData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ internal readonly struct GenerationData
2121

2222
public string ChannelTypeName => CSharpPrimitives.Dictionary[ChannelType].LangName;
2323

24-
public static GenerationData Create<T>(int colorSize) where T : IColorBase
24+
public static GenerationData Create<T>(int colorSize) where T : IColor
2525
{
2626
return new GenerationData()
2727
{

AssetRipper.TextureDecoder/Rgb/Color.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ internal static void SetConvertedChannels<TThis, TThisChannel, TSourceChannel>(t
6868
}
6969

7070
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
71-
public static int GetChannelCount<T>() where T : IColorBase
71+
public static int GetChannelCount<T>() where T : IColor
7272
{
7373
return (T.HasRedChannel ? 1 : 0) + (T.HasGreenChannel ? 1 : 0) + (T.HasBlueChannel ? 1 : 0) + (T.HasAlphaChannel ? 1 : 0);
7474
}

AssetRipper.TextureDecoder/Rgb/Formats/ColorA.g.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ public void SetChannels(T r, T g, T b, T a)
4242
A = a;
4343
}
4444

45-
static bool IColorBase.HasRedChannel => false;
46-
static bool IColorBase.HasGreenChannel => false;
47-
static bool IColorBase.HasBlueChannel => false;
48-
static bool IColorBase.HasAlphaChannel => true;
49-
static bool IColorBase.ChannelsAreFullyUtilized => true;
50-
static Type IColorBase.ChannelType => typeof(T);
45+
static bool IColor.HasRedChannel => false;
46+
static bool IColor.HasGreenChannel => false;
47+
static bool IColor.HasBlueChannel => false;
48+
static bool IColor.HasAlphaChannel => true;
49+
static bool IColor.ChannelsAreFullyUtilized => true;
50+
static Type IColor.ChannelType => typeof(T);
5151

5252
public override string ToString()
5353
{

AssetRipper.TextureDecoder/Rgb/Formats/ColorARGB16.g.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ namespace AssetRipper.TextureDecoder.Rgb.Formats
44
{
55
public partial struct ColorARGB16 : IColor<byte>
66
{
7-
static bool IColorBase.HasRedChannel => true;
8-
static bool IColorBase.HasGreenChannel => true;
9-
static bool IColorBase.HasBlueChannel => true;
10-
static bool IColorBase.HasAlphaChannel => true;
11-
static bool IColorBase.ChannelsAreFullyUtilized => false;
12-
static Type IColorBase.ChannelType => typeof(byte);
7+
static bool IColor.HasRedChannel => true;
8+
static bool IColor.HasGreenChannel => true;
9+
static bool IColor.HasBlueChannel => true;
10+
static bool IColor.HasAlphaChannel => true;
11+
static bool IColor.ChannelsAreFullyUtilized => false;
12+
static Type IColor.ChannelType => typeof(byte);
1313

1414
public override string ToString()
1515
{

AssetRipper.TextureDecoder/Rgb/Formats/ColorARGB32.g.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ namespace AssetRipper.TextureDecoder.Rgb.Formats
44
{
55
public partial struct ColorARGB32 : IColor<byte>
66
{
7-
static bool IColorBase.HasRedChannel => true;
8-
static bool IColorBase.HasGreenChannel => true;
9-
static bool IColorBase.HasBlueChannel => true;
10-
static bool IColorBase.HasAlphaChannel => true;
11-
static bool IColorBase.ChannelsAreFullyUtilized => true;
12-
static Type IColorBase.ChannelType => typeof(byte);
7+
static bool IColor.HasRedChannel => true;
8+
static bool IColor.HasGreenChannel => true;
9+
static bool IColor.HasBlueChannel => true;
10+
static bool IColor.HasAlphaChannel => true;
11+
static bool IColor.ChannelsAreFullyUtilized => true;
12+
static Type IColor.ChannelType => typeof(byte);
1313

1414
public override string ToString()
1515
{

AssetRipper.TextureDecoder/Rgb/Formats/ColorBGRA32.g.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ namespace AssetRipper.TextureDecoder.Rgb.Formats
44
{
55
public partial struct ColorBGRA32 : IColor<byte>
66
{
7-
static bool IColorBase.HasRedChannel => true;
8-
static bool IColorBase.HasGreenChannel => true;
9-
static bool IColorBase.HasBlueChannel => true;
10-
static bool IColorBase.HasAlphaChannel => true;
11-
static bool IColorBase.ChannelsAreFullyUtilized => true;
12-
static Type IColorBase.ChannelType => typeof(byte);
7+
static bool IColor.HasRedChannel => true;
8+
static bool IColor.HasGreenChannel => true;
9+
static bool IColor.HasBlueChannel => true;
10+
static bool IColor.HasAlphaChannel => true;
11+
static bool IColor.ChannelsAreFullyUtilized => true;
12+
static Type IColor.ChannelType => typeof(byte);
1313

1414
public override string ToString()
1515
{

AssetRipper.TextureDecoder/Rgb/Formats/ColorR.g.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ public void SetChannels(T r, T g, T b, T a)
4242
R = r;
4343
}
4444

45-
static bool IColorBase.HasRedChannel => true;
46-
static bool IColorBase.HasGreenChannel => false;
47-
static bool IColorBase.HasBlueChannel => false;
48-
static bool IColorBase.HasAlphaChannel => false;
49-
static bool IColorBase.ChannelsAreFullyUtilized => true;
50-
static Type IColorBase.ChannelType => typeof(T);
45+
static bool IColor.HasRedChannel => true;
46+
static bool IColor.HasGreenChannel => false;
47+
static bool IColor.HasBlueChannel => false;
48+
static bool IColor.HasAlphaChannel => false;
49+
static bool IColor.ChannelsAreFullyUtilized => true;
50+
static Type IColor.ChannelType => typeof(T);
5151

5252
public override string ToString()
5353
{

AssetRipper.TextureDecoder/Rgb/Formats/ColorRG.g.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ public void SetChannels(T r, T g, T b, T a)
4040
G = g;
4141
}
4242

43-
static bool IColorBase.HasRedChannel => true;
44-
static bool IColorBase.HasGreenChannel => true;
45-
static bool IColorBase.HasBlueChannel => false;
46-
static bool IColorBase.HasAlphaChannel => false;
47-
static bool IColorBase.ChannelsAreFullyUtilized => true;
48-
static Type IColorBase.ChannelType => typeof(T);
43+
static bool IColor.HasRedChannel => true;
44+
static bool IColor.HasGreenChannel => true;
45+
static bool IColor.HasBlueChannel => false;
46+
static bool IColor.HasAlphaChannel => false;
47+
static bool IColor.ChannelsAreFullyUtilized => true;
48+
static Type IColor.ChannelType => typeof(T);
4949

5050
public override string ToString()
5151
{

0 commit comments

Comments
 (0)