Browse Source

Rename DeepClone => Clone

af/merge-core
James Jackson-South 8 years ago
parent
commit
251ae936a7
  1. 2
      src/ImageSharp/Formats/Bmp/BmpMetaData.cs
  2. 2
      src/ImageSharp/Formats/Gif/GifFrameMetaData.cs
  3. 2
      src/ImageSharp/Formats/Gif/GifMetaData.cs
  4. 2
      src/ImageSharp/Formats/Jpeg/JpegMetaData.cs
  5. 2
      src/ImageSharp/Formats/Png/PngMetaData.cs
  6. 4
      src/ImageSharp/IDeepCloneable.cs
  7. 4
      src/ImageSharp/ImageFrameCollection.cs
  8. 4
      src/ImageSharp/ImageFrame{TPixel}.cs
  9. 4
      src/ImageSharp/Image{TPixel}.cs
  10. 4
      src/ImageSharp/MetaData/ImageFrameMetaData.cs
  11. 8
      src/ImageSharp/MetaData/ImageMetaData.cs
  12. 4
      src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs
  13. 2
      src/ImageSharp/MetaData/Profiles/Exif/ExifValue.cs
  14. 2
      src/ImageSharp/MetaData/Profiles/ICC/IccProfile.cs
  15. 4
      src/ImageSharp/Processing/Processors/Transforms/AffineTransformProcessor.cs
  16. 4
      src/ImageSharp/Processing/Processors/Transforms/CropProcessor.cs
  17. 4
      src/ImageSharp/Processing/Processors/Transforms/ProjectiveTransformProcessor.cs
  18. 4
      src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs
  19. 2
      tests/ImageSharp.Tests/Formats/Bmp/BmpMetaDataTests.cs
  20. 2
      tests/ImageSharp.Tests/Formats/Gif/GifFrameMetaDataTests.cs
  21. 2
      tests/ImageSharp.Tests/Formats/Gif/GifMetaDataTests.cs
  22. 2
      tests/ImageSharp.Tests/Formats/Jpg/JpegMetaDataTests.cs
  23. 2
      tests/ImageSharp.Tests/Formats/Png/PngMetaDataTests.cs
  24. 2
      tests/ImageSharp.Tests/MetaData/ImageFrameMetaDataTests.cs
  25. 4
      tests/ImageSharp.Tests/MetaData/ImageMetaDataTests.cs
  26. 6
      tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.cs

2
src/ImageSharp/Formats/Bmp/BmpMetaData.cs

@ -27,7 +27,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp
public BmpBitsPerPixel BitsPerPixel { get; set; } = BmpBitsPerPixel.Pixel24;
/// <inheritdoc/>
public IDeepCloneable DeepClone() => new BmpMetaData(this);
public IDeepCloneable Clone() => new BmpMetaData(this);
// TODO: Colors used once we support encoding palette bmps.
}

2
src/ImageSharp/Formats/Gif/GifFrameMetaData.cs

@ -49,6 +49,6 @@ namespace SixLabors.ImageSharp.Formats.Gif
public GifDisposalMethod DisposalMethod { get; set; }
/// <inheritdoc/>
public IDeepCloneable DeepClone() => new GifFrameMetaData(this);
public IDeepCloneable Clone() => new GifFrameMetaData(this);
}
}

2
src/ImageSharp/Formats/Gif/GifMetaData.cs

@ -45,6 +45,6 @@ namespace SixLabors.ImageSharp.Formats.Gif
public int GlobalColorTableLength { get; set; }
/// <inheritdoc/>
public IDeepCloneable DeepClone() => new GifMetaData(this);
public IDeepCloneable Clone() => new GifMetaData(this);
}
}

2
src/ImageSharp/Formats/Jpeg/JpegMetaData.cs

@ -27,6 +27,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
public int Quality { get; set; } = 75;
/// <inheritdoc/>
public IDeepCloneable DeepClone() => new JpegMetaData(this);
public IDeepCloneable Clone() => new JpegMetaData(this);
}
}

2
src/ImageSharp/Formats/Png/PngMetaData.cs

@ -43,6 +43,6 @@ namespace SixLabors.ImageSharp.Formats.Png
public float Gamma { get; set; }
/// <inheritdoc/>
public IDeepCloneable DeepClone() => new PngMetaData(this);
public IDeepCloneable Clone() => new PngMetaData(this);
}
}

4
src/ImageSharp/IDeepCloneable.cs

@ -14,7 +14,7 @@ namespace SixLabors.ImageSharp
/// Creates a new <typeparamref name="T"/> that is a deep copy of the current instance.
/// </summary>
/// <returns>The <typeparamref name="T"/>.</returns>
T DeepClone();
T Clone();
}
/// <summary>
@ -26,6 +26,6 @@ namespace SixLabors.ImageSharp
/// Creates a new object that is a deep copy of the current instance.
/// </summary>
/// <returns>The <see cref="IDeepCloneable"/>.</returns>
IDeepCloneable DeepClone();
IDeepCloneable Clone();
}
}

