Skip to content

Commit

Permalink
Merge pull request SixLabors#618 from SixLabors/af/memory-bridge2
Browse files Browse the repository at this point in the history
Add span overloads for Image.Load() and Image.DetectFormat()
  • Loading branch information
antonfirsov authored Jun 18, 2018
2 parents f2920dc + beaff33 commit 84a2c3b
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions tests/ImageSharp.Tests/TestFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@ namespace SixLabors.ImageSharp.Tests
/// </summary>
public class TestFormat : IConfigurationModule, IImageFormat
{
// We should not change Configuration.Default in individual tests!
// Create new configuration instances with new Configuration(TestFormat.GlobalTestFormat) instead!
public static TestFormat GlobalTestFormat { get; } = new TestFormat();

public static void RegisterGlobalTestFormat()
{
Configuration.Default.Configure(GlobalTestFormat);
}

public TestFormat()
{
this.Encoder = new TestEncoder(this);
Expand Down Expand Up @@ -155,12 +152,12 @@ public class TestHeader : IImageFormatDetector

private TestFormat testFormat;

public int HeaderSize => testFormat.HeaderSize;
public int HeaderSize => this.testFormat.HeaderSize;

public IImageFormat DetectFormat(ReadOnlySpan<byte> header)
{
if (testFormat.IsSupportedFileFormat(header))
return testFormat;
if (this.testFormat.IsSupportedFileFormat(header))
return this.testFormat;

return null;
}
Expand Down

0 comments on commit 84a2c3b

Please sign in to comment.