Browse Source

Move ImageSharp-specific memory primitives and utils to SixLabors.ImageSharp.Memory

pull/665/head
Anton Firszov 8 years ago
parent
commit
968a9cb186
  1. 2
      src/ImageSharp.Drawing/Primitives/ShapeRegion.cs
  2. 1
      src/ImageSharp.Drawing/Processing/BrushApplicator.cs
  3. 1
      src/ImageSharp.Drawing/Processing/ImageBrush{TPixel}.cs
  4. 1
      src/ImageSharp.Drawing/Processing/PatternBrush{TPixel}.cs
  5. 1
      src/ImageSharp.Drawing/Processing/Processors/Drawing/DrawImageProcessor.cs
  6. 1
      src/ImageSharp.Drawing/Processing/Processors/Drawing/FillProcessor.cs
  7. 1
      src/ImageSharp.Drawing/Processing/Processors/Drawing/FillRegionProcessor.cs
  8. 1
      src/ImageSharp.Drawing/Processing/Processors/Text/DrawTextProcessor.cs
  9. 1
      src/ImageSharp.Drawing/Processing/RecolorBrush{TPixel}.cs
  10. 1
      src/ImageSharp.Drawing/Processing/SolidBrush{TPixel}.cs
  11. 2
      src/ImageSharp/Advanced/AdvancedImageExtensions.cs
  12. 1
      src/ImageSharp/Advanced/IPixelSource.cs
  13. 1
      src/ImageSharp/Common/Extensions/StreamExtensions.cs
  14. 1
      src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs
  15. 1
      src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs
  16. 1
      src/ImageSharp/Formats/Gif/GifDecoderCore.cs
  17. 2
      src/ImageSharp/Formats/Gif/GifEncoderCore.cs
  18. 2
      src/ImageSharp/Formats/Gif/LzwDecoder.cs
  19. 2
      src/ImageSharp/Formats/Gif/LzwEncoder.cs
  20. 1
      src/ImageSharp/Formats/Jpeg/Components/Block8x8F.CopyTo.cs
  21. 1
      src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.cs
  22. 2
      src/ImageSharp/Formats/Jpeg/Components/Decoder/FastACTables.cs
  23. 2
      src/ImageSharp/Formats/Jpeg/Components/Decoder/HuffmanTable.cs
  24. 1
      src/ImageSharp/Formats/Jpeg/Components/Decoder/IJpegComponent.cs
  25. 1
      src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegBlockPostProcessor.cs
  26. 1
      src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponent.cs
  27. 1
      src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponentPostProcessor.cs
  28. 1
      src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegImagePostProcessor.cs
  29. 1
      src/ImageSharp/Formats/Jpeg/Components/GenericBlock8x8.cs
  30. 1
      src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs
  31. 1
      src/ImageSharp/Formats/Png/PngDecoderCore.cs
  32. 1
      src/ImageSharp/Formats/Png/PngEncoderCore.cs
  33. 1
      src/ImageSharp/Image.Decode.cs
  34. 1
      src/ImageSharp/Image.WrapMemory.cs
  35. 1
      src/ImageSharp/ImageExtensions.Internal.cs
  36. 1
      src/ImageSharp/ImageFrameCollection.cs
  37. 1
      src/ImageSharp/ImageFrame{TPixel}.cs
  38. 1
      src/ImageSharp/Image{TPixel}.cs
  39. 3
      src/ImageSharp/Memory/Buffer2DExtensions.cs
  40. 6
      src/ImageSharp/Memory/Buffer2D{T}.cs
  41. 7
      src/ImageSharp/Memory/BufferArea{T}.cs
  42. 8
      src/ImageSharp/Memory/MemoryAllocatorExtensions.cs
  43. 3
      src/ImageSharp/Memory/MemoryOwnerExtensions.cs
  44. 4
      src/ImageSharp/Memory/MemorySource.cs
  45. 2
      src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs
  46. 1
      src/ImageSharp/Processing/Processors/Convolution/Convolution2DProcessor.cs
  47. 2
      src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor.cs
  48. 1
      src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor.cs
  49. 2
      src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorCompassProcessor.cs
  50. 1
      src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor.cs
  51. 1
      src/ImageSharp/Processing/Processors/Normalization/HistogramEqualizationProcessor.cs
  52. 1
      src/ImageSharp/Processing/Processors/Overlays/BackgroundColorProcessor.cs
  53. 1
      src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs
  54. 1
      src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs
  55. 1
      src/ImageSharp/Processing/Processors/Quantization/QuantizedFrame{TPixel}.cs
  56. 1
      src/ImageSharp/Processing/Processors/Quantization/WuFrameQuantizer{TPixel}.cs
  57. 1
      src/ImageSharp/Processing/Processors/Transforms/AffineTransformProcessor.cs
  58. 1
      src/ImageSharp/Processing/Processors/Transforms/FlipProcessor.cs
  59. 1
      src/ImageSharp/Processing/Processors/Transforms/ProjectiveTransformProcessor.cs
  60. 1
      src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs
  61. 2
      src/ImageSharp/Processing/Processors/Transforms/WeightsBuffer.cs
  62. 2
      src/ImageSharp/Processing/Processors/Transforms/WeightsWindow.cs
  63. 46
      tests/ImageSharp.Benchmarks/Codecs/CopyPixels.cs
  64. 17
      tests/ImageSharp.Benchmarks/Codecs/Jpeg/YCbCrColorConversion.cs
  65. 5
      tests/ImageSharp.Benchmarks/Color/Bulk/PackFromVector4.cs
  66. 5
      tests/ImageSharp.Benchmarks/Color/Bulk/PackFromXyzw.cs
  67. 5
      tests/ImageSharp.Benchmarks/Color/Bulk/ToVector4.cs
  68. 5
      tests/ImageSharp.Benchmarks/Color/Bulk/ToXyz.cs
  69. 7
      tests/ImageSharp.Benchmarks/Color/Bulk/ToXyzw.cs
  70. 40
      tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsPixel.cs
  71. 70
      tests/ImageSharp.Benchmarks/Samplers/Glow.cs
  72. 3
      tests/ImageSharp.Tests/Drawing/BeziersTests.cs
  73. 4
      tests/ImageSharp.Tests/Drawing/DrawPathTests.cs
  74. 4
      tests/ImageSharp.Tests/Drawing/FillPatternTests.cs
  75. 4
      tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs
  76. 3
      tests/ImageSharp.Tests/Drawing/LineTests.cs
  77. 3
      tests/ImageSharp.Tests/Drawing/PolygonTests.cs
  78. 3
      tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs
  79. 3
      tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs
  80. 2
      tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.CopyToBufferArea.cs
  81. 3
      tests/ImageSharp.Tests/Formats/Jpg/GenericBlock8x8Tests.cs
  82. 3
      tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs
  83. 5
      tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.ComponentData.cs
  84. 2
      tests/ImageSharp.Tests/Memory/Buffer2DTests.cs
  85. 21
      tests/ImageSharp.Tests/Memory/BufferAreaTests.cs
  86. 5
      tests/ImageSharp.Tests/Memory/MemorySourceTests.cs
  87. 2
      tests/ImageSharp.Tests/PixelFormats/PixelOperationsTests.cs
  88. 3
      tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs
  89. 2
      tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingBridge.cs
  90. 1
      tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs
  91. 6
      tests/ImageSharp.Tests/TestUtilities/TestUtils.cs
  92. 1
      tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs
  93. 2
      tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs

