Browse Source

Processed review comment, made ClearColor not nullable.

pull/552/head
woutware 8 years ago
parent
commit
2943df12d7
  1. 20
      src/ImageSharp/ImageFrameCollection.cs
  2. 4
      src/ImageSharp/Image{TPixel}.cs

20
src/ImageSharp/ImageFrameCollection.cs

@ -23,14 +23,7 @@ namespace SixLabors.ImageSharp
this.parent = parent;
// Frames are already cloned within the caller
if (parent.ClearColor.HasValue)
{
this.frames.Add(new ImageFrame<TPixel>(parent.GetConfiguration(), width, height, parent.ClearColor.Value));
}
else
{
this.frames.Add(new ImageFrame<TPixel>(parent.GetConfiguration().MemoryManager, width, height));
}
this.frames.Add(new ImageFrame<TPixel>(parent.GetConfiguration(), width, height, parent.ClearColor));
}
internal ImageFrameCollection(Image<TPixel> parent, IEnumerable<ImageFrame<TPixel>> frames)
@ -150,16 +143,7 @@ namespace SixLabors.ImageSharp
/// <inheritdoc/>
public ImageFrame<TPixel> CreateFrame()
{
ImageFrame<TPixel> frame;
if (this.parent.ClearColor.HasValue)
{
frame = new ImageFrame<TPixel>(this.parent.GetConfiguration(), this.RootFrame.Width, this.RootFrame.Height, this.parent.ClearColor.Value);
}
else
{
frame = new ImageFrame<TPixel>(this.parent.GetConfiguration().MemoryManager, this.RootFrame.Width, this.RootFrame.Height);
}
ImageFrame<TPixel> frame = new ImageFrame<TPixel>(this.parent.GetConfiguration(), this.RootFrame.Width, this.RootFrame.Height, this.parent.ClearColor);
this.frames.Add(frame);
return frame;
}

4
src/ImageSharp/Image{TPixel}.cs

@ -22,7 +22,7 @@ namespace SixLabors.ImageSharp
{
private readonly Configuration configuration;
private readonly ImageFrameCollection<TPixel> frames;
private readonly TPixel? clearColor;
private readonly TPixel clearColor;
/// <summary>
/// Initializes a new instance of the <see cref="Image{TPixel}"/> class
@ -142,7 +142,7 @@ namespace SixLabors.ImageSharp
/// <summary>
/// Gets the clear color to initialize the image frame pixels with.
/// </summary>
internal TPixel? ClearColor => this.clearColor;
internal TPixel ClearColor => this.clearColor;
/// <summary>
/// Gets the root frame.

Loading…
Cancel
Save