Skip to content

Commit

Permalink
Merge pull request #2717 from SixLabors/backport/v2-clear-buffers
Browse files Browse the repository at this point in the history
V2 - Clear Pixel Buffers on Decode.
  • Loading branch information
antonfirsov authored Apr 10, 2024
2 parents a78ce27 + c122185 commit 8f0b4d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ public override void InjectFrameData(JpegFrame frame, IRawJpegData jpegData)
this.pixelBuffer = allocator.Allocate2D<TPixel>(
frame.PixelWidth,
frame.PixelHeight,
this.configuration.PreferContiguousImageBuffers);
this.configuration.PreferContiguousImageBuffers,
AllocationOptions.Clean);
this.paddedProxyPixelRow = allocator.Allocate<TPixel>(frame.PixelWidth + 3);

// component processors from spectral to Rgba32
Expand Down Expand Up @@ -215,4 +216,4 @@ public void Dispose()
this.pixelBuffer?.Dispose();
}
}
}
}

Check warning on line 219 in src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter{TPixel}.cs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, net6.0, 6.0.x, true, -x64, false)

File is required to end with a single newline character

Check warning on line 219 in src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter{TPixel}.cs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, net5.0, -x64, false)

File is required to end with a single newline character

Check warning on line 219 in src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter{TPixel}.cs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, netcoreapp3.1, -x64, false)

File is required to end with a single newline character

Check warning on line 219 in src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter{TPixel}.cs

View workflow job for this annotation

GitHub Actions / Build (macos-latest, net5.0, -x64, false)

Check warning on line 219 in src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter{TPixel}.cs

View workflow job for this annotation

GitHub Actions / Build (macos-latest, net6.0, 6.0.x, true, -x64, false)

Check warning on line 219 in src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter{TPixel}.cs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, net5.0, -x64, false)

File is required to end with a single newline character

Check warning on line 219 in src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter{TPixel}.cs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, net6.0, 6.0.x, true, -x64, false)

File is required to end with a single newline character

Check warning on line 219 in src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter{TPixel}.cs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, netcoreapp3.1, -x64, false)

File is required to end with a single newline character

Check warning on line 219 in src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter{TPixel}.cs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, net472, -x64, false)

File is required to end with a single newline character

Check warning on line 219 in src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter{TPixel}.cs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, net472, -x86, false)

File is required to end with a single newline character

Check warning on line 219 in src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter{TPixel}.cs

View workflow job for this annotation

GitHub Actions / Build (macos-latest, netcoreapp3.1, -x64, false)

Check warning on line 219 in src/ImageSharp/Formats/Jpeg/Components/Decoder/SpectralConverter{TPixel}.cs

View workflow job for this annotation

GitHub Actions / Build (windows-latest, netcoreapp2.1, -x64, false)

File is required to end with a single newline character
2 changes: 1 addition & 1 deletion src/ImageSharp/Formats/Tga/TgaDecoderCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public Image<TPixel> Decode<TPixel>(BufferedReadStream stream, CancellationToken
throw new UnknownImageFormatException("Width or height cannot be 0");
}

var image = Image.CreateUninitialized<TPixel>(this.Configuration, this.fileHeader.Width, this.fileHeader.Height, this.metadata);
Image<TPixel> image = new(this.Configuration, this.fileHeader.Width, this.fileHeader.Height, this.metadata);
Buffer2D<TPixel> pixels = image.GetRootFramePixelBuffer();

if (this.fileHeader.ColorMapType == 1)
Expand Down

0 comments on commit 8f0b4d3

Please sign in to comment.