Browse Source

fix stylecop issues

af/merge-core
Scott Williams 9 years ago
parent
commit
7cc254efb1
  1. 2
      src/ImageSharp.Drawing/Processors/FillProcessor.cs
  2. 2
      src/ImageSharp/Helpers/ImageExtensions.cs
  3. 2
      src/ImageSharp/Image/ImageFrame.LoadPixelData.cs
  4. 32
      src/ImageSharp/Image/Image{TPixel}.cs
  5. 1
      src/ImageSharp/Image/PixelAccessor{TPixel}.cs
  6. 6
      src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs

2
src/ImageSharp.Drawing/Processors/FillProcessor.cs

@ -65,7 +65,7 @@ namespace SixLabors.ImageSharp.Drawing.Processors
}
int width = maxX - minX;
using (var amount = new Buffer<float>(width))
using (BrushApplicator<TPixel> applicator = this.brush.CreateApplicator(source, sourceRectangle, this.options))
{

2
src/ImageSharp/Helpers/ImageExtensions.cs

@ -18,7 +18,6 @@ namespace SixLabors.ImageSharp.Helpers
/// </summary>
public static partial class ImageExtensions
{
/// <summary>
/// Gets the bounds of the image.
/// </summary>
@ -58,6 +57,5 @@ namespace SixLabors.ImageSharp.Helpers
public static Size Size<TPixel>(this ImageFrame<TPixel> source)
where TPixel : struct, IPixel<TPixel>
=> new Size(source.Width, source.Height);
}
}

2
src/ImageSharp/Image/ImageFrame.LoadPixelData.cs

@ -20,7 +20,6 @@ namespace SixLabors.ImageSharp
/// <summary>
/// Create a new instance of the <see cref="Image{TPixel}"/> class from the given byte array in <typeparamref name="TPixel"/> format.
/// </summary>
/// <param name="config">The config for the decoder.</param>
/// <param name="data">The byte array containing image data.</param>
/// <param name="width">The width of the final image.</param>
/// <param name="height">The height of the final image.</param>
@ -33,7 +32,6 @@ namespace SixLabors.ImageSharp
/// <summary>
/// Create a new instance of the <see cref="Image{TPixel}"/> class from the raw <typeparamref name="TPixel"/> data.
/// </summary>
/// <param name="config">The config for the decoder.</param>
/// <param name="data">The Span containing the image Pixel data.</param>
/// <param name="width">The width of the final image.</param>
/// <param name="height">The height of the final image.</param>

32
src/ImageSharp/Image/Image{TPixel}.cs

@ -67,22 +67,6 @@ namespace SixLabors.ImageSharp
{
}
/// <summary>
/// Switches the buffers used by the image and the pixelSource meaning that the Image will "own" the buffer from the pixelSource and the pixelSource will now own the Images buffer.
/// </summary>
/// <param name="pixelSource">The pixel source.</param>
internal void SwapPixelsBuffers(Image<TPixel> pixelSource)
{
Guard.NotNull(pixelSource, nameof(pixelSource));
int newHeight = pixelSource.Height;
for (int i = 0; i < this.Frames.Count; i++)
{
this.Frames[i].SwapPixelsBuffers(pixelSource.Frames[i]);
}
}
/// <summary>
/// Initializes a new instance of the <see cref="Image{TPixel}" /> class
/// with the height and the width of the image.
@ -229,5 +213,21 @@ namespace SixLabors.ImageSharp
this.Frames[i].Dispose();
}
}
/// <summary>
/// Switches the buffers used by the image and the pixelSource meaning that the Image will "own" the buffer from the pixelSource and the pixelSource will now own the Images buffer.
/// </summary>
/// <param name="pixelSource">The pixel source.</param>
internal void SwapPixelsBuffers(Image<TPixel> pixelSource)
{
Guard.NotNull(pixelSource, nameof(pixelSource));
int newHeight = pixelSource.Height;
for (int i = 0; i < this.Frames.Count; i++)
{
this.Frames[i].SwapPixelsBuffers(pixelSource.Frames[i]);
}
}
}
}

1
src/ImageSharp/Image/PixelAccessor{TPixel}.cs

@ -418,6 +418,7 @@ namespace SixLabors.ImageSharp
/// Sets the pixel buffer in an unsafe manor this should not be used unless you know what its doing!!!
/// </summary>
/// <param name="pixels">The pixel buffer</param>
/// <param name="ownedBuffer">if set to <c>true</c> then this instance ownes the buffer and thus should dispose of it afterwards.</param>
private void SetPixelBufferUnsafe(Buffer2D<TPixel> pixels, bool ownedBuffer)
{
this.PixelBuffer = pixels;

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

@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Threading.Tasks;
@ -52,12 +53,13 @@ namespace SixLabors.ImageSharp.Processing.Processors
/// <inheritdoc/>
protected override Image<TPixel> CreateDestination(Image<TPixel> source, Rectangle sourceRectangle)
{
var config = source.Configuration();
Configuration config = source.Configuration();
// We will always be creating the clone even for mutate because thats the way this base processor works
// ------------
// For resize we know we are going to populate every pixel with fresh data and we want a different target size so
// let's manually clone an empty set of images at the correct target and then have the base class processs them in turn.
var frames = source.Frames.Select(x => new ImageFrame<TPixel>(this.Width, this.Height, x.MetaData.Clone())); // this will create places holders
IEnumerable<ImageFrame<TPixel>> frames = source.Frames.Select(x => new ImageFrame<TPixel>(this.Width, this.Height, x.MetaData.Clone())); // this will create places holders
var image = new Image<TPixel>(config, this.Width, this.Height, source.MetaData.Clone(), frames); // base the place holder images in to prevet a extra frame being added
return image;

Loading…
Cancel
Save