Browse Source

update webp code

af/UniformUnmanagedMemoryPoolMemoryAllocator-02-MemoryGuards
Anton Firszov 5 years ago
parent
commit
64a9d25e96
  1. 2
      src/ImageSharp/Formats/Webp/Lossless/WebpLosslessDecoder.cs
  2. 4
      src/ImageSharp/Formats/Webp/Lossy/WebpLossyDecoder.cs

2
src/ImageSharp/Formats/Webp/Lossless/WebpLosslessDecoder.cs

@ -197,7 +197,7 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossless
for (int y = 0; y < height; y++)
{
Span<byte> rowAsBytes = pixelDataAsBytes.Slice(y * bytesPerRow, bytesPerRow);
Span<TPixel> pixelRow = pixels.GetRowSpan(y);
Span<TPixel> pixelRow = pixels.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.FromBgra32Bytes(
this.configuration,
rowAsBytes.Slice(0, bytesPerRow),

4
src/ImageSharp/Formats/Webp/Lossy/WebpLossyDecoder.cs

@ -118,7 +118,7 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossy
for (int y = 0; y < height; y++)
{
Span<byte> row = pixelData.Slice(y * widthMul3, widthMul3);
Span<TPixel> decodedPixelRow = decodedPixels.GetRowSpan(y);
Span<TPixel> decodedPixelRow = decodedPixels.DangerousGetRowSpan(y);
PixelOperations<TPixel>.Instance.FromBgr24Bytes(
this.configuration,
row,
@ -136,7 +136,7 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossy
for (int y = 0; y < height; y++)
{
int yMulWidth = y * width;
Span<TPixel> decodedPixelRow = decodedPixels.GetRowSpan(y);
Span<TPixel> decodedPixelRow = decodedPixels.DangerousGetRowSpan(y);
for (int x = 0; x < width; x++)
{
int offset = yMulWidth + x;

Loading…
Cancel
Save