Skip to content

Commit da5f09a

Browse files
authored
Merge pull request #2716 from SixLabors/js/clear-buffers
Clear Pixel Buffers on Decode.
2 parents b6b08ac + 26d44ef commit da5f09a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter{TPixel}.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ public override void PrepareForDecoding()
201201
this.pixelBuffer = allocator.Allocate2D<TPixel>(
202202
pixelSize.Width,
203203
pixelSize.Height,
204-
this.Configuration.PreferContiguousImageBuffers);
204+
this.Configuration.PreferContiguousImageBuffers,
205+
AllocationOptions.Clean);
205206
this.paddedProxyPixelRow = allocator.Allocate<TPixel>(pixelSize.Width + 3);
206207

207208
// Component processors from spectral to RGB

src/ImageSharp/Formats/Tga/TgaDecoderCore.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public Image<TPixel> Decode<TPixel>(BufferedReadStream stream, CancellationToken
8484
throw new UnknownImageFormatException("Width or height cannot be 0");
8585
}
8686

87-
Image<TPixel> image = Image.CreateUninitialized<TPixel>(this.configuration, this.fileHeader.Width, this.fileHeader.Height, this.metadata);
87+
Image<TPixel> image = new(this.configuration, this.fileHeader.Width, this.fileHeader.Height, this.metadata);
8888
Buffer2D<TPixel> pixels = image.GetRootFramePixelBuffer();
8989

9090
if (this.fileHeader.ColorMapType == 1)

0 commit comments

Comments
 (0)