Browse Source

Update Magick.Net to 7.15.5

pull/1160/head
Brian Popow 6 years ago
parent
commit
4707966bfb
  1. 20
      src/ImageSharp/Formats/Tga/TgaDecoderCore.cs
  2. 2
      tests/Directory.Build.targets
  3. 1
      tests/ImageSharp.Tests/Formats/Tga/TgaTestUtils.cs

20
src/ImageSharp/Formats/Tga/TgaDecoderCore.cs

@ -20,7 +20,7 @@ namespace SixLabors.ImageSharp.Formats.Tga
/// <summary>
/// A scratch buffer to reduce allocations.
/// </summary>
private readonly byte[] buffer = new byte[4];
private readonly byte[] scratchBuffer = new byte[4];
/// <summary>
/// The metadata.
@ -430,19 +430,19 @@ namespace SixLabors.ImageSharp.Formats.Tga
{
for (int x = 0; x < width; x++)
{
this.currentStream.Read(this.buffer, 0, 2);
this.currentStream.Read(this.scratchBuffer, 0, 2);
if (!this.hasAlpha)
{
this.buffer[1] |= 1 << 7;
this.scratchBuffer[1] |= 1 << 7;
}
if (this.fileHeader.ImageType == TgaImageType.BlackAndWhite)
{
color.FromLa16(Unsafe.As<byte, La16>(ref this.buffer[0]));
color.FromLa16(Unsafe.As<byte, La16>(ref this.scratchBuffer[0]));
}
else
{
color.FromBgra5551(Unsafe.As<byte, Bgra5551>(ref this.buffer[0]));
color.FromBgra5551(Unsafe.As<byte, Bgra5551>(ref this.scratchBuffer[0]));
}
int newX = InvertX(x, width, origin);
@ -497,8 +497,8 @@ namespace SixLabors.ImageSharp.Formats.Tga
Span<TPixel> pixelSpan = pixels.GetRowSpan(newY);
for (int x = 0; x < width; x++)
{
this.currentStream.Read(this.buffer, 0, 3);
color.FromBgr24(Unsafe.As<byte, Bgr24>(ref this.buffer[0]));
this.currentStream.Read(this.scratchBuffer, 0, 3);
color.FromBgr24(Unsafe.As<byte, Bgr24>(ref this.scratchBuffer[0]));
int newX = InvertX(x, width, origin);
pixelSpan[newX] = color;
}
@ -531,9 +531,9 @@ namespace SixLabors.ImageSharp.Formats.Tga
where TPixel : unmanaged, IPixel<TPixel>
{
TPixel color = default;
bool isXInverted = origin == TgaImageOrigin.BottomRight || origin == TgaImageOrigin.TopRight;
if (this.tgaMetadata.AlphaChannelBits == 8)
{
bool isXInverted = origin == TgaImageOrigin.BottomRight || origin == TgaImageOrigin.TopRight;
if (isXInverted)
{
for (int y = 0; y < height; y++)
@ -542,8 +542,8 @@ namespace SixLabors.ImageSharp.Formats.Tga
Span<TPixel> pixelSpan = pixels.GetRowSpan(newY);
for (int x = 0; x < width; x++)
{
this.currentStream.Read(this.buffer, 0, 4);
color.FromBgra32(Unsafe.As<byte, Bgra32>(ref this.buffer[0]));
this.currentStream.Read(this.scratchBuffer, 0, 4);
color.FromBgra32(Unsafe.As<byte, Bgra32>(ref this.scratchBuffer[0]));
int newX = InvertX(x, width, origin);
pixelSpan[newX] = color;
}

2
tests/Directory.Build.targets

@ -29,7 +29,7 @@
<PackageReference Update="BenchmarkDotNet.Diagnostics.Windows" Version="0.12.0" Condition="'$(OS)' == 'Windows_NT'" />
<PackageReference Update="Colourful" Version="2.0.3" />
<PackageReference Update="coverlet.collector" Version="1.2.0" PrivateAssets="All"/>
<PackageReference Update="Magick.NET-Q16-AnyCPU" Version="7.14.4" />
<PackageReference Update="Magick.NET-Q16-AnyCPU" Version="7.15.5" />
<PackageReference Update="Microsoft.DotNet.RemoteExecutor" Version="5.0.0-beta.20069.1" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.5.0-preview-20200116-01" />
<PackageReference Update="Moq" Version="4.10.0" />

1
tests/ImageSharp.Tests/Formats/Tga/TgaTestUtils.cs

@ -44,6 +44,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tga
{
using (var magickImage = new MagickImage(fileInfo))
{
magickImage.AutoOrient();
var result = new Image<TPixel>(configuration, magickImage.Width, magickImage.Height);
Span<TPixel> resultPixels = result.GetPixelSpan();

Loading…
Cancel
Save