4
src/ImageSharp/ImageFrameCollection.cs

@ -195,7 +195,7 @@ namespace SixLabors.ImageSharp
this.frames.Remove(frame);
return new Image<TPixel>(this.parent.GetConfiguration(), this.parent.MetaData.DeepClone(), new[] { frame });
return new Image<TPixel>(this.parent.GetConfiguration(), this.parent.MetaData.Clone(), new[] { frame });
}
/// <summary>
@ -208,7 +208,7 @@ namespace SixLabors.ImageSharp
{
ImageFrame<TPixel> frame = this[index];
ImageFrame<TPixel> clonedFrame = frame.Clone();
return new Image<TPixel>(this.parent.GetConfiguration(), this.parent.MetaData.DeepClone(), new[] { clonedFrame });
return new Image<TPixel>(this.parent.GetConfiguration(), this.parent.MetaData.Clone(), new[] { clonedFrame });
}
/// <summary>

4
src/ImageSharp/ImageFrame{TPixel}.cs

@ -135,7 +135,7 @@ namespace SixLabors.ImageSharp
this.MemoryAllocator = configuration.MemoryAllocator;
this.PixelBuffer = this.MemoryAllocator.Allocate2D<TPixel>(source.PixelBuffer.Width, source.PixelBuffer.Height);
source.PixelBuffer.GetSpan().CopyTo(this.PixelBuffer.GetSpan());
this.MetaData = source.MetaData.DeepClone();
this.MetaData = source.MetaData.Clone();
}
/// <summary>
@ -260,7 +260,7 @@ namespace SixLabors.ImageSharp
return this.Clone() as ImageFrame<TPixel2>;
}
var target = new ImageFrame<TPixel2>(this.configuration, this.Width, this.Height, this.MetaData.DeepClone());
var target = new ImageFrame<TPixel2>(this.configuration, this.Width, this.Height, this.MetaData.Clone());
ParallelFor.WithTemporaryBuffer(
0,

4
src/ImageSharp/Image{TPixel}.cs

@ -190,7 +190,7 @@ namespace SixLabors.ImageSharp
public Image<TPixel> Clone()
{
IEnumerable<ImageFrame<TPixel>> clonedFrames = this.frames.Select(x => x.Clone());
return new Image<TPixel>(this.configuration, this.MetaData.DeepClone(), clonedFrames);
return new Image<TPixel>(this.configuration, this.MetaData.Clone(), clonedFrames);
}
/// <inheritdoc/>
@ -208,7 +208,7 @@ namespace SixLabors.ImageSharp
where TPixel2 : struct, IPixel<TPixel2>
{
IEnumerable<ImageFrame<TPixel2>> clonedFrames = this.frames.Select(x => x.CloneAs<TPixel2>());
var target = new Image<TPixel2>(this.configuration, this.MetaData.DeepClone(), clonedFrames);
var target = new Image<TPixel2>(this.configuration, this.MetaData.Clone(), clonedFrames);
return target;
}

4
src/ImageSharp/MetaData/ImageFrameMetaData.cs

@ -33,12 +33,12 @@ namespace SixLabors.ImageSharp.MetaData
foreach (KeyValuePair<IImageFormat, IDeepCloneable> meta in other.formatMetaData)
{
this.formatMetaData.Add(meta.Key, meta.Value.DeepClone());
this.formatMetaData.Add(meta.Key, meta.Value.Clone());
}
}
/// <inheritdoc/>
public ImageFrameMetaData DeepClone() => new ImageFrameMetaData(this);
public ImageFrameMetaData Clone() => new ImageFrameMetaData(this);
/// <summary>
/// Gets the metadata value associated with the specified key.

8
src/ImageSharp/MetaData/ImageMetaData.cs

@ -60,7 +60,7 @@ namespace SixLabors.ImageSharp.MetaData
foreach (KeyValuePair<IImageFormat, IDeepCloneable> meta in other.formatMetaData)
{
this.formatMetaData.Add(meta.Key, meta.Value.DeepClone());
this.formatMetaData.Add(meta.Key, meta.Value.Clone());
}
foreach (ImageProperty property in other.Properties)
@ -68,8 +68,8 @@ namespace SixLabors.ImageSharp.MetaData
this.Properties.Add(property);
}
this.ExifProfile = other.ExifProfile?.DeepClone();
this.IccProfile = other.IccProfile?.DeepClone();
this.ExifProfile = other.ExifProfile?.Clone();
this.IccProfile = other.IccProfile?.Clone();
}
/// <summary>
@ -154,7 +154,7 @@ namespace SixLabors.ImageSharp.MetaData
}
/// <inheritdoc/>
public ImageMetaData DeepClone() => new ImageMetaData(this);
public ImageMetaData Clone() => new ImageMetaData(this);
/// <summary>
/// Looks up a property with the provided name.