2
src/ImageSharp.Drawing/Primitives/ShapeRegion.cs

@ -3,6 +3,8 @@
using System;
using System.Buffers;
using SixLabors.ImageSharp.Memory;
using SixLabors.Memory;
using SixLabors.Primitives;
using SixLabors.Shapes;

1
src/ImageSharp.Drawing/Processing/BrushApplicator.cs

@ -5,6 +5,7 @@ using System;
using System.Buffers;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;

1
src/ImageSharp.Drawing/Processing/ImageBrush{TPixel}.cs

@ -4,6 +4,7 @@
using System;
using System.Buffers;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;
using SixLabors.Primitives;

1
src/ImageSharp.Drawing/Processing/PatternBrush{TPixel}.cs

@ -5,6 +5,7 @@ using System;
using System.Buffers;
using System.Numerics;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using SixLabors.Memory;

1
src/ImageSharp.Drawing/Processing/Processors/Drawing/DrawImageProcessor.cs

@ -5,6 +5,7 @@ using System;
using System.Buffers;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;
using SixLabors.Primitives;

1
src/ImageSharp.Drawing/Processing/Processors/Drawing/FillProcessor.cs

@ -5,6 +5,7 @@ using System;
using System.Buffers;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;
using SixLabors.Primitives;

1
src/ImageSharp.Drawing/Processing/Processors/Drawing/FillRegionProcessor.cs

@ -4,6 +4,7 @@
using System;
using System.Buffers;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Utils;

1
src/ImageSharp.Drawing/Processing/Processors/Text/DrawTextProcessor.cs

@ -6,6 +6,7 @@ using System.Buffers;
using System.Collections.Generic;
using SixLabors.Fonts;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Utils;
using SixLabors.Memory;

1
src/ImageSharp.Drawing/Processing/RecolorBrush{TPixel}.cs

@ -5,6 +5,7 @@ using System;
using System.Buffers;
using System.Numerics;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;
using SixLabors.Primitives;

1
src/ImageSharp.Drawing/Processing/SolidBrush{TPixel}.cs

@ -5,6 +5,7 @@ using System;
using System.Buffers;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;
using SixLabors.Primitives;

