Skip to content

Commit 5626260

Browse files
authored
Merge branch 'master' into feature/single-row-value-delegate-optin
2 parents 1cee460 + ac6b6a9 commit 5626260

File tree

298 files changed

+1176
-1140
lines changed

Some content is hidden

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

298 files changed

+1176
-1140
lines changed

Directory.Build.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@
9595
<!-- Contains RemoteExecutor. Taken from: https://github.com/dotnet/runtime/blob/master/NuGet.config -->
9696
https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json;
9797
</RestoreSources>
98-
<SixLaborsPublicKey>002400000c8000009400000006020000002400005253413100040000010001000147e6fe6766715eec6cfed61f1e7dcdbf69748a3e355c67e9d8dfd953acab1d5e012ba34b23308166fdc61ee1d0390d5f36d814a6091dd4b5ed9eda5a26afced924c683b4bfb4b3d64b0586a57eff9f02b1f84e3cb0ddd518bd1697f2c84dcbb97eb8bb5c7801be12112ed0ec86db934b0e9a5171e6bb1384b6d2f7d54dfa97</SixLaborsPublicKey>
98+
<SixLaborsPublicKey>00240000048000009400000006020000002400005253413100040000010001000147e6fe6766715eec6cfed61f1e7dcdbf69748a3e355c67e9d8dfd953acab1d5e012ba34b23308166fdc61ee1d0390d5f36d814a6091dd4b5ed9eda5a26afced924c683b4bfb4b3d64b0586a57eff9f02b1f84e3cb0ddd518bd1697f2c84dcbb97eb8bb5c7801be12112ed0ec86db934b0e9a5171e6bb1384b6d2f7d54dfa97</SixLaborsPublicKey>
9999
<UseSharedCompilation>true</UseSharedCompilation>
100+
<SignAssembly>true</SignAssembly>
100101
</PropertyGroup>
101102

102103
<!-- Package references and additional files which are consumed by all projects -->

src/Directory.Build.props

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
</PropertyGroup>
2828

2929
<ItemGroup>
30+
<!-- DynamicProxyGenAssembly2 is needed so Moq can use our internals -->
3031
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" PublicKey="0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7" />
31-
<InternalsVisibleTo Include="DynamicProxyGenAssembly2, PublicKeyToken=null" />
32-
<InternalsVisibleTo Include="ImageSharp.Benchmarks" />
33-
<InternalsVisibleTo Include="SixLabors.ImageSharp.Sandbox46" />
34-
<InternalsVisibleTo Include="SixLabors.ImageSharp.Tests" />
32+
<InternalsVisibleTo Include="ImageSharp.Benchmarks" PublicKey="$(SixLaborsPublicKey)" />
33+
<InternalsVisibleTo Include="ImageSharp.Tests.ProfilingSandbox" PublicKey="$(SixLaborsPublicKey)" />
34+
<InternalsVisibleTo Include="SixLabors.ImageSharp.Tests" PublicKey="$(SixLaborsPublicKey)" />
3535
</ItemGroup>
3636

3737
</Project>

src/ImageSharp/Advanced/AdvancedImageExtensions.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ private static Configuration GetConfiguration(IConfigurationProvider source)
6060
/// therefore it's not recommended to mutate the image while holding a reference to it's <see cref="IMemoryGroup{T}"/>.
6161
/// </remarks>
6262
public static IMemoryGroup<TPixel> GetPixelMemoryGroup<TPixel>(this ImageFrame<TPixel> source)
63-
where TPixel : struct, IPixel<TPixel>
63+
where TPixel : unmanaged, IPixel<TPixel>
6464
=> source?.PixelBuffer.FastMemoryGroup.View ?? throw new ArgumentNullException(nameof(source));
6565

