Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ImageSharp.Drawing.sln
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ISSUE_TEMPLATE", "ISSUE_TEMPLATE", "{FBE8C1AD-5AEC-4514-9B64-091D8E145865}"
ProjectSection(SolutionItems) = preProject
.github\ISSUE_TEMPLATE\config.yml = .github\ISSUE_TEMPLATE\config.yml
.github\ISSUE_TEMPLATE\oss-bug-report.md = .github\ISSUE_TEMPLATE\oss-bug-report.md
.github\ISSUE_TEMPLATE\oss-bug-report.yml = .github\ISSUE_TEMPLATE\oss-bug-report.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{815C0625-CD3D-440F-9F80-2D83856AB7AE}"
Expand Down
12 changes: 10 additions & 2 deletions src/ImageSharp.Drawing/Processing/RecolorBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,17 @@ public RecolorBrushApplicator(
/// <inheritdoc />
public override void Apply(Span<float> scanline, int x, int y)
{
Span<float> amounts = this.blenderBuffers.AmountSpan.Slice(0, scanline.Length);
Span<TPixel> overlays = this.blenderBuffers.OverlaySpan.Slice(0, scanline.Length);
if (x < 0 || y < 0 || x >= this.Target.Width || y >= this.Target.Height)
{
return;
}

// Limit the scanline to the bounds of the image relative to x.
scanline = scanline[..Math.Min(this.Target.Width - x, scanline.Length)];
Span<float> amounts = this.blenderBuffers.AmountSpan[..scanline.Length];
Span<TPixel> overlays = this.blenderBuffers.OverlaySpan[..scanline.Length];

int width = this.Target.Width;
Copy link

Copilot AI Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable 'width' is declared but not used. It should be removed to avoid confusion.

Suggested change
int width = this.Target.Width;
// int width = this.Target.Width;

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nearly correct. It's best to delete than comment out.

for (int i = 0; i < scanline.Length; i++)
{
amounts[i] = scanline[i] * this.Options.BlendPercentage;
Expand Down
Loading