22// Licensed under the Six Labors Split License.
33
44using System . Collections . Concurrent ;
5- using SixLabors . ImageSharp . Advanced ;
65using SixLabors . ImageSharp . Formats ;
76using SixLabors . ImageSharp . PixelFormats ;
87
@@ -24,16 +23,6 @@ public sealed class TestFile
2423 // ReSharper disable once InconsistentNaming
2524 private static readonly Lazy < string > InputImagesDirectoryValue = new ( ( ) => TestEnvironment . InputImagesDirectoryFullPath ) ;
2625
27- /// <summary>
28- /// The image (lazy initialized value)
29- /// </summary>
30- private volatile Image < Rgba32 > image ;
31-
32- /// <summary>
33- /// Used to ensure image loading is threadsafe.
34- /// </summary>
35- private readonly object syncLock = new ( ) ;
36-
3726 /// <summary>
3827 /// The image bytes
3928 /// </summary>
@@ -65,25 +54,6 @@ public sealed class TestFile
6554 /// </summary>
6655 public string FileNameWithoutExtension => Path . GetFileNameWithoutExtension ( this . FullPath ) ;
6756
68- /// <summary>
69- /// Gets the image with lazy initialization.
70- /// </summary>
71- private Image < Rgba32 > Image
72- {
73- get
74- {
75- if ( this . image is null )
76- {
77- lock ( this . syncLock )
78- {
79- this . image ??= ImageSharp . Image . Load < Rgba32 > ( this . Bytes ) ;
80- }
81- }
82-
83- return this . image ;
84- }
85- }
86-
8757 /// <summary>
8858 /// Gets the input image directory.
8959 /// </summary>
@@ -137,8 +107,7 @@ public string GetFileNameWithoutExtension(object value)
137107 /// <returns>
138108 /// The <see cref="Image{Rgba32}"/>.
139109 /// </returns>
140- public Image < Rgba32 > CreateRgba32Image ( )
141- => this . Image . Clone ( ) ;
110+ public Image < Rgba32 > CreateRgba32Image ( ) => Image . Load < Rgba32 > ( this . Bytes ) ;
142111
143112 /// <summary>
144113 /// Creates a new <see cref="Rgba32"/> image.
@@ -160,7 +129,6 @@ public Image<Rgba32> CreateRgba32Image(IImageDecoder decoder)
160129 /// </returns>
161130 public Image < Rgba32 > CreateRgba32Image ( IImageDecoder decoder , DecoderOptions options )
162131 {
163- options . Configuration = this . Image . GetConfiguration ( ) ;
164132 using MemoryStream stream = new ( this . Bytes ) ;
165133 return decoder . Decode < Rgba32 > ( options , stream ) ;
166134 }
0 commit comments