2
src/ImageSharp/Advanced/AdvancedImageExtensions.cs

@ -3,6 +3,8 @@
using System;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;

1
src/ImageSharp/Advanced/IPixelSource.cs

@ -1,6 +1,7 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;

1
src/ImageSharp/Common/Extensions/StreamExtensions.cs

@ -4,6 +4,7 @@
using System;
using System.IO;
using SixLabors.ImageSharp.Memory;
using SixLabors.Memory;
namespace SixLabors.ImageSharp

1
src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs

@ -6,6 +6,7 @@ using System.Buffers.Binary;
using System.IO;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Common.Helpers;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.MetaData;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;

1
src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs

@ -4,6 +4,7 @@
using System;
using System.IO;
using SixLabors.ImageSharp.Common.Helpers;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.MetaData;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;

1
src/ImageSharp/Formats/Gif/GifDecoderCore.cs

@ -7,6 +7,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.MetaData;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;

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

@ -7,6 +7,8 @@ using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.MetaData;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors.Quantization;

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

@ -6,6 +6,8 @@ using System.Buffers;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Memory;
using SixLabors.Memory;
namespace SixLabors.ImageSharp.Formats.Gif

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

@ -6,6 +6,8 @@ using System.Buffers;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Memory;
using SixLabors.Memory;
namespace SixLabors.ImageSharp.Formats.Gif

1
src/ImageSharp/Formats/Jpeg/Components/Block8x8F.CopyTo.cs

@ -4,6 +4,7 @@
using System.Numerics;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Memory;
using SixLabors.Memory;
// ReSharper disable InconsistentNaming

1
src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.cs

@ -7,6 +7,7 @@ using System.Linq;
using System.Numerics;
using SixLabors.ImageSharp.Common.Tuples;
using SixLabors.ImageSharp.Memory;
using SixLabors.Memory;
namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters

2
src/ImageSharp/Formats/Jpeg/Components/Decoder/FastACTables.cs

@ -3,6 +3,8 @@
using System;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Memory;
using SixLabors.Memory;
namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder

2
src/ImageSharp/Formats/Jpeg/Components/Decoder/HuffmanTable.cs

@ -5,6 +5,8 @@ using System;
using System.Buffers;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Memory;
using SixLabors.Memory;
namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder

1
src/ImageSharp/Formats/Jpeg/Components/Decoder/IJpegComponent.cs

@ -1,6 +1,7 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Memory;
using SixLabors.Memory;
using SixLabors.Primitives;

1
src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegBlockPostProcessor.cs

@ -3,6 +3,7 @@
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Memory;
using SixLabors.Memory;
using SixLabors.Primitives;

1
src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponent.cs

@ -5,6 +5,7 @@ using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Memory;
using SixLabors.Memory;
using SixLabors.Primitives;

1
src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponentPostProcessor.cs

@ -3,6 +3,7 @@
using System;
using SixLabors.ImageSharp.Memory;
using SixLabors.Memory;
using SixLabors.Primitives;

1
src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegImagePostProcessor.cs

@ -6,6 +6,7 @@ using System.Buffers;
using System.Linq;
using System.Numerics;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;
using SixLabors.Primitives;

1
src/ImageSharp/Formats/Jpeg/Components/GenericBlock8x8.cs

@ -5,6 +5,7 @@ using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;

1
src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs

@ -11,6 +11,7 @@ using SixLabors.ImageSharp.Common.Helpers;
using SixLabors.ImageSharp.Formats.Jpeg.Components;
using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder;
using SixLabors.ImageSharp.IO;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.MetaData;
using SixLabors.ImageSharp.MetaData.Profiles.Exif;
using SixLabors.ImageSharp.MetaData.Profiles.Icc;

1
src/ImageSharp/Formats/Png/PngDecoderCore.cs

@ -13,6 +13,7 @@ using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Common.Helpers;
using SixLabors.ImageSharp.Formats.Png.Filters;
using SixLabors.ImageSharp.Formats.Png.Zlib;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.MetaData;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;

1
src/ImageSharp/Formats/Png/PngEncoderCore.cs

@ -9,6 +9,7 @@ using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Common.Helpers;
using SixLabors.ImageSharp.Formats.Png.Filters;
using SixLabors.ImageSharp.Formats.Png.Zlib;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.MetaData;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors.Quantization;

1
src/ImageSharp/Image.Decode.cs

@ -4,6 +4,7 @@
using System.IO;
using System.Linq;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;

1
src/ImageSharp/Image.WrapMemory.cs

@ -4,6 +4,7 @@
using System;
using System.Buffers;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.MetaData;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;

1
src/ImageSharp/ImageExtensions.Internal.cs

@ -1,6 +1,7 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;

1
src/ImageSharp/ImageFrameCollection.cs

@ -5,6 +5,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;

