|
|
@ -38,6 +38,11 @@ namespace ImageSharp |
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
private readonly object syncRoot = new object(); |
|
|
private readonly object syncRoot = new object(); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The maximum header size of all formats.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private int maxHeaderSize; |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Prevents a default instance of the <see cref="Bootstrapper"/> class from being created.
|
|
|
/// Prevents a default instance of the <see cref="Bootstrapper"/> class from being created.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
@ -50,6 +55,7 @@ namespace ImageSharp |
|
|
new PngFormat(), |
|
|
new PngFormat(), |
|
|
new GifFormat() |
|
|
new GifFormat() |
|
|
}; |
|
|
}; |
|
|
|
|
|
this.SetMaxHeaderSize(); |
|
|
this.parallelOptions = new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount }; |
|
|
this.parallelOptions = new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount }; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -63,6 +69,11 @@ namespace ImageSharp |
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
public static ParallelOptions ParallelOptions => Instance.parallelOptions; |
|
|
public static ParallelOptions ParallelOptions => Instance.parallelOptions; |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the maximum header size of all formats.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
internal static int MaxHeaderSize => Instance.maxHeaderSize; |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Adds a new <see cref="IImageFormat"/> to the collection of supported image formats.
|
|
|
/// Adds a new <see cref="IImageFormat"/> to the collection of supported image formats.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
@ -86,6 +97,8 @@ namespace ImageSharp |
|
|
this.GuardDuplicate(format); |
|
|
this.GuardDuplicate(format); |
|
|
|
|
|
|
|
|
this.imageFormats.Add(format); |
|
|
this.imageFormats.Add(format); |
|
|
|
|
|
|
|
|
|
|
|
this.SetMaxHeaderSize(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -114,5 +127,10 @@ namespace ImageSharp |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void SetMaxHeaderSize() |
|
|
|
|
|
{ |
|
|
|
|
|
this.maxHeaderSize = imageFormats.Max(x => x.HeaderSize); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|