Skip to content

Commit 2fb6d7a

Browse files
committed
Use target type new
1 parent 085caa2 commit 2fb6d7a

File tree

626 files changed

+2786
-2792
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

626 files changed

+2786
-2792
lines changed

src/ImageSharp/Advanced/ParallelExecutionSettings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public ParallelExecutionSettings MultiplyMinimumPixelsPerTask(int multiplier)
7979
{
8080
Guard.MustBeGreaterThan(multiplier, 0, nameof(multiplier));
8181

82-
return new ParallelExecutionSettings(
82+
return new(
8383
this.MaxDegreeOfParallelism,
8484
this.MinimumPixelsProcessedPerTask * multiplier,
8585
this.MemoryAllocator);
@@ -92,6 +92,6 @@ public ParallelExecutionSettings MultiplyMinimumPixelsPerTask(int multiplier)
9292
/// <returns>The <see cref="ParallelExecutionSettings"/>.</returns>
9393
public static ParallelExecutionSettings FromConfiguration(Configuration configuration)
9494
{
95-
return new ParallelExecutionSettings(configuration.MaxDegreeOfParallelism, configuration.MemoryAllocator);
95+
return new(configuration.MaxDegreeOfParallelism, configuration.MemoryAllocator);
9696
}
9797
}

src/ImageSharp/Advanced/ParallelRowIterator.Wrappers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public void Invoke(int i)
139139
}
140140

141141
int yMax = Math.Min(yMin + this.stepY, this.maxY);
142-
RowInterval rows = new RowInterval(yMin, yMax);
142+
RowInterval rows = new(yMin, yMax);
143143

144144
// Skip the safety copy when invoking a potentially impure method on a readonly field
145145
Unsafe.AsRef(in this.operation).Invoke(in rows);

src/ImageSharp/Advanced/ParallelRowIterator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ public static void IterateRows<T>(
6565
}
6666

6767
int verticalStep = DivideCeil(rectangle.Height, numOfSteps);
68-
ParallelOptions? parallelOptions = new ParallelOptions { MaxDegreeOfParallelism = numOfSteps };
69-
RowOperationWrapper<T> wrappingOperation = new RowOperationWrapper<T>(top, bottom, verticalStep, in operation);
68+
ParallelOptions? parallelOptions = new() { MaxDegreeOfParallelism = numOfSteps };
69+
RowOperationWrapper<T> wrappingOperation = new(top, bottom, verticalStep, in operation);
7070

7171
Parallel.For(
7272
0,

src/ImageSharp/Color/Color.WebSafePalette.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace SixLabors.ImageSharp;
88
/// </content>
99
public partial struct Color
1010
{
11-
private static readonly Lazy<Color[]> WebSafePaletteLazy = new Lazy<Color[]>(CreateWebSafePalette, true);
11+
private static readonly Lazy<Color[]> WebSafePaletteLazy = new(CreateWebSafePalette, true);
1212

1313
/// <summary>
1414
/// Gets a collection of named, web safe colors as defined in the CSS Color Module Level 4.

src/ImageSharp/Color/Color.WernerPalette.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace SixLabors.ImageSharp;
88
/// </content>
99
public partial struct Color
1010
{
11-
private static readonly Lazy<Color[]> WernerPaletteLazy = new Lazy<Color[]>(CreateWernerPalette, true);
11+
private static readonly Lazy<Color[]> WernerPaletteLazy = new(CreateWernerPalette, true);
1212

1313
/// <summary>
1414
/// Gets a collection of colors as defined in the original second edition of Werner’s Nomenclature of Colours 1821.

src/ImageSharp/ColorProfiles/CieLab.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public static CieLab FromProfileConnectingSpace(ColorConversionOptions options,
103103
float a = 500F * (fx - fy);
104104
float b = 200F * (fy - fz);
105105

106-
return new CieLab(l, a, b);
106+
return new(l, a, b);
107107
}
108108

109109
/// <inheritdoc/>

src/ImageSharp/ColorProfiles/CieLch.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace SixLabors.ImageSharp.ColorProfiles;
2525
/// <param name="h">The hue in degrees.</param>
2626
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2727
public CieLch(float l, float c, float h)
28-
: this(new Vector3(l, c, h))
28+
: this(new(l, c, h))
2929
{
3030
}
3131

@@ -101,7 +101,7 @@ public static CieLch FromProfileConnectingSpace(ColorConversionOptions options,
101101
hDegrees += 360;
102102
}
103103

104-
return new CieLch(l, c, hDegrees);
104+
return new(l, c, hDegrees);
105105
}
106106

107107
/// <inheritdoc/>
@@ -127,7 +127,7 @@ public CieLab ToProfileConnectingSpace(ColorConversionOptions options)
127127
float a = c * MathF.Cos(hRadians);
128128
float b = c * MathF.Sin(hRadians);
129129

130-
return new CieLab(l, a, b);
130+
return new(l, a, b);
131131
}
132132

133133
/// <inheritdoc/>

src/ImageSharp/ColorProfiles/CieLchuv.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace SixLabors.ImageSharp.ColorProfiles;
2525
/// <param name="h">The hue in degrees.</param>
2626
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2727
public CieLchuv(float l, float c, float h)
28-
: this(new Vector3(l, c, h))
28+
: this(new(l, c, h))
2929
{
3030
}
3131

@@ -102,7 +102,7 @@ public static CieLchuv FromProfileConnectingSpace(ColorConversionOptions options
102102
hDegrees += 360;
103103
}
104104

105-
return new CieLchuv(l, c, hDegrees);
105+
return new(l, c, hDegrees);
106106
}
107107

108108
/// <inheritdoc/>

src/ImageSharp/ColorProfiles/CieLuv.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public static CieLuv FromProfileConnectingSpace(ColorConversionOptions options,
123123
v = 0;
124124
}
125125

126-
return new CieLuv((float)l, (float)u, (float)v);
126+
return new((float)l, (float)u, (float)v);
127127
}
128128

129129
/// <inheritdoc/>
@@ -177,7 +177,7 @@ public CieXyz ToProfileConnectingSpace(ColorConversionOptions options)
177177
z = 0;
178178
}
179179

180-
return new CieXyz((float)x, (float)y, (float)z);
180+
return new((float)x, (float)y, (float)z);
181181
}
182182

183183
/// <inheritdoc/>

src/ImageSharp/ColorProfiles/CieXyy.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ public static CieXyy FromProfileConnectingSpace(ColorConversionOptions options,
9191

9292
if (float.IsNaN(x) || float.IsNaN(y))
9393
{
94-
return new CieXyy(0, 0, source.Y);
94+
return new(0, 0, source.Y);
9595
}
9696

97-
return new CieXyy(x, y, source.Y);
97+
return new(x, y, source.Y);
9898
}
9999

100100
/// <inheritdoc/>
@@ -113,14 +113,14 @@ public CieXyz ToProfileConnectingSpace(ColorConversionOptions options)
113113
{
114114
if (MathF.Abs(this.Y) < Constants.Epsilon)
115115
{
116-
return new CieXyz(0, 0, this.Yl);
116+
return new(0, 0, this.Yl);
117117
}
118118

119119
float x = (this.X * this.Yl) / this.Y;
120120
float y = this.Yl;
121121
float z = ((1 - this.X - this.Y) * y) / this.Y;
122122

123-
return new CieXyz(x, y, z);
123+
return new(x, y, z);
124124
}
125125

126126
/// <inheritdoc/>

0 commit comments

Comments
 (0)