Browse Source

Fix build after merge

pull/1851/head
Ynse Hoornenborg 5 years ago
parent
commit
3730a0259a
  1. 10
      src/ImageSharp/Formats/Pbm/BinaryDecoder.cs
  2. 15
      src/ImageSharp/Formats/Pbm/BinaryEncoder.cs
  3. 10
      src/ImageSharp/Formats/Pbm/PlainDecoder.cs
  4. 15
      src/ImageSharp/Formats/Pbm/PlainEncoder.cs
  5. 4
      tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageComparingUtils.cs

10
src/ImageSharp/Formats/Pbm/BinaryDecoder.cs

@ -73,7 +73,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
for (int y = 0; y < height; y++)
{
stream.Read(rowSpan);
Span<TPixel> pixelSpan = pixels.GetRowSpan(y);
Span<TPixel> pixelSpan = pixels.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.FromL8Bytes(
configuration,
rowSpan,
@ -95,7 +95,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
for (int y = 0; y < height; y++)
{
stream.Read(rowSpan);
Span<TPixel> pixelSpan = pixels.GetRowSpan(y);
Span<TPixel> pixelSpan = pixels.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.FromL16Bytes(
configuration,
rowSpan,
@ -117,7 +117,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
for (int y = 0; y < height; y++)
{
stream.Read(rowSpan);
Span<TPixel> pixelSpan = pixels.GetRowSpan(y);
Span<TPixel> pixelSpan = pixels.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.FromRgb24Bytes(
configuration,
rowSpan,
@ -139,7 +139,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
for (int y = 0; y < height; y++)
{
stream.Read(rowSpan);
Span<TPixel> pixelSpan = pixels.GetRowSpan(y);
Span<TPixel> pixelSpan = pixels.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.FromRgb48Bytes(
configuration,
rowSpan,
@ -183,7 +183,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
}
}
Span<TPixel> pixelSpan = pixels.GetRowSpan(y);
Span<TPixel> pixelSpan = pixels.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.FromL8(
configuration,
rowSpan,

15
src/ImageSharp/Formats/Pbm/BinaryEncoder.cs

@ -62,13 +62,14 @@ namespace SixLabors.ImageSharp.Formats.Pbm
{
int width = image.Width;
int height = image.Height;
Buffer2D<TPixel> pixelBuffer = image.PixelBuffer;
MemoryAllocator allocator = configuration.MemoryAllocator;
using IMemoryOwner<byte> row = allocator.Allocate<byte>(width);
Span<byte> rowSpan = row.GetSpan();
for (int y = 0; y < height; y++)
{
Span<TPixel> pixelSpan = image.GetPixelRowSpan(y);
Span<TPixel> pixelSpan = pixelBuffer.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.ToL8Bytes(
configuration,
@ -86,13 +87,14 @@ namespace SixLabors.ImageSharp.Formats.Pbm
const int bytesPerPixel = 2;
int width = image.Width;
int height = image.Height;
Buffer2D<TPixel> pixelBuffer = image.PixelBuffer;
MemoryAllocator allocator = configuration.MemoryAllocator;
using IMemoryOwner<byte> row = allocator.Allocate<byte>(width * bytesPerPixel);
Span<byte> rowSpan = row.GetSpan();
for (int y = 0; y < height; y++)
{
Span<TPixel> pixelSpan = image.GetPixelRowSpan(y);
Span<TPixel> pixelSpan = pixelBuffer.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.ToL16Bytes(
configuration,
@ -110,13 +112,14 @@ namespace SixLabors.ImageSharp.Formats.Pbm
const int bytesPerPixel = 3;
int width = image.Width;
int height = image.Height;
Buffer2D<TPixel> pixelBuffer = image.PixelBuffer;
MemoryAllocator allocator = configuration.MemoryAllocator;
using IMemoryOwner<byte> row = allocator.Allocate<byte>(width * bytesPerPixel);
Span<byte> rowSpan = row.GetSpan();
for (int y = 0; y < height; y++)
{
Span<TPixel> pixelSpan = image.GetPixelRowSpan(y);
Span<TPixel> pixelSpan = pixelBuffer.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.ToRgb24Bytes(
configuration,
@ -134,13 +137,14 @@ namespace SixLabors.ImageSharp.Formats.Pbm
const int bytesPerPixel = 6;
int width = image.Width;
int height = image.Height;
Buffer2D<TPixel> pixelBuffer = image.PixelBuffer;
MemoryAllocator allocator = configuration.MemoryAllocator;
using IMemoryOwner<byte> row = allocator.Allocate<byte>(width * bytesPerPixel);
Span<byte> rowSpan = row.GetSpan();
for (int y = 0; y < height; y++)
{
Span<TPixel> pixelSpan = image.GetPixelRowSpan(y);
Span<TPixel> pixelSpan = pixelBuffer.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.ToRgb48Bytes(
configuration,
@ -157,6 +161,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
{
int width = image.Width;
int height = image.Height;
Buffer2D<TPixel> pixelBuffer = image.PixelBuffer;
MemoryAllocator allocator = configuration.MemoryAllocator;
using IMemoryOwner<L8> row = allocator.Allocate<L8>(width);
Span<L8> rowSpan = row.GetSpan();
@ -165,7 +170,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
int startBit = 0;
for (int y = 0; y < height; y++)
{
Span<TPixel> pixelSpan = image.GetPixelRowSpan(y);
Span<TPixel> pixelSpan = pixelBuffer.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.ToL8(
configuration,

10
src/ImageSharp/Formats/Pbm/PlainDecoder.cs

@ -75,7 +75,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
rowSpan[x] = new L8(value);
}
Span<TPixel> pixelSpan = pixels.GetRowSpan(y);
Span<TPixel> pixelSpan = pixels.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.FromL8(
configuration,
rowSpan,
@ -101,7 +101,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
rowSpan[x] = new L16(value);
}
Span<TPixel> pixelSpan = pixels.GetRowSpan(y);
Span<TPixel> pixelSpan = pixels.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.FromL16(
configuration,
rowSpan,
@ -131,7 +131,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
rowSpan[x] = new Rgb24(red, green, blue);
}
Span<TPixel> pixelSpan = pixels.GetRowSpan(y);
Span<TPixel> pixelSpan = pixels.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.FromRgb24(
configuration,
rowSpan,
@ -161,7 +161,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
rowSpan[x] = new Rgb48(red, green, blue);
}
Span<TPixel> pixelSpan = pixels.GetRowSpan(y);
Span<TPixel> pixelSpan = pixels.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.FromRgb48(
configuration,
rowSpan,
@ -187,7 +187,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
rowSpan[x] = value == 0 ? White : Black;
}
Span<TPixel> pixelSpan = pixels.GetRowSpan(y);
Span<TPixel> pixelSpan = pixels.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.FromL8(
configuration,
rowSpan,

15
src/ImageSharp/Formats/Pbm/PlainEncoder.cs

@ -76,6 +76,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
{
int width = image.Width;
int height = image.Height;
Buffer2D<TPixel> pixelBuffer = image.PixelBuffer;
MemoryAllocator allocator = configuration.MemoryAllocator;
using IMemoryOwner<L8> row = allocator.Allocate<L8>(width);
Span<L8> rowSpan = row.GetSpan();
@ -84,7 +85,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
for (int y = 0; y < height; y++)
{
Span<TPixel> pixelSpan = image.GetPixelRowSpan(y);
Span<TPixel> pixelSpan = pixelBuffer.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.ToL8(
configuration,
pixelSpan,
@ -108,6 +109,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
{
int width = image.Width;
int height = image.Height;
Buffer2D<TPixel> pixelBuffer = image.PixelBuffer;
MemoryAllocator allocator = configuration.MemoryAllocator;
using IMemoryOwner<L16> row = allocator.Allocate<L16>(width);
Span<L16> rowSpan = row.GetSpan();
@ -116,7 +118,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
for (int y = 0; y < height; y++)
{
Span<TPixel> pixelSpan = image.GetPixelRowSpan(y);
Span<TPixel> pixelSpan = pixelBuffer.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.ToL16(
configuration,
pixelSpan,
@ -140,6 +142,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
{
int width = image.Width;
int height = image.Height;
Buffer2D<TPixel> pixelBuffer = image.PixelBuffer;
MemoryAllocator allocator = configuration.MemoryAllocator;
using IMemoryOwner<Rgb24> row = allocator.Allocate<Rgb24>(width);
Span<Rgb24> rowSpan = row.GetSpan();
@ -148,7 +151,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
for (int y = 0; y < height; y++)
{
Span<TPixel> pixelSpan = image.GetPixelRowSpan(y);
Span<TPixel> pixelSpan = pixelBuffer.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.ToRgb24(
configuration,
pixelSpan,
@ -178,6 +181,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
{
int width = image.Width;
int height = image.Height;
Buffer2D<TPixel> pixelBuffer = image.PixelBuffer;
MemoryAllocator allocator = configuration.MemoryAllocator;
using IMemoryOwner<Rgb48> row = allocator.Allocate<Rgb48>(width);
Span<Rgb48> rowSpan = row.GetSpan();
@ -186,7 +190,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
for (int y = 0; y < height; y++)
{
Span<TPixel> pixelSpan = image.GetPixelRowSpan(y);
Span<TPixel> pixelSpan = pixelBuffer.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.ToRgb48(
configuration,
pixelSpan,
@ -216,6 +220,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
{
int width = image.Width;
int height = image.Height;
Buffer2D<TPixel> pixelBuffer = image.PixelBuffer;
MemoryAllocator allocator = configuration.MemoryAllocator;
using IMemoryOwner<L8> row = allocator.Allocate<L8>(width);
Span<L8> rowSpan = row.GetSpan();
@ -224,7 +229,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm
for (int y = 0; y < height; y++)
{
Span<TPixel> pixelSpan = image.GetPixelRowSpan(y);
Span<TPixel> pixelSpan = pixelBuffer.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.ToL8(
configuration,
pixelSpan,

4
tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageComparingUtils.cs

@ -8,9 +8,9 @@ using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
using Xunit;
namespace SixLabors.ImageSharp.Tests.Formats.Tga
namespace SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison
{
public static class TgaTestUtils
public static class ImageComparingUtils
{
public static void CompareWithReferenceDecoder<TPixel>(
TestImageProvider<TPixel> provider,

Loading…
Cancel
Save