6666
/// <summary>
@@ -75,7 +75,7 @@ public static IMemoryGroup<TPixel> GetPixelMemoryGroup<TPixel>(this ImageFrame<T
7575
/// therefore it's not recommended to mutate the image while holding a reference to it's <see cref="IMemoryGroup{T}"/>.
7676
/// </remarks>
7777
public static IMemoryGroup<TPixel> GetPixelMemoryGroup<TPixel>(this Image<TPixel> source)
78-
where TPixel : struct, IPixel<TPixel>
78+
where TPixel : unmanaged, IPixel<TPixel>
7979
=> source?.Frames.RootFrame.GetPixelMemoryGroup() ?? throw new ArgumentNullException(nameof(source));
8080

8181
/// <summary>
@@ -89,7 +89,7 @@ public static IMemoryGroup<TPixel> GetPixelMemoryGroup<TPixel>(this Image<TPixel
8989
[Obsolete(
9090
@"GetPixelSpan might fail, because the backing buffer could be discontiguous for large images. Use GetPixelMemoryGroup or GetPixelRowSpan instead!")]
9191
public static Span<TPixel> GetPixelSpan<TPixel>(this ImageFrame<TPixel> source)
92-
where TPixel : struct, IPixel<TPixel>
92+
where TPixel : unmanaged, IPixel<TPixel>
9393
{
9494
Guard.NotNull(source, nameof(source));
9595

@@ -113,7 +113,7 @@ public static Span<TPixel> GetPixelSpan<TPixel>(this ImageFrame<TPixel> source)
113113
[Obsolete(
114114
@"GetPixelSpan might fail, because the backing buffer could be discontiguous for large images. Use GetPixelMemoryGroup or GetPixelRowSpan instead!")]
115115
public static Span<TPixel> GetPixelSpan<TPixel>(this Image<TPixel> source)
116-
where TPixel : struct, IPixel<TPixel>
116+
where TPixel : unmanaged, IPixel<TPixel>
117117
{
118118
Guard.NotNull(source, nameof(source));
119119

@@ -129,7 +129,7 @@ public static Span<TPixel> GetPixelSpan<TPixel>(this Image<TPixel> source)
129129
/// <param name="rowIndex">The row.</param>
130130
/// <returns>The <see cref="Span{TPixel}"/></returns>
131131
public static Span<TPixel> GetPixelRowSpan<TPixel>(this ImageFrame<TPixel> source, int rowIndex)
132-
where TPixel : struct, IPixel<TPixel>
132+
where TPixel : unmanaged, IPixel<TPixel>
133133
{
134134
Guard.NotNull(source, nameof(source));
135135
Guard.MustBeGreaterThanOrEqualTo(rowIndex, 0, nameof(rowIndex));
@@ -147,7 +147,7 @@ public static Span<TPixel> GetPixelRowSpan<TPixel>(this ImageFrame<TPixel> sourc
147147
/// <param name="rowIndex">The row.</param>
148148
/// <returns>The <see cref="Span{TPixel}"/></returns>
149149
public static Span<TPixel> GetPixelRowSpan<TPixel>(this Image<TPixel> source, int rowIndex)
150-
where TPixel : struct, IPixel<TPixel>
150+
where TPixel : unmanaged, IPixel<TPixel>
151151
{
152152
Guard.NotNull(source, nameof(source));
153153
Guard.MustBeGreaterThanOrEqualTo(rowIndex, 0, nameof(rowIndex));
@@ -165,7 +165,7 @@ public static Span<TPixel> GetPixelRowSpan<TPixel>(this Image<TPixel> source, in
165165
/// <param name="rowIndex">The row.</param>
166166
/// <returns>The <see cref="Span{TPixel}"/></returns>
167167
public static Memory<TPixel> GetPixelRowMemory<TPixel>(this ImageFrame<TPixel> source, int rowIndex)
168-
where TPixel : struct, IPixel<TPixel>
168+
where TPixel : unmanaged, IPixel<TPixel>
169169
{
170170
Guard.NotNull(source, nameof(source));
171171
Guard.MustBeGreaterThanOrEqualTo(rowIndex, 0, nameof(rowIndex));
@@ -183,7 +183,7 @@ public static Memory<TPixel> GetPixelRowMemory<TPixel>(this ImageFrame<TPixel> s
183183
/// <param name="rowIndex">The row.</param>
184184
/// <returns>The <see cref="Span{TPixel}"/></returns>
185185
public static Memory<TPixel> GetPixelRowMemory<TPixel>(this Image<TPixel> source, int rowIndex)
186-
where TPixel : struct, IPixel<TPixel>
186+
where TPixel : unmanaged, IPixel<TPixel>
187187
{
188188
Guard.NotNull(source, nameof(source));
189189
Guard.MustBeGreaterThanOrEqualTo(rowIndex, 0, nameof(rowIndex));

src/ImageSharp/Advanced/AotCompilerTools.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ private static void SeedEverything()
7979
/// </summary>
8080
/// <typeparam name="TPixel">The pixel format.</typeparam>
8181
private static void Seed<TPixel>()
82-
where TPixel : struct, IPixel<TPixel>
82+
where TPixel : unmanaged, IPixel<TPixel>
8383
{
8484
// This is we actually call all the individual methods you need to seed.
8585
AotCompileOctreeQuantizer<TPixel>();
@@ -110,7 +110,7 @@ private static void Seed<TPixel>()
110110
/// </summary>
111111
/// <typeparam name="TPixel">The pixel format.</typeparam>
112112
private static void AotCompileOctreeQuantizer<TPixel>()
113-
where TPixel : struct, IPixel<TPixel>
113+
where TPixel : unmanaged, IPixel<TPixel>
114114
{
115115
using (var test = new OctreeFrameQuantizer<TPixel>(Configuration.Default, new OctreeQuantizer().Options))
116116
{
@@ -124,7 +124,7 @@ private static void AotCompileOctreeQuantizer<TPixel>()
124124
/// </summary>
125125
/// <typeparam name="TPixel">The pixel format.</typeparam>
126126
private static void AotCompileWuQuantizer<TPixel>()
127-
where TPixel : struct, IPixel<TPixel>
127+
where TPixel : unmanaged, IPixel<TPixel>
128128
{
129129
using (var test = new WuFrameQuantizer<TPixel>(Configuration.Default, new WuQuantizer().Options))
130130
{
@@ -138,7 +138,7 @@ private static void AotCompileWuQuantizer<TPixel>()
138138
/// </summary>
139139
/// <typeparam name="TPixel">The pixel format.</typeparam>
140140
private static void AotCompilePaletteQuantizer<TPixel>()
141-
where TPixel : struct, IPixel<TPixel>
141+
where TPixel : unmanaged, IPixel<TPixel>
142142
{
143143
using (var test = (PaletteFrameQuantizer<TPixel>)new PaletteQuantizer(Array.Empty<Color>()).CreateFrameQuantizer<TPixel>(Configuration.Default))
144144
{
@@ -152,7 +152,7 @@ private static void AotCompilePaletteQuantizer<TPixel>()
152152
/// </summary>
153153
/// <typeparam name="TPixel">The pixel format.</typeparam>
154154
private static void AotCompileDithering<TPixel>()
155-
where TPixel : struct, IPixel<TPixel>
155+
where TPixel : unmanaged, IPixel<TPixel>
156156
{
157157
ErrorDither errorDither = ErrorDither.FloydSteinberg;
158158
OrderedDither orderedDither = OrderedDither.Bayer2x2;
@@ -171,7 +171,7 @@ private static void AotCompileDithering<TPixel>()
171171
/// <param name="encoder">The image encoder to seed.</param>
172172
/// <typeparam name="TPixel">The pixel format.</typeparam>
173173
private static void AotCodec<TPixel>(IImageDecoder decoder, IImageEncoder encoder)
174-
where TPixel : struct, IPixel<TPixel>
174+
where TPixel : unmanaged, IPixel<TPixel>
175175
{
176176
try
177177
{
@@ -195,7 +195,7 @@ private static void AotCodec<TPixel>(IImageDecoder decoder, IImageEncoder encode
195195
/// </summary>
196196
/// <typeparam name="TPixel">The pixel format.</typeparam>
197197
private static void AotCompilePixelOperations<TPixel>()
198-
where TPixel : struct, IPixel<TPixel>
198+
where TPixel : unmanaged, IPixel<TPixel>
199199
{
200200
var pixelOp = new PixelOperations<TPixel>();
201201
pixelOp.GetPixelBlender(PixelColorBlendingMode.Normal, PixelAlphaCompositionMode.Clear);

src/ImageSharp/Advanced/IImageVisitor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ public interface IImageVisitor
1717
/// <param name="image">The image.</param>
1818
/// <typeparam name="TPixel">The pixel type.</typeparam>
1919
void Visit<TPixel>(Image<TPixel> image)
20-
where TPixel : struct, IPixel<TPixel>;
20+
where TPixel : unmanaged, IPixel<TPixel>;
2121
}
2222
}

src/ImageSharp/Advanced/IPixelSource.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace SixLabors.ImageSharp.Advanced
1111
/// </summary>
1212
/// <typeparam name="TPixel">The type of the pixel.</typeparam>
1313
internal interface IPixelSource<TPixel>
14-
where TPixel : struct, IPixel<TPixel>
14+
where TPixel : unmanaged, IPixel<TPixel>
1515
{
1616
/// <summary>
1717
/// Gets the pixel buffer.

src/ImageSharp/Color/Color.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public Color WithAlpha(float alpha)
220220
/// <returns>The pixel value.</returns>
221221
[MethodImpl(InliningOptions.ShortMethod)]
222222
public TPixel ToPixel<TPixel>()
223-
where TPixel : struct, IPixel<TPixel>
223+
where TPixel : unmanaged, IPixel<TPixel>
224224
{
225225
TPixel pixel = default;
226226
pixel.FromRgba64(this.data);
@@ -239,7 +239,7 @@ public static void ToPixel<TPixel>(
239239
Configuration configuration,
240240
ReadOnlySpan<Color> source,
241241
Span<TPixel> destination)
242-
where TPixel : struct, IPixel<TPixel>
242+
where TPixel : unmanaged, IPixel<TPixel>
243243
{
244244
ReadOnlySpan<Rgba64> rgba64Span = MemoryMarshal.Cast<Color, Rgba64>(source);
245245
PixelOperations<TPixel>.Instance.FromRgba64(configuration, rgba64Span, destination);

src/ImageSharp/Common/Helpers/Buffer2DUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static void Convolve4<TPixel>(
4040
int maxRow,
4141
int minColumn,
4242
int maxColumn)
43-
where TPixel : struct, IPixel<TPixel>
43+
where TPixel : unmanaged, IPixel<TPixel>
4444
{
4545
ComplexVector4 vector = default;
4646
int kernelLength = kernel.Length;

src/ImageSharp/Common/Helpers/DenseMatrixUtils.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static void Convolve2D3<TPixel>(
4242
int maxRow,
4343
int minColumn,
4444
int maxColumn)
45-
where TPixel : struct, IPixel<TPixel>
45+
where TPixel : unmanaged, IPixel<TPixel>
4646
{
4747
Convolve2DImpl(
4848
in matrixY,
@@ -90,7 +90,7 @@ public static void Convolve2D4<TPixel>(
9090
int maxRow,
9191
int minColumn,
9292
int maxColumn)
93-
where TPixel : struct, IPixel<TPixel>
93+
where TPixel : unmanaged, IPixel<TPixel>
9494
{
9595
Convolve2DImpl(
9696
in matrixY,
@@ -121,7 +121,7 @@ public static void Convolve2DImpl<TPixel>(
121121
int minColumn,
122122
int maxColumn,
123123
out Vector4 vector)
124-
where TPixel : struct, IPixel<TPixel>
124+
where TPixel : unmanaged, IPixel<TPixel>
125125
{
126126
Vector4 vectorY = default;
127127
Vector4 vectorX = default;
@@ -175,7 +175,7 @@ public static void Convolve3<TPixel>(
175175
int maxRow,
176176
int minColumn,
177177
int maxColumn)
178-
where TPixel : struct, IPixel<TPixel>
178+
where TPixel : unmanaged, IPixel<TPixel>
179179
{
180180
Vector4 vector = default;
181181

@@ -222,7 +222,7 @@ public static void Convolve4<TPixel>(
222222
int maxRow,
223223
int minColumn,
224224
int maxColumn)
225-
where TPixel : struct, IPixel<TPixel>
225+
where TPixel : unmanaged, IPixel<TPixel>
226226
{
227227
Vector4 vector = default;
228228

@@ -253,7 +253,7 @@ private static void ConvolveImpl<TPixel>(
253253
int minColumn,
254254
int maxColumn,
255255
ref Vector4 vector)
256-
where TPixel : struct, IPixel<TPixel>
256+
where TPixel : unmanaged, IPixel<TPixel>
257257
{
258258
int matrixHeight = matrix.Rows;
259259
int matrixWidth = matrix.Columns;

src/ImageSharp/Common/Helpers/ImageMaths.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public static float SinC(float f)
269269
/// The <see cref="Rectangle"/>.
270270
/// </returns>
271271
public static Rectangle GetFilteredBoundingRectangle<TPixel>(ImageFrame<TPixel> bitmap, float componentValue, RgbaComponent channel = RgbaComponent.B)
272-
where TPixel : struct, IPixel<TPixel>
272+
where TPixel : unmanaged, IPixel<TPixel>
273273
{
274274
int width = bitmap.Width;
275275
int height = bitmap.Height;

0 commit comments

Comments
 (0)