1
src/ImageSharp/ImageFrame{TPixel}.cs

@ -7,6 +7,7 @@ using System.Numerics;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.MetaData;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;

1
src/ImageSharp/Image{TPixel}.cs

@ -8,6 +8,7 @@ using System.Linq;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.MetaData;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;

3
src/ImageSharp/Memory/Buffer2DExtensions.cs

@ -3,9 +3,10 @@
using System;
using System.Runtime.CompilerServices;
using SixLabors.Primitives;
namespace SixLabors.Memory
namespace SixLabors.ImageSharp.Memory
{
/// <summary>
/// Defines extension methods for <see cref="Buffer2D{T}"/>.

6
src/ImageSharp/Memory/Buffer2D{T}.cs

@ -2,11 +2,11 @@
// Licensed under the Apache License, Version 2.0.
using System;
using System.Buffers;
using System.Runtime.CompilerServices;
using SixLabors.Primitives;
namespace SixLabors.Memory
namespace SixLabors.ImageSharp.Memory
{
/// <summary>
/// Represents a buffer of value type objects
@ -62,7 +62,7 @@ namespace SixLabors.Memory
get
{
ImageSharp.DebugGuard.MustBeLessThan(x, this.Width, nameof(x));
DebugGuard.MustBeLessThan(y, this.Height, nameof(y));
SixLabors.DebugGuard.MustBeLessThan(y, this.Height, nameof(y));
Span<T> span = this.Span;
return ref span[(this.Width * y) + x];
}

7
src/ImageSharp/Memory/BufferArea{T}.cs

@ -1,8 +1,11 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
using System.Runtime.CompilerServices;
using SixLabors.Primitives;
namespace SixLabors.Memory
namespace SixLabors.ImageSharp.Memory
{
/// <summary>
/// Represents a rectangular area inside a 2D memory buffer (<see cref="Buffer2D{T}"/>).
@ -120,7 +123,7 @@ namespace SixLabors.Memory
public BufferArea<T> GetSubArea(Rectangle rectangle)
{
ImageSharp.DebugGuard.MustBeLessThanOrEqualTo(rectangle.Width, this.Rectangle.Width, nameof(rectangle));
DebugGuard.MustBeLessThanOrEqualTo(rectangle.Height, this.Rectangle.Height, nameof(rectangle));
SixLabors.DebugGuard.MustBeLessThanOrEqualTo(rectangle.Height, this.Rectangle.Height, nameof(rectangle));
int x = this.Rectangle.X + rectangle.X;
int y = this.Rectangle.Y + rectangle.Y;

8
src/ImageSharp/Memory/MemoryAllocatorExtensions.cs

@ -1,8 +1,12 @@
using System.Buffers;
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System.Buffers;
using SixLabors.Memory;
using SixLabors.Primitives;
namespace SixLabors.Memory
namespace SixLabors.ImageSharp.Memory
{
/// <summary>
/// Extension methods for <see cref="MemoryAllocator"/>.

3
src/ImageSharp/Memory/MemoryOwnerExtensions.cs

@ -3,11 +3,10 @@
using System;
using System.Buffers;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace SixLabors.Memory
namespace SixLabors.ImageSharp.Memory
{
/// <summary>
/// Extension methods for <see cref="IMemoryOwner{T}"/>

4
src/ImageSharp/Memory/MemorySource.cs

@ -4,7 +4,9 @@
using System;
using System.Buffers;
namespace SixLabors.Memory
using SixLabors.Memory;
namespace SixLabors.ImageSharp.Memory
{
/// <summary>
/// Holds a <see cref="System.Memory{T}"/> that is either OWNED or CONSUMED.

2
src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs

@ -5,6 +5,8 @@
using System;
using System.Numerics;
using System.Buffers;
using SixLabors.ImageSharp.Memory;
using SixLabors.Memory;
namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders

1
src/ImageSharp/Processing/Processors/Convolution/Convolution2DProcessor.cs

@ -5,6 +5,7 @@ using System;
using System.Numerics;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using SixLabors.Memory;

2
src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor.cs

@ -4,6 +4,8 @@
using System;
using System.Numerics;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing.Processors;

1
src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor.cs

@ -5,6 +5,7 @@ using System;
using System.Numerics;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing.Processors;

2
src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorCompassProcessor.cs

@ -6,6 +6,8 @@ using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing.Processors.Filters;

1
src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor.cs

@ -5,6 +5,7 @@ using System;
using System.Numerics;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;
using SixLabors.Primitives;

1
src/ImageSharp/Processing/Processors/Normalization/HistogramEqualizationProcessor.cs

@ -6,6 +6,7 @@ using System.Buffers;
using System.Numerics;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;
using SixLabors.Primitives;

1
src/ImageSharp/Processing/Processors/Overlays/BackgroundColorProcessor.cs

@ -5,6 +5,7 @@ using System;
using System.Buffers;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;
using SixLabors.Primitives;

1
src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs

@ -6,6 +6,7 @@ using System.Buffers;
using System.Numerics;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using SixLabors.Memory;

1
src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs

@ -6,6 +6,7 @@ using System.Buffers;
using System.Numerics;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using SixLabors.Memory;

1
src/ImageSharp/Processing/Processors/Quantization/QuantizedFrame{TPixel}.cs

@ -4,6 +4,7 @@
using System;
using System.Buffers;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;

1
src/ImageSharp/Processing/Processors/Quantization/WuFrameQuantizer{TPixel}.cs

@ -8,6 +8,7 @@ using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;

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

@ -9,6 +9,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;
using SixLabors.Primitives;

1
src/ImageSharp/Processing/Processors/Transforms/FlipProcessor.cs

@ -4,6 +4,7 @@
using System;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;
using SixLabors.Primitives;

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

@ -9,6 +9,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;
using SixLabors.Primitives;

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

@ -10,6 +10,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;
using SixLabors.Primitives;

2
src/ImageSharp/Processing/Processors/Transforms/WeightsBuffer.cs

@ -2,6 +2,8 @@
// Licensed under the Apache License, Version 2.0.
using System;
using SixLabors.ImageSharp.Memory;
using SixLabors.Memory;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms

2
src/ImageSharp/Processing/Processors/Transforms/WeightsWindow.cs

@ -6,6 +6,8 @@ using System.Buffers;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Memory;
using SixLabors.Memory;
namespace SixLabors.ImageSharp.Processing.Processors.Transforms

46
tests/ImageSharp.Benchmarks/Codecs/CopyPixels.cs

@ -1,19 +1,17 @@
// <copyright file="CopyPixels.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
using System;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Benchmarks.Codecs
{
using System;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using SixLabors.ImageSharp.Advanced;
using SixLabors.Memory;
public class CopyPixels : BenchmarkBase
{
[Benchmark(Baseline = true, Description = "PixelAccessor Copy by indexer")]
@ -78,12 +76,12 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs
source.Height,
Configuration.Default.ParallelOptions,
y =>
{
for (int x = 0; x < source.Width; x++)
{
target[x, y] = source[x, y];
}
});
for (int x = 0; x < source.Width; x++)
{
target[x, y] = source[x, y];
}
});
return target[0, 0];
}
@ -100,18 +98,18 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs
source.Height,
Configuration.Default.ParallelOptions,
y =>
{
Span<Rgba32> sourceRow = source.Frames.RootFrame.GetPixelRowSpan(y);
Span<Rgba32> targetRow = target.Frames.RootFrame.GetPixelRowSpan(y);
for (int x = 0; x < source.Width; x++)
{
targetRow[x] = sourceRow[x];
}
});
Span<Rgba32> sourceRow = source.Frames.RootFrame.GetPixelRowSpan(y);
Span<Rgba32> targetRow = target.Frames.RootFrame.GetPixelRowSpan(y);
for (int x = 0; x < source.Width; x++)
{
targetRow[x] = sourceRow[x];
}
});
return target[0, 0];
}
}
}
}
}