4
src/ImageSharp/MetaData/Profiles/Exif/ExifProfile.cs

@ -70,7 +70,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Exif
foreach (ExifValue value in other.Values)
{
this.values.Add(value.DeepClone());
this.values.Add(value.Clone());
}
}
@ -242,7 +242,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Exif
}
/// <inheritdoc/>
public ExifProfile DeepClone() => new ExifProfile(this);
public ExifProfile Clone() => new ExifProfile(this);
/// <summary>
/// Synchronizes the profiles with the specified meta data.

2
src/ImageSharp/MetaData/Profiles/Exif/ExifValue.cs

@ -229,7 +229,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Exif
}
/// <inheritdoc/>
public ExifValue DeepClone() => new ExifValue(this);
public ExifValue Clone() => new ExifValue(this);
/// <summary>
/// Creates a new <see cref="ExifValue"/>

2
src/ImageSharp/MetaData/Profiles/ICC/IccProfile.cs

@ -98,7 +98,7 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc
}
/// <inheritdoc/>
public IccProfile DeepClone() => new IccProfile(this);
public IccProfile Clone() => new IccProfile(this);
#if !NETSTANDARD1_1

4
src/ImageSharp/Processing/Processors/Transforms/AffineTransformProcessor.cs

@ -51,10 +51,10 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
// We will always be creating the clone even for mutate because we may need to resize the canvas
IEnumerable<ImageFrame<TPixel>> frames =
source.Frames.Select(x => new ImageFrame<TPixel>(source.GetConfiguration(), this.TargetDimensions, x.MetaData.DeepClone()));
source.Frames.Select(x => new ImageFrame<TPixel>(source.GetConfiguration(), this.TargetDimensions, x.MetaData.Clone()));
// Use the overload to prevent an extra frame being added
return new Image<TPixel>(source.GetConfiguration(), source.MetaData.DeepClone(), frames);
return new Image<TPixel>(source.GetConfiguration(), source.MetaData.Clone(), frames);
}
/// <inheritdoc/>

4
src/ImageSharp/Processing/Processors/Transforms/CropProcessor.cs

@ -36,10 +36,10 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms
protected override Image<TPixel> CreateDestination(Image<TPixel> source, Rectangle sourceRectangle)
{
// We will always be creating the clone even for mutate because we may need to resize the canvas
IEnumerable<ImageFrame<TPixel>> frames = source.Frames.Select(x => new ImageFrame<TPixel>(source.GetConfiguration(), this.CropRectangle.Width, this.CropRectangle.Height, x.MetaData.DeepClone()));
IEnumerable<ImageFrame<TPixel>> frames = source.Frames.Select(x => new ImageFrame<TPixel>(source.GetConfiguration(), this.CropRectangle.Width, this.CropRectangle.Height, x.MetaData.Clone()));
// Use the overload to prevent an extra frame being added
return new Image<TPixel>(source.GetConfiguration(), source.MetaData.DeepClone(), frames);
return new Image<TPixel>(source.GetConfiguration(), source.MetaData.Clone(), frames);
}
/// <inheritdoc/>

4
src/ImageSharp/Processing/Processors/Transforms/ProjectiveTransformProcessor.cs

@ -51,10 +51,10 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms
{
// We will always be creating the clone even for mutate because we may need to resize the canvas
IEnumerable<ImageFrame<TPixel>> frames =
source.Frames.Select(x => new ImageFrame<TPixel>(source.GetConfiguration(), this.TargetDimensions.Width, this.TargetDimensions.Height, x.MetaData.DeepClone()));
source.Frames.Select(x => new ImageFrame<TPixel>(source.GetConfiguration(), this.TargetDimensions.Width, this.TargetDimensions.Height, x.MetaData.Clone()));
// Use the overload to prevent an extra frame being added
return new Image<TPixel>(source.GetConfiguration(), source.MetaData.DeepClone(), frames);
return new Image<TPixel>(source.GetConfiguration(), source.MetaData.Clone(), frames);
}
/// <inheritdoc/>

4
src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs

