Skip to content

Commit 46a7f96

Browse files
committed
Update ImageSharp to 2.1.3
Drop netstandard1.3 and net472
1 parent 50f3ff8 commit 46a7f96

35 files changed

+206
-218
lines changed

.github/workflows/build-and-test.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,6 @@ jobs:
4242
framework: netcoreapp2.1
4343
runtime: -x64
4444
codecov: false
45-
- os: windows-latest
46-
framework: net472
47-
runtime: -x64
48-
codecov: false
49-
- os: windows-latest
50-
framework: net472
51-
runtime: -x86
52-
codecov: false
5345

5446
runs-on: ${{matrix.options.os}}
5547
if: "!contains(github.event.head_commit.message, '[skip ci]')"

src/ImageSharp.Textures/Common/Extensions/StreamExtensions.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ public static void Skip(this Stream stream, int count)
5555
}
5656
}
5757

58-
public static void Read(this Stream stream, IManagedByteBuffer buffer) => stream.Read(buffer.Array, 0, buffer.Memory.Length);
59-
60-
public static void Write(this Stream stream, IManagedByteBuffer buffer) => stream.Write(buffer.Array, 0, buffer.Memory.Length);
61-
6258
#if NET472 || NETSTANDARD1_3 || NETSTANDARD2_0
6359
// This is a port of the CoreFX implementation and is MIT Licensed: https://github.com/dotnet/coreclr/blob/c4dca1072d15bdda64c754ad1ea474b1580fa554/src/System.Private.CoreLib/shared/System/IO/Stream.cs#L770
6460
public static void Write(this Stream stream, ReadOnlySpan<byte> buffer)

src/ImageSharp.Textures/Configuration.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ public sealed class Configuration
2020
/// <summary>
2121
/// A lazily initialized configuration default instance.
2222
/// </summary>
23-
private static readonly Lazy<Configuration> Lazy = new Lazy<Configuration>(CreateDefaultInstance);
23+
private static readonly Lazy<Configuration> Lazy = new(CreateDefaultInstance);
2424

2525
private int maxDegreeOfParallelism = Environment.ProcessorCount;
2626

27+
private MemoryAllocator memoryAllocator = MemoryAllocator.Default;
28+
2729
/// <summary>
2830
/// Initializes a new instance of the <see cref="Configuration" /> class.
2931
/// </summary>
@@ -83,12 +85,20 @@ public int MaxDegreeOfParallelism
8385
/// <summary>
8486
/// Gets or sets the <see cref="TextureFormatManager"/> that is currently in use.
8587
/// </summary>
86-
public TextureFormatManager ImageFormatsManager { get; set; } = new TextureFormatManager();
88+
public TextureFormatManager ImageFormatsManager { get; set; } = new();
8789

8890
/// <summary>
8991
/// Gets or sets the <see cref="MemoryAllocator"/> that is currently in use.
9092
/// </summary>
91-
public MemoryAllocator MemoryAllocator { get; set; } = ArrayPoolMemoryAllocator.CreateDefault();
93+
public MemoryAllocator MemoryAllocator
94+
{
95+
get => this.memoryAllocator;
96+
set
97+
{
98+
Guard.NotNull(value, nameof(this.MemoryAllocator));
99+
this.memoryAllocator = value;
100+
}
101+
}
92102