17
tests/ImageSharp.Benchmarks/Codecs/Jpeg/YCbCrColorConversion.cs

@ -1,14 +1,16 @@
using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters;
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg
{
using System;
using System.Numerics;
using System;
using System.Numerics;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes;
using SixLabors.Memory;
using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters;
using SixLabors.ImageSharp.Memory;
namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg
{
[Config(typeof(Config.ShortClr))]
public class YCbCrColorConversion
{
@ -81,6 +83,5 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg
return buffers;
}
}
}

5
tests/ImageSharp.Benchmarks/Color/Bulk/PackFromVector4.cs

@ -1,3 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
// ReSharper disable InconsistentNaming
using System.Buffers;
@ -7,7 +10,7 @@ using System.Runtime.InteropServices;
using BenchmarkDotNet.Attributes;
using SixLabors.Memory;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Benchmarks.ColorSpaces.Bulk

5
tests/ImageSharp.Benchmarks/Color/Bulk/PackFromXyzw.cs

@ -1,3 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
// ReSharper disable InconsistentNaming
using System.Buffers;
@ -5,7 +8,7 @@ using System;
using BenchmarkDotNet.Attributes;
using SixLabors.Memory;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Benchmarks.ColorSpaces.Bulk

5
tests/ImageSharp.Benchmarks/Color/Bulk/ToVector4.cs

@ -1,3 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
// ReSharper disable InconsistentNaming
using System.Buffers;
@ -6,7 +9,7 @@ using System.Numerics;
using BenchmarkDotNet.Attributes;
using SixLabors.Memory;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Benchmarks.ColorSpaces.Bulk

5
tests/ImageSharp.Benchmarks/Color/Bulk/ToXyz.cs