@ -215,10 +215,10 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms
protected override Image<TPixel> CreateDestination(Image<TPixel> source, Rectangle sourceRectangle)
{
// We will always be creating the clone even for mutate because we may need to resize the canvas
IEnumerable<ImageFrame<TPixel>> frames = source.Frames.Select(x => new ImageFrame<TPixel>(source.GetConfiguration(), this.Width, this.Height, x.MetaData.DeepClone()));
IEnumerable<ImageFrame<TPixel>> frames = source.Frames.Select(x => new ImageFrame<TPixel>(source.GetConfiguration(), this.Width, this.Height, x.MetaData.Clone()));
// Use the overload to prevent an extra frame being added
return new Image<TPixel>(source.GetConfiguration(), source.MetaData.DeepClone(), frames);
return new Image<TPixel>(source.GetConfiguration(), source.MetaData.Clone(), frames);
}
/// <inheritdoc/>

2
tests/ImageSharp.Tests/Formats/Bmp/BmpMetaDataTests.cs

@ -12,7 +12,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Bmp
public void CloneIsDeep()
{
var meta = new BmpMetaData() { BitsPerPixel = BmpBitsPerPixel.Pixel24 };
var clone = (BmpMetaData)meta.DeepClone();
var clone = (BmpMetaData)meta.Clone();
clone.BitsPerPixel = BmpBitsPerPixel.Pixel32;

2
tests/ImageSharp.Tests/Formats/Gif/GifFrameMetaDataTests.cs

@ -18,7 +18,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Gif
ColorTableLength = 2
};
var clone = (GifFrameMetaData)meta.DeepClone();
var clone = (GifFrameMetaData)meta.Clone();
clone.FrameDelay = 2;
clone.DisposalMethod = GifDisposalMethod.RestoreToPrevious;

2
tests/ImageSharp.Tests/Formats/Gif/GifMetaDataTests.cs

@ -18,7 +18,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Gif
GlobalColorTableLength = 2
};
var clone = (GifMetaData)meta.DeepClone();
var clone = (GifMetaData)meta.Clone();
clone.RepeatCount = 2;
clone.ColorTableMode = GifColorTableMode.Local;

2
tests/ImageSharp.Tests/Formats/Jpg/JpegMetaDataTests.cs

@ -12,7 +12,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
public void CloneIsDeep()
{
var meta = new JpegMetaData() { Quality = 50 };
var clone = (JpegMetaData)meta.DeepClone();
var clone = (JpegMetaData)meta.Clone();
clone.Quality = 99;

2
tests/ImageSharp.Tests/Formats/Png/PngMetaDataTests.cs

@ -17,7 +17,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png
ColorType = PngColorType.GrayscaleWithAlpha,
Gamma = 2
};
var clone = (PngMetaData)meta.DeepClone();
var clone = (PngMetaData)meta.Clone();
clone.BitDepth = PngBitDepth.Bit2;
clone.ColorType = PngColorType.Palette;

2
tests/ImageSharp.Tests/MetaData/ImageFrameMetaDataTests.cs

@ -37,7 +37,7 @@ namespace SixLabors.ImageSharp.Tests
public void CloneIsDeep()
{
var metaData = new ImageFrameMetaData();
ImageFrameMetaData clone = metaData.DeepClone();
ImageFrameMetaData clone = metaData.Clone();
Assert.False(metaData.GetFormatMetaData(GifFormat.Instance).Equals(clone.GetFormatMetaData(GifFormat.Instance)));
}
}

4
tests/ImageSharp.Tests/MetaData/ImageMetaDataTests.cs

@ -29,7 +29,7 @@ namespace SixLabors.ImageSharp.Tests
metaData.VerticalResolution = 2;
metaData.Properties.Add(imageProperty);
ImageMetaData clone = metaData.DeepClone();
ImageMetaData clone = metaData.Clone();
Assert.Equal(exifProfile.ToByteArray(), clone.ExifProfile.ToByteArray());
Assert.Equal(4, clone.HorizontalResolution);
@ -50,7 +50,7 @@ namespace SixLabors.ImageSharp.Tests
metaData.VerticalResolution = 2;
metaData.Properties.Add(imageProperty);
ImageMetaData clone = metaData.DeepClone();
ImageMetaData clone = metaData.Clone();
clone.HorizontalResolution = 2;
clone.VerticalResolution = 4;

6
tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.cs

@ -67,16 +67,16 @@ namespace SixLabors.ImageSharp.Tests
[Fact]
public void ConstructorCopy()
{
Assert.Throws<NullReferenceException>(() => ((ExifProfile)null).DeepClone());
Assert.Throws<NullReferenceException>(() => ((ExifProfile)null).Clone());
ExifProfile profile = GetExifProfile();
ExifProfile clone = profile.DeepClone();
ExifProfile clone = profile.Clone();
TestProfile(clone);
profile.SetValue(ExifTag.ColorSpace, (ushort)2);
clone = profile.DeepClone();
clone = profile.Clone();
TestProfile(clone);
}

Loading…
Cancel
Save