93103
/// <summary>
94104
/// Gets the maximum header size of all the formats.
@@ -123,7 +133,7 @@ public void Configure(IConfigurationModule configuration)
123133
/// Creates a shallow copy of the <see cref="Configuration"/>.
124134
/// </summary>
125135
/// <returns>A new configuration instance.</returns>
126-
public Configuration Clone() => new Configuration
136+
public Configuration Clone() => new()
127137
{
128138
MaxDegreeOfParallelism = this.MaxDegreeOfParallelism,
129139
ImageFormatsManager = this.ImageFormatsManager,
@@ -138,7 +148,7 @@ public void Configure(IConfigurationModule configuration)
138148
/// <see cref="DdsConfigurationModule"/>
139149
/// </summary>
140150
/// <returns>The default configuration of <see cref="Configuration"/>.</returns>
141-
internal static Configuration CreateDefaultInstance() => new Configuration(
151+
internal static Configuration CreateDefaultInstance() => new(
142152
new DdsConfigurationModule(),
143153
new KtxConfigurationModule(),
144154
new Ktx2ConfigurationModule());

src/ImageSharp.Textures/ImageSharp.Textures.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
<Choose>
1818
<When Condition="$(SIXLABORS_TESTING) == true">
1919
<PropertyGroup>
20-
<TargetFrameworks>net5.0;netcoreapp3.1;netcoreapp2.1;netstandard2.1;netstandard2.0;netstandard1.3;net472</TargetFrameworks>
20+
<TargetFrameworks>net5.0;netcoreapp3.1;netcoreapp2.1;netstandard2.1;netstandard2.0</TargetFrameworks>
2121
</PropertyGroup>
2222
</When>
2323
<Otherwise>
2424
<PropertyGroup>
25-
<TargetFrameworks>netcoreapp3.1;netcoreapp2.1;netstandard2.1;netstandard2.0;netstandard1.3;net472</TargetFrameworks>
25+
<TargetFrameworks>netcoreapp3.1;netcoreapp2.1;netstandard2.1;netstandard2.0</TargetFrameworks>
2626
</PropertyGroup>
2727
</Otherwise>
2828
</Choose>
@@ -32,7 +32,7 @@
3232
</ItemGroup>
3333

3434
<ItemGroup>
35-
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.4" />
35+
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" />
3636

3737
<!--TODO: Upgrade version in ImageSharp-->
3838
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />

src/ImageSharp.Textures/PixelFormats/Ayuv.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public override readonly string ToString()
4141

4242
/// <inheritdoc/>
4343
[MethodImpl(MethodImplOptions.AggressiveInlining)]
44-
public PixelOperations<Ayuv> CreatePixelOperations() => new PixelOperations<Ayuv>();
44+
public PixelOperations<Ayuv> CreatePixelOperations() => new();
4545

4646
/// <inheritdoc/>
4747
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -56,6 +56,8 @@ public override readonly string ToString()
5656
/// <inheritdoc/>
5757
public void FromBgra32(Bgra32 source) => throw new NotImplementedException();
5858

59+
public void FromAbgr32(Abgr32 source) => throw new NotImplementedException();
60+
5961
/// <inheritdoc/>
6062
public void FromBgra5551(Bgra5551 source) => throw new NotImplementedException();
6163

src/ImageSharp.Textures/PixelFormats/Fp32.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public Fp32(float x)
3232
public float PackedValue { get; set; }
3333

3434
/// <inheritdoc />
35-
public PixelOperations<Fp32> CreatePixelOperations() => new PixelOperations<Fp32>();
35+
public PixelOperations<Fp32> CreatePixelOperations() => new();
3636

3737
/// <inheritdoc/>
3838
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -48,7 +48,7 @@ public Fp32(float x)
4848

4949
/// <inheritdoc />
5050
[MethodImpl(MethodImplOptions.AggressiveInlining)]
51-
public Vector4 ToVector4() => new Vector4(this.PackedValue);
51+
public Vector4 ToVector4() => new(this.PackedValue);
5252

5353
/// <inheritdoc />
5454
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -62,6 +62,10 @@ public Fp32(float x)
6262
[MethodImpl(MethodImplOptions.AggressiveInlining)]
6363
public void FromBgra32(Bgra32 source) => this.FromScaledVector4(source.ToScaledVector4());
6464

65+
/// <inheritdoc />
66+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
67+
public void FromAbgr32(Abgr32 source) => this.FromScaledVector4(source.ToScaledVector4());
68+
6569
/// <inheritdoc />
6670
[MethodImpl(MethodImplOptions.AggressiveInlining)]
6771
public void FromBgra5551(Bgra5551 source) => this.FromScaledVector4(source.ToScaledVector4());

src/ImageSharp.Textures/PixelFormats/Generated/Bgr32.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public Bgr32(float x, float y, float z)
6262
public static bool operator !=(Bgr32 left, Bgr32 right) => !left.Equals(right);
6363

6464
/// <inheritdoc />
65-
public PixelOperations<Bgr32> CreatePixelOperations() => new PixelOperations<Bgr32>();
65+
public PixelOperations<Bgr32> CreatePixelOperations() => new();
6666

6767
/// <inheritdoc/>
6868
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -82,14 +82,11 @@ public void FromVector4(Vector4 vector)
8282

8383
/// <inheritdoc />
8484
[MethodImpl(MethodImplOptions.AggressiveInlining)]
85-
public Vector4 ToVector4()
86-
{
87-
return new Vector4(
85+
public Vector4 ToVector4() => new(
8886
((this.PackedValue >> 16) & 255) / 255F,
8987
((this.PackedValue >> 8) & 255) / 255F,
9088
(this.PackedValue & 255) / 255F,
9189
1.0f);
92-
}
9390

9491
/// <inheritdoc />
9592
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -107,6 +104,10 @@ public Vector4 ToVector4()
107104
[MethodImpl(MethodImplOptions.AggressiveInlining)]
108105
public void FromBgra32(Bgra32 source) => this.FromScaledVector4(source.ToScaledVector4());
109106

107+
/// <inheritdoc />
108+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
109+
public void FromAbgr32(Abgr32 source) => this.FromScaledVector4(source.ToScaledVector4());
110+
110111
/// <inheritdoc/>
111112
[MethodImpl(MethodImplOptions.AggressiveInlining)]
112113
public void FromL8(L8 source) => this.FromScaledVector4(source.ToScaledVector4());
@@ -133,10 +134,7 @@ public Vector4 ToVector4()
133134

134135
/// <inheritdoc />
135136
[MethodImpl(MethodImplOptions.AggressiveInlining)]
136-
public void ToRgba32(ref Rgba32 dest)
137-
{
138-
dest.FromScaledVector4(this.ToScaledVector4());
139-
}
137+
public void ToRgba32(ref Rgba32 dest) => dest.FromScaledVector4(this.ToScaledVector4());
140138

141139
/// <inheritdoc/>
142140
[MethodImpl(MethodImplOptions.AggressiveInlining)]

src/ImageSharp.Textures/PixelFormats/Generated/Bgr555.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public Bgr555(float x, float y, float z)
6262
public static bool operator !=(Bgr555 left, Bgr555 right) => !left.Equals(right);
6363

6464
/// <inheritdoc />
65-
public PixelOperations<Bgr555> CreatePixelOperations() => new PixelOperations<Bgr555>();
65+
public PixelOperations<Bgr555> CreatePixelOperations() => new();
6666

6767
/// <inheritdoc/>
6868
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -82,14 +82,11 @@ public void FromVector4(Vector4 vector)
8282

8383
/// <inheritdoc />
8484
[MethodImpl(MethodImplOptions.AggressiveInlining)]
85-
public Vector4 ToVector4()
86-
{
87-
return new Vector4(
85+
public Vector4 ToVector4() => new(
8886
((this.PackedValue >> 10) & 31) / 31F,
8987
((this.PackedValue >> 5) & 31) / 31F,
9088
(this.PackedValue & 31) / 31F,
9189
1.0f);
92-
}
9390

9491
/// <inheritdoc />
9592
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -107,6 +104,10 @@ public Vector4 ToVector4()
107104
[MethodImpl(MethodImplOptions.AggressiveInlining)]
108105
public void FromBgra32(Bgra32 source) => this.FromScaledVector4(source.ToScaledVector4());
109106

107+
/// <inheritdoc />
108+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
109+
public void FromAbgr32(Abgr32 source) => this.FromScaledVector4(source.ToScaledVector4());
110+
110111
/// <inheritdoc/>
111112
[MethodImpl(MethodImplOptions.AggressiveInlining)]
112113
public void FromL8(L8 source) => this.FromScaledVector4(source.ToScaledVector4());
@@ -133,10 +134,7 @@ public Vector4 ToVector4()
133134

134135
/// <inheritdoc />
135136
[MethodImpl(MethodImplOptions.AggressiveInlining)]
136-
public void ToRgba32(ref Rgba32 dest)
137-
{
138-
dest.FromScaledVector4(this.ToScaledVector4());
139-
}
137+
public void ToRgba32(ref Rgba32 dest) => dest.FromScaledVector4(this.ToScaledVector4());
140138

141139
/// <inheritdoc/>
142140
[MethodImpl(MethodImplOptions.AggressiveInlining)]

src/ImageSharp.Textures/PixelFormats/Generated/D32_FLOAT_S8X24_UINT.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ public Vector4 ToVector4()
107107
[MethodImpl(MethodImplOptions.AggressiveInlining)]
108108
public void FromBgra32(Bgra32 source) => this.FromScaledVector4(source.ToScaledVector4());
109109

110+
/// <inheritdoc />
111+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
112+
public void FromAbgr32(Abgr32 source) => this.FromScaledVector4(source.ToScaledVector4());
113+
110114
/// <inheritdoc/>
111115
[MethodImpl(MethodImplOptions.AggressiveInlining)]
112116
public void FromL8(L8 source) => this.FromScaledVector4(source.ToScaledVector4());
@@ -133,10 +137,7 @@ public Vector4 ToVector4()
133137

134138
/// <inheritdoc />
135139
[MethodImpl(MethodImplOptions.AggressiveInlining)]
136-
public void ToRgba32(ref Rgba32 dest)
137-
{
138-
dest.FromScaledVector4(this.ToScaledVector4());
139-
}
140+
public void ToRgba32(ref Rgba32 dest) => dest.FromScaledVector4(this.ToScaledVector4());
140141

141142
/// <inheritdoc/>
142143
[MethodImpl(MethodImplOptions.AggressiveInlining)]

src/ImageSharp.Textures/PixelFormats/Generated/R11G11B10Float.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ public Vector4 ToVector4()
108108
[MethodImpl(MethodImplOptions.AggressiveInlining)]
109109
public void FromBgra32(Bgra32 source) => this.FromScaledVector4(source.ToScaledVector4());
110110

111+
/// <inheritdoc />
112+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
113+
public void FromAbgr32(Abgr32 source) => this.FromScaledVector4(source.ToScaledVector4());
114+
111115
/// <inheritdoc/>
112116
[MethodImpl(MethodImplOptions.AggressiveInlining)]
113117
public void FromL8(L8 source) => this.FromScaledVector4(source.ToScaledVector4());

0 commit comments

Comments
 (0)