@ -1,3 +1,6 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
// ReSharper disable InconsistentNaming
using System.Buffers;
@ -5,7 +8,7 @@ using System;
using BenchmarkDotNet.Attributes;
using SixLabors.Memory;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Benchmarks.ColorSpaces.Bulk

7
tests/ImageSharp.Benchmarks/Color/Bulk/ToXyzw.cs

@ -1,8 +1,11 @@
using System;
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
using System.Buffers;
using BenchmarkDotNet.Attributes;
using SixLabors.Memory;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
// ReSharper disable InconsistentNaming

40
tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsPixel.cs

@ -1,32 +1,35 @@
// <copyright file="Crop.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
using System;
using System.Buffers;
using System.Numerics;
using BenchmarkDotNet.Attributes;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.PixelFormats.PixelBlenders;
namespace SixLabors.ImageSharp.Benchmarks
{
using System;
using BenchmarkDotNet.Attributes;
using SixLabors.ImageSharp.PixelFormats;
using CoreSize = SixLabors.Primitives.Size;
using System.Numerics;
using SixLabors.Memory;
using SixLabors.ImageSharp.PixelFormats.PixelBlenders;
public class PorterDuffBulkVsPixel : BenchmarkBase
{
private void BulkVectorConvert<TPixel>(Span<TPixel> destination, Span<TPixel> background, Span<TPixel> source, Span<float> amount)
private void BulkVectorConvert<TPixel>(
Span<TPixel> destination,
Span<TPixel> background,
Span<TPixel> source,
Span<float> amount)
where TPixel : struct, IPixel<TPixel>
{
Guard.MustBeGreaterThanOrEqualTo(background.Length, destination.Length, nameof(background.Length));
Guard.MustBeGreaterThanOrEqualTo(source.Length, destination.Length, nameof(source.Length));
Guard.MustBeGreaterThanOrEqualTo(amount.Length, destination.Length, nameof(amount.Length));
using (IMemoryOwner<Vector4> buffer = Configuration.Default.MemoryAllocator.Allocate<Vector4>(destination.Length * 3))
using (IMemoryOwner<Vector4> buffer =
Configuration.Default.MemoryAllocator.Allocate<Vector4>(destination.Length * 3))
{
Span<Vector4> destinationSpan = buffer.Slice(0, destination.Length);
Span<Vector4> backgroundSpan = buffer.Slice(destination.Length, destination.Length);
@ -43,8 +46,13 @@ namespace SixLabors.ImageSharp.Benchmarks
PixelOperations<TPixel>.Instance.PackFromVector4(destinationSpan, destination, destination.Length);
}
}
private void BulkPixelConvert<TPixel>(Span<TPixel> destination, Span<TPixel> background, Span<TPixel> source, Span<float> amount)
where TPixel : struct, IPixel<TPixel>
private void BulkPixelConvert<TPixel>(
Span<TPixel> destination,
Span<TPixel> background,
Span<TPixel> source,
Span<float> amount)
where TPixel : struct, IPixel<TPixel>
{
Guard.MustBeGreaterThanOrEqualTo(destination.Length, background.Length, nameof(destination));
Guard.MustBeGreaterThanOrEqualTo(source.Length, background.Length, nameof(destination));
@ -97,4 +105,4 @@ namespace SixLabors.ImageSharp.Benchmarks
}
}
}
}
}

70
tests/ImageSharp.Benchmarks/Samplers/Glow.cs

