Browse Source

Fill buffers with default values only in Debug mode

pull/1836/head
Brian Popow 4 years ago
parent
commit
2ca81aec3c
  1. 4
      src/ImageSharp/Formats/Webp/Lossy/Vp8Decoder.cs

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

@ -76,10 +76,14 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossy
this.TmpVBuffer = memoryAllocator.Allocate<byte>((int)width);
this.Pixels = memoryAllocator.Allocate<byte>((int)(width * height * 4));
#if DEBUG
// Filling those buffers with 205, is only useful for debugging,
// so the default values are the same as the reference libwebp implementation.
this.YuvBuffer.Memory.Span.Fill(205);
this.CacheY.Memory.Span.Fill(205);
this.CacheU.Memory.Span.Fill(205);
this.CacheV.Memory.Span.Fill(205);
#endif
this.Vp8BitReaders = new Vp8BitReader[WebpConstants.MaxNumPartitions];
}

Loading…
Cancel
Save