diff --git a/Bearded.Graphics.ImageSharp/Bearded.Graphics.ImageSharp.csproj b/Bearded.Graphics.ImageSharp/Bearded.Graphics.ImageSharp.csproj
index 57a4a51..e17b889 100644
--- a/Bearded.Graphics.ImageSharp/Bearded.Graphics.ImageSharp.csproj
+++ b/Bearded.Graphics.ImageSharp/Bearded.Graphics.ImageSharp.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/Bearded.Graphics.ImageSharp/ImageTextureData.cs b/Bearded.Graphics.ImageSharp/ImageTextureData.cs
index 1a3b00f..bb9421c 100644
--- a/Bearded.Graphics.ImageSharp/ImageTextureData.cs
+++ b/Bearded.Graphics.ImageSharp/ImageTextureData.cs
@@ -1,18 +1,23 @@
using Bearded.Graphics.Textures;
using OpenTK.Graphics.OpenGL;
using SixLabors.ImageSharp;
+using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.PixelFormats;
namespace Bearded.Graphics.ImageSharp;
public sealed class ImageTextureData : ITextureData
{
- private static readonly Configuration configuration;
+ private static readonly DecoderOptions decoderOptions;
static ImageTextureData()
{
- configuration = Configuration.Default.Clone();
+ var configuration = Configuration.Default.Clone();
configuration.PreferContiguousImageBuffers = true;
+ decoderOptions = new DecoderOptions
+ {
+ Configuration = configuration
+ };
}
private readonly Image image;
@@ -21,21 +26,22 @@ static ImageTextureData()
public int Height { get; }
- public static ITextureData From(string path) => new ImageTextureData(Image.Load(configuration, path));
+ public static ITextureData From(string path) => new ImageTextureData(Image.Load(decoderOptions, path));
- public static ITextureData From(Stream stream) => new ImageTextureData(Image.Load(configuration, stream));
+ public static ITextureData From(Stream stream) => new ImageTextureData(Image.Load(decoderOptions, stream));
- public static ITextureData From(Image bitmap) => new ImageTextureData(bitmap.CloneAs(configuration));
+ public static ITextureData From(Image bitmap) => new ImageTextureData(bitmap.CloneAs(
+ decoderOptions.Configuration));
public static ITextureData From(string path, IEnumerable transformations)
{
- using var image = Image.Load(configuration, path);
+ using var image = Image.Load(decoderOptions, path);
return From(image, transformations);
}
public static ITextureData From(Stream stream, IEnumerable transformations)
{
- using var image = Image.Load(configuration, stream);
+ using var image = Image.Load(decoderOptions, stream);
return From(image, transformations);
}