@ -1,29 +1,27 @@
// <copyright file="Crop.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
using System;
using System.Buffers;
using System.Numerics;
using System.Threading.Tasks;
namespace SixLabors.ImageSharp.Benchmarks
{
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing.Processors;
using SixLabors.ImageSharp.Processing.Processors.Overlays;
using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Benchmarks
{
using CoreSize = SixLabors.Primitives.Size;
using System.Numerics;
using System;
using System.Threading.Tasks;
using SixLabors.Memory;
using SixLabors.Primitives;
using SixLabors.ImageSharp.Processing.Processors.Overlays;
using SixLabors.ImageSharp.Processing.Processors;
public class Glow : BenchmarkBase
{
private GlowProcessor<Rgba32> bulk;
private GlowProcessorParallel<Rgba32> parallel;
[GlobalSetup]
@ -31,8 +29,8 @@ namespace SixLabors.ImageSharp.Benchmarks
{
this.bulk = new GlowProcessor<Rgba32>(NamedColors<Rgba32>.Beige, 800 * .5f, GraphicsOptions.Default);
this.parallel = new GlowProcessorParallel<Rgba32>(NamedColors<Rgba32>.Beige) { Radius = 800 * .5f, };
}
[Benchmark(Description = "ImageSharp Glow - Bulk")]
public CoreSize GlowBulk()
{
@ -76,7 +74,10 @@ namespace SixLabors.ImageSharp.Benchmarks
public float Radius { get; set; }
/// <inheritdoc/>
protected override void OnFrameApply(ImageFrame<TPixel> source, Rectangle sourceRectangle, Configuration configuration)
protected override void OnFrameApply(
ImageFrame<TPixel> source,
Rectangle sourceRectangle,
Configuration configuration)
{
int startY = sourceRectangle.Y;
int endY = sourceRectangle.Bottom;
@ -84,7 +85,9 @@ namespace SixLabors.ImageSharp.Benchmarks
int endX = sourceRectangle.Right;
TPixel glowColor = this.GlowColor;
Vector2 centre = Rectangle.Center(sourceRectangle);
float maxDistance = this.Radius > 0 ? Math.Min(this.Radius, sourceRectangle.Width * .5F) : sourceRectangle.Width * .5F;
float maxDistance = this.Radius > 0
? Math.Min(this.Radius, sourceRectangle.Width * .5F)
: sourceRectangle.Width * .5F;
// Align start/end positions.
int minX = Math.Max(0, startX);
@ -114,21 +117,26 @@ namespace SixLabors.ImageSharp.Benchmarks
maxY,
configuration.ParallelOptions,
y =>
{
int offsetY = y - startY;
for (int x = minX; x < maxX; x++)
{
int offsetX = x - startX;
float distance = Vector2.Distance(centre, new Vector2(offsetX, offsetY));
Vector4 sourceColor = sourcePixels[offsetX, offsetY].ToVector4();
TPixel packed = default(TPixel);
packed.PackFromVector4(PremultipliedLerp(sourceColor, glowColor.ToVector4(), 1 - (.95F * (distance / maxDistance))));
sourcePixels[offsetX, offsetY] = packed;
}
});
int offsetY = y - startY;
for (int x = minX; x < maxX; x++)
{
int offsetX = x - startX;
float distance = Vector2.Distance(centre, new Vector2(offsetX, offsetY));
Vector4 sourceColor = sourcePixels[offsetX, offsetY].ToVector4();
TPixel packed = default(TPixel);
packed.PackFromVector4(
PremultipliedLerp(
sourceColor,
glowColor.ToVector4(),
1 - (.95F * (distance / maxDistance))));
sourcePixels[offsetX, offsetY] = packed;
}
});
}
}
public static Vector4 PremultipliedLerp(Vector4 backdrop, Vector4 source, float amount)
{
amount = amount.Clamp(0, 1);
@ -162,4 +170,4 @@ namespace SixLabors.ImageSharp.Benchmarks
}
}
}
}
}

3
tests/ImageSharp.Tests/Drawing/BeziersTests.cs

@ -3,9 +3,10 @@
using System.Numerics;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.Memory;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing

4
tests/ImageSharp.Tests/Drawing/DrawPathTests.cs

