diff --git a/.gitattributes b/.gitattributes
index 3647a7063d..b5f742ab47 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -133,3 +133,6 @@
*.pnm filter=lfs diff=lfs merge=lfs -text
*.wbmp filter=lfs diff=lfs merge=lfs -text
*.exr filter=lfs diff=lfs merge=lfs -text
+*.ico filter=lfs diff=lfs merge=lfs -text
+*.cur filter=lfs diff=lfs merge=lfs -text
+*.ani filter=lfs diff=lfs merge=lfs -text
diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
index b375574018..7c7791347d 100644
--- a/.github/workflows/build-and-test.yml
+++ b/.github/workflows/build-and-test.yml
@@ -19,42 +19,23 @@ jobs:
- ${{ contains(github.event.pull_request.labels.*.name, 'arch:arm32') || contains(github.event.pull_request.labels.*.name, 'arch:arm64') }}
options:
- os: ubuntu-latest
- framework: net7.0
- sdk: 7.0.x
- sdk-preview: true
+ framework: net8.0
+ sdk: 8.0.x
runtime: -x64
codecov: false
- os: macos-latest
- framework: net7.0
- sdk: 7.0.x
- sdk-preview: true
+ framework: net8.0
+ sdk: 8.0.x
runtime: -x64
codecov: false
- os: windows-latest
- framework: net7.0
- sdk: 7.0.x
- sdk-preview: true
+ framework: net8.0
+ sdk: 8.0.x
runtime: -x64
codecov: false
- os: buildjet-4vcpu-ubuntu-2204-arm
- framework: net7.0
- sdk: 7.0.x
- sdk-preview: true
- runtime: -x64
- codecov: false
- - os: ubuntu-latest
- framework: net6.0
- sdk: 6.0.x
- runtime: -x64
- codecov: false
- - os: macos-latest
- framework: net6.0
- sdk: 6.0.x
- runtime: -x64
- codecov: false
- - os: windows-latest
- framework: net6.0
- sdk: 6.0.x
+ framework: net8.0
+ sdk: 8.0.x
runtime: -x64
codecov: false
exclude:
@@ -111,14 +92,14 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
- 6.0.x
+ 8.0.x
- name: DotNet Setup Preview
if: ${{ matrix.options.sdk-preview == true }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
- 7.0.x
+ 8.0.x
- name: DotNet Build
if: ${{ matrix.options.sdk-preview != true }}
diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml
index e551afbd6d..7624e86b67 100644
--- a/.github/workflows/code-coverage.yml
+++ b/.github/workflows/code-coverage.yml
@@ -10,7 +10,7 @@ jobs:
matrix:
options:
- os: ubuntu-latest
- framework: net6.0
+ framework: net8.0
runtime: -x64
codecov: true
@@ -58,7 +58,7 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
- 6.0.x
+ 8.0.x
- name: DotNet Build
shell: pwsh
diff --git a/README.md b/README.md
index fa51d57cdf..cf58b6b14b 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@ Designed to simplify image processing, ImageSharp brings you an incredibly power
ImageSharp is designed from the ground up to be flexible and extensible. The library provides API endpoints for common image processing operations and the building blocks to allow for the development of additional operations.
-Built against [.NET 6](https://docs.microsoft.com/en-us/dotnet/standard/net-standard), ImageSharp can be used in device, cloud, and embedded/IoT scenarios.
+Built against [.NET 8](https://docs.microsoft.com/en-us/dotnet/standard/net-standard), ImageSharp can be used in device, cloud, and embedded/IoT scenarios.
## License
@@ -64,7 +64,7 @@ If you prefer, you can compile ImageSharp yourself (please do and help!)
- Using [Visual Studio 2022](https://visualstudio.microsoft.com/vs/)
- Make sure you have the latest version installed
- - Make sure you have [the .NET 7 SDK](https://www.microsoft.com/net/core#windows) installed
+ - Make sure you have [the .NET 8 SDK](https://www.microsoft.com/net/core#windows) installed
Alternatively, you can work from command line and/or with a lightweight editor on **both Linux/Unix and Windows**:
diff --git a/shared-infrastructure b/shared-infrastructure
index 353b9afe32..1c526a97ee 160000
--- a/shared-infrastructure
+++ b/shared-infrastructure
@@ -1 +1 @@
-Subproject commit 353b9afe32a8000410312d17263407cd7bb82d19
+Subproject commit 1c526a97eea8bcbc7c79de095676f7fb975a9fb1
diff --git a/src/ImageSharp.ruleset b/src/ImageSharp.ruleset
index e88c43f838..d7a147df03 100644
--- a/src/ImageSharp.ruleset
+++ b/src/ImageSharp.ruleset
@@ -4,4 +4,4 @@
-
\ No newline at end of file
+
diff --git a/src/ImageSharp/Advanced/ParallelRowIterator.Wrappers.cs b/src/ImageSharp/Advanced/ParallelRowIterator.Wrappers.cs
index 9629b0097e..a959faa3b6 100644
--- a/src/ImageSharp/Advanced/ParallelRowIterator.Wrappers.cs
+++ b/src/ImageSharp/Advanced/ParallelRowIterator.Wrappers.cs
@@ -51,7 +51,7 @@ public static partial class ParallelRowIterator
for (int y = yMin; y < yMax; y++)
{
// Skip the safety copy when invoking a potentially impure method on a readonly field
- Unsafe.AsRef(this.action).Invoke(y);
+ Unsafe.AsRef(in this.action).Invoke(y);
}
}
}
@@ -102,7 +102,7 @@ public static partial class ParallelRowIterator
for (int y = yMin; y < yMax; y++)
{
- Unsafe.AsRef(this.action).Invoke(y, span);
+ Unsafe.AsRef(in this.action).Invoke(y, span);
}
}
}
diff --git a/src/ImageSharp/Advanced/ParallelRowIterator.cs b/src/ImageSharp/Advanced/ParallelRowIterator.cs
index 657654a84b..1284a3a898 100644
--- a/src/ImageSharp/Advanced/ParallelRowIterator.cs
+++ b/src/ImageSharp/Advanced/ParallelRowIterator.cs
@@ -58,7 +58,7 @@ public static partial class ParallelRowIterator
{
for (int y = top; y < bottom; y++)
{
- Unsafe.AsRef(operation).Invoke(y);
+ Unsafe.AsRef(in operation).Invoke(y);
}
return;
@@ -118,7 +118,7 @@ public static partial class ParallelRowIterator
int maxSteps = DivideCeil(width * (long)height, parallelSettings.MinimumPixelsProcessedPerTask);
int numOfSteps = Math.Min(parallelSettings.MaxDegreeOfParallelism, maxSteps);
MemoryAllocator allocator = parallelSettings.MemoryAllocator;
- int bufferLength = Unsafe.AsRef(operation).GetRequiredBufferLength(rectangle);
+ int bufferLength = Unsafe.AsRef(in operation).GetRequiredBufferLength(rectangle);
// Avoid TPL overhead in this trivial case:
if (numOfSteps == 1)
@@ -128,7 +128,7 @@ public static partial class ParallelRowIterator
for (int y = top; y < bottom; y++)
{
- Unsafe.AsRef(operation).Invoke(y, span);
+ Unsafe.AsRef(in operation).Invoke(y, span);
}
return;
@@ -245,7 +245,7 @@ public static partial class ParallelRowIterator
int maxSteps = DivideCeil(width * (long)height, parallelSettings.MinimumPixelsProcessedPerTask);
int numOfSteps = Math.Min(parallelSettings.MaxDegreeOfParallelism, maxSteps);
MemoryAllocator allocator = parallelSettings.MemoryAllocator;
- int bufferLength = Unsafe.AsRef(operation).GetRequiredBufferLength(rectangle);
+ int bufferLength = Unsafe.AsRef(in operation).GetRequiredBufferLength(rectangle);
// Avoid TPL overhead in this trivial case:
if (numOfSteps == 1)
@@ -253,7 +253,7 @@ public static partial class ParallelRowIterator
var rows = new RowInterval(top, bottom);
using IMemoryOwner buffer = allocator.Allocate(bufferLength);
- Unsafe.AsRef(operation).Invoke(in rows, buffer.Memory.Span);
+ Unsafe.AsRef(in operation).Invoke(in rows, buffer.Memory.Span);
return;
}
diff --git a/src/ImageSharp/Common/Helpers/DebugGuard.cs b/src/ImageSharp/Common/Helpers/DebugGuard.cs
index be2daa139e..990b21c99e 100644
--- a/src/ImageSharp/Common/Helpers/DebugGuard.cs
+++ b/src/ImageSharp/Common/Helpers/DebugGuard.cs
@@ -33,10 +33,12 @@ internal static partial class DebugGuard
[Conditional("DEBUG")]
public static void NotDisposed(bool isDisposed, string objectName)
{
+#pragma warning disable CA1513
if (isDisposed)
{
throw new ObjectDisposedException(objectName);
}
+#pragma warning restore CA1513
}
///
diff --git a/src/ImageSharp/Common/Helpers/Numerics.cs b/src/ImageSharp/Common/Helpers/Numerics.cs
index aba3c0abdc..293997c4de 100644
--- a/src/ImageSharp/Common/Helpers/Numerics.cs
+++ b/src/ImageSharp/Common/Helpers/Numerics.cs
@@ -908,25 +908,6 @@ internal static class Numerics
return Sse2.ConvertToInt32(vsum);
}
- ///
- /// Reduces elements of the vector into one sum.
- ///
- /// The accumulator to reduce.
- /// The sum of all elements.
- [MethodImpl(InliningOptions.ShortMethod)]
- public static int ReduceSumArm(Vector128 accumulator)
- {
- if (AdvSimd.Arm64.IsSupported)
- {
- Vector64 sum = AdvSimd.Arm64.AddAcross(accumulator);
- return (int)AdvSimd.Extract(sum, 0);
- }
-
- Vector128 sum2 = AdvSimd.AddPairwiseWidening(accumulator);
- Vector64 sum3 = AdvSimd.Add(sum2.GetLower().AsUInt32(), sum2.GetUpper().AsUInt32());
- return (int)AdvSimd.Extract(sum3, 0);
- }
-
///
/// Reduces even elements of the vector into one sum.
///
diff --git a/src/ImageSharp/Common/Helpers/SimdUtils.HwIntrinsics.cs b/src/ImageSharp/Common/Helpers/SimdUtils.HwIntrinsics.cs
index fc58ef3440..ad079b52e9 100644
--- a/src/ImageSharp/Common/Helpers/SimdUtils.HwIntrinsics.cs
+++ b/src/ImageSharp/Common/Helpers/SimdUtils.HwIntrinsics.cs
@@ -1,6 +1,7 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
+using System.Diagnostics.CodeAnalysis;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -59,7 +60,7 @@ internal static partial class SimdUtils
public static void Shuffle4Reduce(
ref ReadOnlySpan source,
ref Span dest,
- byte control)
+ [ConstantExpected] byte control)
{
if (Avx.IsSupported || Sse.IsSupported)
{
@@ -218,7 +219,7 @@ internal static partial class SimdUtils
private static void Shuffle4(
ReadOnlySpan source,
Span dest,
- byte control)
+ [ConstantExpected] byte control)
{
if (Avx.IsSupported)
{
diff --git a/src/ImageSharp/Common/Helpers/SimdUtils.Shuffle.cs b/src/ImageSharp/Common/Helpers/SimdUtils.Shuffle.cs
index c1437c05e6..83cd3d246c 100644
--- a/src/ImageSharp/Common/Helpers/SimdUtils.Shuffle.cs
+++ b/src/ImageSharp/Common/Helpers/SimdUtils.Shuffle.cs
@@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License.
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -20,7 +21,7 @@ internal static partial class SimdUtils
public static void Shuffle4(
ReadOnlySpan source,
Span dest,
- byte control)
+ [ConstantExpected] byte control)
{
VerifyShuffle4SpanInput(source, dest);
diff --git a/src/ImageSharp/Configuration.cs b/src/ImageSharp/Configuration.cs
index 39fcef9c40..1ca5d0a46b 100644
--- a/src/ImageSharp/Configuration.cs
+++ b/src/ImageSharp/Configuration.cs
@@ -87,10 +87,7 @@ public sealed class Configuration
get => this.streamProcessingBufferSize;
set
{
- if (value <= 0)
- {
- throw new ArgumentOutOfRangeException(nameof(this.StreamProcessingBufferSize));
- }
+ ArgumentOutOfRangeException.ThrowIfNegativeOrZero(value);
this.streamProcessingBufferSize = value;
}
diff --git a/src/ImageSharp/Diagnostics/CodeAnalysis/UnscopedRefAttribute.cs b/src/ImageSharp/Diagnostics/CodeAnalysis/UnscopedRefAttribute.cs
deleted file mode 100644
index dc2c7bd196..0000000000
--- a/src/ImageSharp/Diagnostics/CodeAnalysis/UnscopedRefAttribute.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) Six Labors.
-// Licensed under the Six Labors Split License.
-#if NET6_0
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-namespace System.Diagnostics.CodeAnalysis
-{
- ///
- /// Used to indicate a byref escapes and is not scoped.
- ///
- ///
- ///
- /// There are several cases where the C# compiler treats a as implicitly
- /// - where the compiler does not allow the to escape the method.
- ///
- ///
- /// For example:
- ///
- /// - for instance methods.
- /// - parameters that refer to types.
- /// - parameters.
- ///
- ///
- ///
- /// This attribute is used in those instances where the should be allowed to escape.
- ///
- ///
- /// Applying this attribute, in any form, has impact on consumers of the applicable API. It is necessary for
- /// API authors to understand the lifetime implications of applying this attribute and how it may impact their users.
- ///
- ///
- [global::System.AttributeUsage(
- global::System.AttributeTargets.Method |
- global::System.AttributeTargets.Property |
- global::System.AttributeTargets.Parameter,
- AllowMultiple = false,
- Inherited = false)]
- internal sealed class UnscopedRefAttribute : global::System.Attribute
- {
- }
-}
-#endif
diff --git a/src/ImageSharp/Formats/AnimatedImageFrameMetadata.cs b/src/ImageSharp/Formats/AnimatedImageFrameMetadata.cs
index 5f4015180b..75595e1f7d 100644
--- a/src/ImageSharp/Formats/AnimatedImageFrameMetadata.cs
+++ b/src/ImageSharp/Formats/AnimatedImageFrameMetadata.cs
@@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License.
namespace SixLabors.ImageSharp.Formats;
+
internal class AnimatedImageFrameMetadata
{
///
diff --git a/src/ImageSharp/Formats/AnimatedImageMetadata.cs b/src/ImageSharp/Formats/AnimatedImageMetadata.cs
index d89ec41f07..ac3ca29f4f 100644
--- a/src/ImageSharp/Formats/AnimatedImageMetadata.cs
+++ b/src/ImageSharp/Formats/AnimatedImageMetadata.cs
@@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License.
namespace SixLabors.ImageSharp.Formats;
+
internal class AnimatedImageMetadata
{
///
diff --git a/src/ImageSharp/Formats/ImageFormatManager.cs b/src/ImageSharp/Formats/ImageFormatManager.cs
index 0ee4bc79b9..b6b5f87797 100644
--- a/src/ImageSharp/Formats/ImageFormatManager.cs
+++ b/src/ImageSharp/Formats/ImageFormatManager.cs
@@ -83,10 +83,7 @@ public class ImageFormatManager
lock (HashLock)
{
- if (!this.imageFormats.Contains(format))
- {
- this.imageFormats.Add(format);
- }
+ this.imageFormats.Add(format);
}
}
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegFrame.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegFrame.cs
index c3cd95c028..f251df3bf2 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegFrame.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegFrame.cs
@@ -133,7 +133,7 @@ internal sealed class JpegFrame : IDisposable
for (int i = 0; i < this.ComponentCount; i++)
{
- IJpegComponent component = this.Components[i];
+ JpegComponent component = this.Components[i];
component.Init(maxSubFactorH, maxSubFactorV);
}
}
@@ -143,7 +143,7 @@ internal sealed class JpegFrame : IDisposable
bool fullScan = this.Progressive || !this.Interleaved;
for (int i = 0; i < this.ComponentCount; i++)
{
- IJpegComponent component = this.Components[i];
+ JpegComponent component = this.Components[i];
component.AllocateSpectral(fullScan);
}
}
diff --git a/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs b/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs
index 95f7fde32c..7fc2a1f45e 100644
--- a/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs
+++ b/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs
@@ -176,10 +176,7 @@ internal sealed unsafe partial class JpegEncoderCore : IImageEncoderInternals
/// is .
private void WriteDefineHuffmanTables(JpegHuffmanTableConfig[] tableConfigs, HuffmanScanEncoder scanEncoder, Span buffer)
{
- if (tableConfigs is null)
- {
- throw new ArgumentNullException(nameof(tableConfigs));
- }
+ ArgumentNullException.ThrowIfNull(tableConfigs);
int markerlen = 2;
diff --git a/src/ImageSharp/Formats/Png/PngDecoderCore.cs b/src/ImageSharp/Formats/Png/PngDecoderCore.cs
index 95154d68d3..3e6c914444 100644
--- a/src/ImageSharp/Formats/Png/PngDecoderCore.cs
+++ b/src/ImageSharp/Formats/Png/PngDecoderCore.cs
@@ -2039,8 +2039,7 @@ internal sealed class PngDecoderCore : IImageDecoderInternals
// Keywords should not be empty or have leading or trailing whitespace.
name = PngConstants.Encoding.GetString(keywordBytes);
return !string.IsNullOrWhiteSpace(name)
- && !name.StartsWith(" ", StringComparison.Ordinal)
- && !name.EndsWith(" ", StringComparison.Ordinal);
+ && !name.StartsWith(' ') && !name.EndsWith(' ');
}
private static bool IsXmpTextData(ReadOnlySpan keywordBytes)
diff --git a/src/ImageSharp/Formats/Qoi/QoiDecoder.cs b/src/ImageSharp/Formats/Qoi/QoiDecoder.cs
index a54095dfc6..5c1bf6ad23 100644
--- a/src/ImageSharp/Formats/Qoi/QoiDecoder.cs
+++ b/src/ImageSharp/Formats/Qoi/QoiDecoder.cs
@@ -4,6 +4,7 @@
using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Formats.Qoi;
+
internal class QoiDecoder : ImageDecoder
{
private QoiDecoder()
diff --git a/src/ImageSharp/Formats/Tiff/Ifd/DirectoryReader.cs b/src/ImageSharp/Formats/Tiff/Ifd/DirectoryReader.cs
index 086eef0585..114fc12b23 100644
--- a/src/ImageSharp/Formats/Tiff/Ifd/DirectoryReader.cs
+++ b/src/ImageSharp/Formats/Tiff/Ifd/DirectoryReader.cs
@@ -71,7 +71,7 @@ internal class DirectoryReader
throw TiffThrowHelper.ThrowInvalidHeader();
}
- private IList ReadIfds(bool isBigTiff)
+ private List ReadIfds(bool isBigTiff)
{
List readers = new();
while (this.nextIfdOffset != 0 && this.nextIfdOffset < (ulong)this.stream.Length)
diff --git a/src/ImageSharp/Formats/Webp/Lossy/LossyUtils.cs b/src/ImageSharp/Formats/Webp/Lossy/LossyUtils.cs
index de3f1586af..aae4181ce0 100644
--- a/src/ImageSharp/Formats/Webp/Lossy/LossyUtils.cs
+++ b/src/ImageSharp/Formats/Webp/Lossy/LossyUtils.cs
@@ -230,11 +230,7 @@ internal static class LossyUtils
}
}
-#if NET7_0_OR_GREATER
return (int)Vector128.Sum(sum);
-#else
- return Numerics.ReduceSumArm(sum);
-#endif
}
[MethodImpl(InliningOptions.ShortMethod)]
@@ -252,11 +248,7 @@ internal static class LossyUtils
}
}
-#if NET7_0_OR_GREATER
return (int)Vector128.Sum(sum);
-#else
- return Numerics.ReduceSumArm(sum);
-#endif
}
[MethodImpl(InliningOptions.ShortMethod)]
@@ -275,11 +267,8 @@ internal static class LossyUtils
Vector128 sum2 = AdvSimd.AddPairwiseWidening(prod2);
Vector128 sum = AdvSimd.Add(sum1, sum2);
-#if NET7_0_OR_GREATER
+
return (int)Vector128.Sum(sum);
-#else
- return Numerics.ReduceSumArm(sum);
-#endif
}
// Load all 4x4 pixels into a single Vector128
diff --git a/src/ImageSharp/ImageSharp.csproj b/src/ImageSharp/ImageSharp.csproj
index b08c27c41b..4c08fc017b 100644
--- a/src/ImageSharp/ImageSharp.csproj
+++ b/src/ImageSharp/ImageSharp.csproj
@@ -22,20 +22,20 @@
-
- 3.1
+
+ 4.0
- net7.0;net6.0
+ net8.0
true
- net6.0
+ net8.0
true
diff --git a/src/ImageSharp/Memory/Allocators/Internals/SharedArrayPoolBuffer{T}.cs b/src/ImageSharp/Memory/Allocators/Internals/SharedArrayPoolBuffer{T}.cs
index f9434ee941..02bdf0f48d 100644
--- a/src/ImageSharp/Memory/Allocators/Internals/SharedArrayPoolBuffer{T}.cs
+++ b/src/ImageSharp/Memory/Allocators/Internals/SharedArrayPoolBuffer{T}.cs
@@ -57,13 +57,7 @@ internal class SharedArrayPoolBuffer : ManagedBufferBase, IRefCounted
[Conditional("DEBUG")]
[MemberNotNull(nameof(Array))]
- private void CheckDisposed()
- {
- if (this.Array == null)
- {
- throw new ObjectDisposedException("SharedArrayPoolBuffer");
- }
- }
+ private void CheckDisposed() => ObjectDisposedException.ThrowIf(this.Array == null, this.Array);
private sealed class LifetimeGuard : RefCountedMemoryLifetimeGuard
{
diff --git a/src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs b/src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs
index 953ef74afb..a4fcd9275b 100644
--- a/src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs
+++ b/src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs
@@ -472,7 +472,7 @@ internal abstract class BaseExifReader
}
}
- private void Add(IList values, IExifValue exif, object? value)
+ private void Add(IList values, ExifValue exif, object? value)
{
if (!exif.TrySetValue(value))
{
diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs
index 4891abba8c..8bd24c7a01 100644
--- a/src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs
+++ b/src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs
@@ -129,7 +129,7 @@ public partial struct Abgr32 : IPixel, IPackedVector
public uint Abgr
{
[MethodImpl(InliningOptions.ShortMethod)]
- readonly get => Unsafe.As(ref Unsafe.AsRef(this));
+ readonly get => Unsafe.As(ref Unsafe.AsRef(in this));
[MethodImpl(InliningOptions.ShortMethod)]
set => Unsafe.As(ref this) = value;
diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs
index 0c99adb52d..fa8af98a0b 100644
--- a/src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs
+++ b/src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs
@@ -129,7 +129,7 @@ public partial struct Argb32 : IPixel, IPackedVector
public uint Argb
{
[MethodImpl(InliningOptions.ShortMethod)]
- readonly get => Unsafe.As(ref Unsafe.AsRef(this));
+ readonly get => Unsafe.As(ref Unsafe.AsRef(in this));
[MethodImpl(InliningOptions.ShortMethod)]
set => Unsafe.As(ref this) = value;
diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs
index 6b859cda64..d7222f2ef8 100644
--- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs
+++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs
@@ -85,7 +85,7 @@ public partial struct Bgra32 : IPixel, IPackedVector
public uint Bgra
{
[MethodImpl(InliningOptions.ShortMethod)]
- readonly get => Unsafe.As(ref Unsafe.AsRef(this));
+ readonly get => Unsafe.As(ref Unsafe.AsRef(in this));
[MethodImpl(InliningOptions.ShortMethod)]
set => Unsafe.As(ref this) = value;
diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/La16.cs b/src/ImageSharp/PixelFormats/PixelImplementations/La16.cs
index 7597677a26..58aeb61890 100644
--- a/src/ImageSharp/PixelFormats/PixelImplementations/La16.cs
+++ b/src/ImageSharp/PixelFormats/PixelImplementations/La16.cs
@@ -45,7 +45,7 @@ public partial struct La16 : IPixel, IPackedVector
///
public ushort PackedValue
{
- readonly get => Unsafe.As(ref Unsafe.AsRef(this));
+ readonly get => Unsafe.As(ref Unsafe.AsRef(in this));
set => Unsafe.As(ref this) = value;
}
diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/La32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/La32.cs
index cb8fad228d..db7f433293 100644
--- a/src/ImageSharp/PixelFormats/PixelImplementations/La32.cs
+++ b/src/ImageSharp/PixelFormats/PixelImplementations/La32.cs
@@ -45,7 +45,7 @@ public partial struct La32 : IPixel, IPackedVector
public uint PackedValue
{
[MethodImpl(InliningOptions.ShortMethod)]
- readonly get => Unsafe.As(ref Unsafe.AsRef(this));
+ readonly get => Unsafe.As(ref Unsafe.AsRef(in this));
[MethodImpl(InliningOptions.ShortMethod)]
set => Unsafe.As(ref this) = value;
diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs
index a652c2b339..75fe8f3f4e 100644
--- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs
+++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs
@@ -124,7 +124,7 @@ public partial struct Rgba32 : IPixel, IPackedVector
public uint Rgba
{
[MethodImpl(InliningOptions.ShortMethod)]
- readonly get => Unsafe.As(ref Unsafe.AsRef(this));
+ readonly get => Unsafe.As(ref Unsafe.AsRef(in this));
[MethodImpl(InliningOptions.ShortMethod)]
set => Unsafe.As(ref this) = value;
diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs
index 81c9591480..75235c9007 100644
--- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs
+++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs
@@ -152,7 +152,7 @@ public partial struct Rgba64 : IPixel, IPackedVector
public Rgb48 Rgb
{
[MethodImpl(InliningOptions.ShortMethod)]
- readonly get => Unsafe.As(ref Unsafe.AsRef(this));
+ readonly get => Unsafe.As(ref Unsafe.AsRef(in this));
[MethodImpl(InliningOptions.ShortMethod)]
set => Unsafe.As(ref this) = value;
@@ -162,7 +162,7 @@ public partial struct Rgba64 : IPixel, IPackedVector
public ulong PackedValue
{
[MethodImpl(InliningOptions.ShortMethod)]
- readonly get => Unsafe.As(ref Unsafe.AsRef(this));
+ readonly get => Unsafe.As(ref Unsafe.AsRef(in this));
[MethodImpl(InliningOptions.ShortMethod)]
set => Unsafe.As(ref this) = value;
diff --git a/src/ImageSharp/Processing/Processors/Dithering/ErrorDither.cs b/src/ImageSharp/Processing/Processors/Dithering/ErrorDither.cs
index 3c56d0243b..f1d7fbd6f3 100644
--- a/src/ImageSharp/Processing/Processors/Dithering/ErrorDither.cs
+++ b/src/ImageSharp/Processing/Processors/Dithering/ErrorDither.cs
@@ -143,7 +143,7 @@ public readonly partial struct ErrorDither : IDither, IEquatable, I
for (int x = bounds.Left; x < bounds.Right; x++)
{
ref TPixel sourcePixel = ref Unsafe.Add(ref sourceRowRef, (uint)x);
- TPixel transformed = Unsafe.AsRef(processor).GetPaletteColor(sourcePixel);
+ TPixel transformed = Unsafe.AsRef(in processor).GetPaletteColor(sourcePixel);
this.Dither(source, bounds, sourcePixel, transformed, x, y, scale);
sourcePixel = transformed;
}
diff --git a/src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessor{TPixel,TDelegate}.cs b/src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessor{TPixel,TDelegate}.cs
index f59b95050e..36bb327cf2 100644
--- a/src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessor{TPixel,TDelegate}.cs
+++ b/src/ImageSharp/Processing/Processors/Effects/PixelRowDelegateProcessor{TPixel,TDelegate}.cs
@@ -96,7 +96,7 @@ internal sealed class PixelRowDelegateProcessor : ImageProces
PixelOperations.Instance.ToVector4(this.configuration, rowSpan, span, this.modifiers);
// Run the user defined pixel shader to the current row of pixels
- Unsafe.AsRef(this.rowProcessor).Invoke(span, new Point(this.startX, y));
+ Unsafe.AsRef(in this.rowProcessor).Invoke(span, new Point(this.startX, y));
PixelOperations.Instance.FromVector4Destructive(this.configuration, span, rowSpan, this.modifiers);
}
diff --git a/src/ImageSharp/Processing/Processors/Filters/FilterProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Filters/FilterProcessor{TPixel}.cs
index 5ad245e3ce..5109139647 100644
--- a/src/ImageSharp/Processing/Processors/Filters/FilterProcessor{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Filters/FilterProcessor{TPixel}.cs
@@ -78,7 +78,7 @@ internal class FilterProcessor : ImageProcessor
Span rowSpan = this.source.DangerousGetRowSpan(y).Slice(this.startX, span.Length);
PixelOperations.Instance.ToVector4(this.configuration, rowSpan, span, PixelConversionModifiers.Scale);
- ColorNumerics.Transform(span, ref Unsafe.AsRef(this.matrix));
+ ColorNumerics.Transform(span, ref Unsafe.AsRef(in this.matrix));
PixelOperations.Instance.FromVector4Destructive(this.configuration, span, rowSpan, PixelConversionModifiers.Scale);
}
diff --git a/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs
index fe422882bc..039417578e 100644
--- a/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs
@@ -126,7 +126,7 @@ public struct OctreeQuantizer : IQuantizer
///
[MethodImpl(InliningOptions.ShortMethod)]
public readonly IndexedImageFrame QuantizeFrame(ImageFrame source, Rectangle bounds)
- => QuantizerUtilities.QuantizeFrame(ref Unsafe.AsRef(this), source, bounds);
+ => QuantizerUtilities.QuantizeFrame(ref Unsafe.AsRef(in this), source, bounds);
///
[MethodImpl(InliningOptions.ShortMethod)]
diff --git a/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs
index 3df80ea9b7..092975d28a 100644
--- a/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs
@@ -56,7 +56,7 @@ internal readonly struct PaletteQuantizer : IQuantizer
///
[MethodImpl(InliningOptions.ShortMethod)]
public readonly IndexedImageFrame QuantizeFrame(ImageFrame source, Rectangle bounds)
- => QuantizerUtilities.QuantizeFrame(ref Unsafe.AsRef(this), source, bounds);
+ => QuantizerUtilities.QuantizeFrame(ref Unsafe.AsRef(in this), source, bounds);
///
[MethodImpl(InliningOptions.ShortMethod)]
diff --git a/src/ImageSharp/Processing/Processors/Quantization/QuantizerUtilities.cs b/src/ImageSharp/Processing/Processors/Quantization/QuantizerUtilities.cs
index 10ffe68dca..fc1dda6be5 100644
--- a/src/ImageSharp/Processing/Processors/Quantization/QuantizerUtilities.cs
+++ b/src/ImageSharp/Processing/Processors/Quantization/QuantizerUtilities.cs
@@ -161,7 +161,7 @@ public static class QuantizerUtilities
for (int x = 0; x < destinationRow.Length; x++)
{
- destinationRow[x] = Unsafe.AsRef(quantizer).GetQuantizedColor(sourceRow[x + offsetX], out TPixel _);
+ destinationRow[x] = Unsafe.AsRef(in quantizer).GetQuantizedColor(sourceRow[x + offsetX], out TPixel _);
}
}
diff --git a/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer{TPixel}.cs
index f6928c3dd4..e13975b56e 100644
--- a/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer{TPixel}.cs
+++ b/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer{TPixel}.cs
@@ -168,7 +168,7 @@ internal struct WuQuantizer : IQuantizer
///
[MethodImpl(InliningOptions.ShortMethod)]
public readonly IndexedImageFrame QuantizeFrame(ImageFrame source, Rectangle bounds)
- => QuantizerUtilities.QuantizeFrame(ref Unsafe.AsRef(this), source, bounds);
+ => QuantizerUtilities.QuantizeFrame(ref Unsafe.AsRef(in this), source, bounds);
///
public readonly byte GetQuantizedColor(TPixel color, out TPixel match)
diff --git a/tests/Directory.Build.targets b/tests/Directory.Build.targets
index 3a29442872..d6b35d003f 100644
--- a/tests/Directory.Build.targets
+++ b/tests/Directory.Build.targets
@@ -18,20 +18,18 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj b/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj
index 0ba2f4b949..4408159ef4 100644
--- a/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj
+++ b/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj
@@ -11,7 +11,7 @@
false
Debug;Release
-
+
@@ -23,12 +23,12 @@
- net7.0;net6.0
+ net8.0
- net6.0
+ net8.0
@@ -41,8 +41,8 @@
-
-
+
+
diff --git a/tests/ImageSharp.Benchmarks/LoadResizeSave/LoadResizeSaveStressRunner.cs b/tests/ImageSharp.Benchmarks/LoadResizeSave/LoadResizeSaveStressRunner.cs
index dd9b55e58d..a06784f1b1 100644
--- a/tests/ImageSharp.Benchmarks/LoadResizeSave/LoadResizeSaveStressRunner.cs
+++ b/tests/ImageSharp.Benchmarks/LoadResizeSave/LoadResizeSaveStressRunner.cs
@@ -269,9 +269,7 @@ public class LoadResizeSaveStressRunner
Width = this.ThumbnailSize,
Height = this.ThumbnailSize,
ResizeMode = CropScaleMode.Max,
- SaveFormat = FileFormat.Jpeg,
- JpegQuality = Quality,
- JpegSubsampleMode = ChromaSubsampleMode.Subsample420
+ EncoderOptions = new JpegEncoderOptions(Quality, ChromaSubsampleMode.Subsample420, true)
};
// TODO: Is there a way to capture input dimensions for IncreaseTotalMegapixels?
@@ -343,6 +341,6 @@ public class LoadResizeSaveStressRunner
using var thumb = NetVipsImage.Thumbnail(input, this.ThumbnailSize, this.ThumbnailSize);
// Save the results
- thumb.Jpegsave(this.OutputPath(input), q: Quality, strip: true);
+ thumb.Jpegsave(this.OutputPath(input), q: Quality, keep: NetVips.Enums.ForeignKeep.None);
}
}
diff --git a/tests/ImageSharp.Tests.ProfilingSandbox/ImageSharp.Tests.ProfilingSandbox.csproj b/tests/ImageSharp.Tests.ProfilingSandbox/ImageSharp.Tests.ProfilingSandbox.csproj
index 492ce36b81..b93d011910 100644
--- a/tests/ImageSharp.Tests.ProfilingSandbox/ImageSharp.Tests.ProfilingSandbox.csproj
+++ b/tests/ImageSharp.Tests.ProfilingSandbox/ImageSharp.Tests.ProfilingSandbox.csproj
@@ -7,7 +7,7 @@
Exe
false
SixLabors.ImageSharp.Tests.ProfilingSandbox
- win7-x64
+ win-x64
SixLabors.ImageSharp.Tests.ProfilingSandbox.Program
false
@@ -19,12 +19,12 @@
- net7.0;net6.0
+ net8.0
- net6.0
+ net8.0
@@ -43,7 +43,7 @@
-
+
diff --git a/tests/ImageSharp.Tests/ImageSharp.Tests.csproj b/tests/ImageSharp.Tests/ImageSharp.Tests.csproj
index dc081e0bea..e0c65475af 100644
--- a/tests/ImageSharp.Tests/ImageSharp.Tests.csproj
+++ b/tests/ImageSharp.Tests/ImageSharp.Tests.csproj
@@ -12,12 +12,12 @@
- net7.0;net6.0
+ net8.0
- net6.0
+ net8.0
@@ -35,7 +35,11 @@
-
+
+