From 2943df12d751fcfb67d7b5239da1041079cee871 Mon Sep 17 00:00:00 2001 From: woutware <35376607+woutware@users.noreply.github.com> Date: Mon, 30 Apr 2018 10:27:21 +0200 Subject: [PATCH] Processed review comment, made ClearColor not nullable. --- src/ImageSharp/ImageFrameCollection.cs | 20 ++------------------ src/ImageSharp/Image{TPixel}.cs | 4 ++-- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/ImageSharp/ImageFrameCollection.cs b/src/ImageSharp/ImageFrameCollection.cs index 1c00d9e63..f2e35812b 100644 --- a/src/ImageSharp/ImageFrameCollection.cs +++ b/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(parent.GetConfiguration(), width, height, parent.ClearColor.Value)); - } - else - { - this.frames.Add(new ImageFrame(parent.GetConfiguration().MemoryManager, width, height)); - } + this.frames.Add(new ImageFrame(parent.GetConfiguration(), width, height, parent.ClearColor)); } internal ImageFrameCollection(Image parent, IEnumerable> frames) @@ -150,16 +143,7 @@ namespace SixLabors.ImageSharp /// public ImageFrame CreateFrame() { - ImageFrame frame; - if (this.parent.ClearColor.HasValue) - { - frame = new ImageFrame(this.parent.GetConfiguration(), this.RootFrame.Width, this.RootFrame.Height, this.parent.ClearColor.Value); - } - else - { - frame = new ImageFrame(this.parent.GetConfiguration().MemoryManager, this.RootFrame.Width, this.RootFrame.Height); - } - + ImageFrame frame = new ImageFrame(this.parent.GetConfiguration(), this.RootFrame.Width, this.RootFrame.Height, this.parent.ClearColor); this.frames.Add(frame); return frame; } diff --git a/src/ImageSharp/Image{TPixel}.cs b/src/ImageSharp/Image{TPixel}.cs index 2aa503844..599116414 100644 --- a/src/ImageSharp/Image{TPixel}.cs +++ b/src/ImageSharp/Image{TPixel}.cs @@ -22,7 +22,7 @@ namespace SixLabors.ImageSharp { private readonly Configuration configuration; private readonly ImageFrameCollection frames; - private readonly TPixel? clearColor; + private readonly TPixel clearColor; /// /// Initializes a new instance of the class @@ -142,7 +142,7 @@ namespace SixLabors.ImageSharp /// /// Gets the clear color to initialize the image frame pixels with. /// - internal TPixel? ClearColor => this.clearColor; + internal TPixel ClearColor => this.clearColor; /// /// Gets the root frame.