@ -2,6 +2,8 @@
// Licensed under the Apache License, Version 2.0.
using System.Numerics;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.Shapes;
@ -9,8 +11,6 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
using SixLabors.Memory;
public class DrawPathTests : FileTestBase
{
[Fact]

4
tests/ImageSharp.Tests/Drawing/FillPatternTests.cs

@ -2,10 +2,12 @@
// Licensed under the Apache License, Version 2.0.
using System;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Primitives;
using SixLabors.ImageSharp.Processing;
using SixLabors.Memory;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing

4
tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs

@ -2,6 +2,8 @@
// Licensed under the Apache License, Version 2.0.
using System.Numerics;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.Shapes;
@ -10,8 +12,6 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
using SixLabors.Memory;
public class LineComplexPolygonTests : FileTestBase
{
[Fact]

3
tests/ImageSharp.Tests/Drawing/LineTests.cs

@ -3,6 +3,7 @@
using System.Numerics;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
@ -10,8 +11,6 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
using SixLabors.Memory;
public class LineTests : FileTestBase
{
[Fact]

3
tests/ImageSharp.Tests/Drawing/PolygonTests.cs

@ -3,6 +3,7 @@
using System.Numerics;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Primitives;
using SixLabors.ImageSharp.Processing;
@ -10,8 +11,6 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
using SixLabors.Memory;
public class PolygonTests : FileTestBase
{
[Fact]

3
tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs

@ -3,6 +3,7 @@
using System.Numerics;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.Shapes;
@ -11,8 +12,6 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
using SixLabors.Memory;
public class SolidComplexPolygonTests : FileTestBase
{
[Fact]

3
tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs

@ -4,6 +4,7 @@
using System;
using System.Numerics;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.Shapes;
@ -12,8 +13,6 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Drawing
{
using SixLabors.Memory;
public class SolidPolygonTests : FileTestBase
{
[Fact]

2
tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.CopyToBufferArea.cs

@ -5,7 +5,7 @@
//#define BENCHMARKING
using SixLabors.ImageSharp.Formats.Jpeg.Components;
using SixLabors.Memory;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.Tests.Formats.Jpg.Utils;
using SixLabors.Primitives;

3
tests/ImageSharp.Tests/Formats/Jpg/GenericBlock8x8Tests.cs

@ -4,14 +4,13 @@
using System;
using SixLabors.ImageSharp.Formats.Jpeg.Components;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Formats.Jpg
{
using SixLabors.Memory;
public class GenericBlock8x8Tests
{
public static Image<TPixel> CreateTestImage<TPixel>()

3
tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs

@ -8,8 +8,7 @@ using SixLabors.ImageSharp.ColorSpaces;
using SixLabors.ImageSharp.ColorSpaces.Conversion;
using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder;
using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters;
using SixLabors.ImageSharp.Tests.Memory;
using SixLabors.Memory;
using SixLabors.ImageSharp.Memory;
using Xunit;
using Xunit.Abstractions;

5
tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.ComponentData.cs

@ -1,11 +1,14 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
using System.Linq;
using System.Numerics;
using SixLabors.ImageSharp.Formats.Jpeg.Components;
using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;
using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils

2
tests/ImageSharp.Tests/Memory/Buffer2DTests.cs

@ -6,7 +6,7 @@ using System.Buffers;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Memory;
using SixLabors.Memory;
using SixLabors.Primitives;

21
tests/ImageSharp.Tests/Memory/BufferAreaTests.cs

@ -1,13 +1,13 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
using SixLabors.ImageSharp.Memory;
using SixLabors.Primitives;
using Xunit;
// ReSharper disable InconsistentNaming
namespace SixLabors.ImageSharp.Tests.Memory
{
using System;
using SixLabors.Memory;
using SixLabors.Primitives;
using Xunit;
public class BufferAreaTests
{
[Fact]
@ -15,7 +15,7 @@ namespace SixLabors.ImageSharp.Tests.Memory
{
using (var buffer = Configuration.Default.MemoryAllocator.Allocate2D<int>(10, 20))
{
var rectangle = new Rectangle(3,2, 5, 6);
var rectangle = new Rectangle(3, 2, 5, 6);
var area = new BufferArea<int>(buffer, rectangle);
Assert.Equal(buffer, area.DestinationBuffer);
@ -33,9 +33,10 @@ namespace SixLabors.ImageSharp.Tests.Memory
buffer[x, y] = y * 100 + x;
}
}
return buffer;
}
[Theory]
[InlineData(2, 3, 2, 2)]
[InlineData(5, 4, 3, 2)]
@ -44,7 +45,7 @@ namespace SixLabors.ImageSharp.Tests.Memory
using (Buffer2D<int> buffer = CreateTestBuffer(20, 30))
{
Rectangle r = new Rectangle(rx, ry, 5, 6);
BufferArea<int> area = buffer.GetArea(r);
int value = area[x, y];

5
tests/ImageSharp.Tests/Memory/MemorySourceTests.cs

@ -3,13 +3,12 @@
using System;
using System.Buffers;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.Memory;
using Xunit;
// ReSharper disable InconsistentNaming
// ReSharper disable InconsistentNaming
namespace SixLabors.ImageSharp.Tests.Memory
{
public class MemorySourceTests

2
tests/ImageSharp.Tests/PixelFormats/PixelOperationsTests.cs

@ -6,7 +6,7 @@ using System.Buffers;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.Memory;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using Xunit;
using Xunit.Abstractions;

3
tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs

@ -5,12 +5,11 @@ using System;
using System.Collections.Generic;
using System.Numerics;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Tests
{
using SixLabors.Memory;
public abstract partial class TestImageProvider<TPixel>
where TPixel : struct, IPixel<TPixel>
{

2
tests/ImageSharp.Tests/TestUtilities/ReferenceCodecs/SystemDrawingBridge.cs

@ -7,7 +7,7 @@ using System.Drawing;
using System.Drawing.Imaging;
using SixLabors.ImageSharp.Advanced;
using SixLabors.Memory;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Tests.TestUtilities.ReferenceCodecs

1
tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs

@ -8,6 +8,7 @@ using System.Numerics;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Memory;
using SixLabors.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;

6
tests/ImageSharp.Tests/TestUtilities/TestUtils.cs

@ -6,7 +6,8 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using SixLabors.ImageSharp.Advanced;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
@ -14,9 +15,6 @@ using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Tests
{
using SixLabors.ImageSharp.Advanced;
using SixLabors.Memory;
/// <summary>
/// Various utility and extension methods.
/// </summary>

1
tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs

@ -10,6 +10,7 @@ using System.Collections.Concurrent;
using System.IO;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Memory;
namespace SixLabors.ImageSharp.Tests
{

2
tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs

@ -6,9 +6,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.Memory;
using Xunit;
using Xunit.Abstractions;

Loading…
Cancel
Save