Skip to content

Commit ca74af7

Browse files
Merge pull request SixLabors#1011 from SixLabors/feature/processors
Make processors public, refactor cloning.
2 parents 4ad6b22 + c0a62e0 commit ca74af7

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/ImageSharp.Drawing/Processing/Processors/Drawing/DrawImageProcessor{TPixelBg,TPixelFg}.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ protected override void OnFrameApply(ImageFrame<TPixelBg> source)
9191

9292
var workingRect = Rectangle.FromLTRB(minX, minY, maxX, maxY);
9393

94-
// not a valid operation because rectangle does not overlap with this image.
94+
// Not a valid operation because rectangle does not overlap with this image.
9595
if (workingRect.Width <= 0 || workingRect.Height <= 0)
9696
{
9797
throw new ImageProcessingException(
@@ -102,14 +102,14 @@ protected override void OnFrameApply(ImageFrame<TPixelBg> source)
102102
workingRect,
103103
configuration,
104104
rows =>
105+
{
106+
for (int y = rows.Min; y < rows.Max; y++)
105107
{
106-
for (int y = rows.Min; y < rows.Max; y++)
107-
{
108-
Span<TPixelBg> background = source.GetPixelRowSpan(y).Slice(minX, width);
109-
Span<TPixelFg> foreground = targetImage.GetPixelRowSpan(y - locationY).Slice(targetX, width);
110-
blender.Blend<TPixelFg>(configuration, background, background, foreground, this.Opacity);
111-
}
112-
});
108+
Span<TPixelBg> background = source.GetPixelRowSpan(y).Slice(minX, width);
109+
Span<TPixelFg> foreground = targetImage.GetPixelRowSpan(y - locationY).Slice(targetX, width);
110+
blender.Blend<TPixelFg>(configuration, background, background, foreground, this.Opacity);
111+
}
112+
});
113113
}
114114
}
115115
}

tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void MinimumAntialiasSubpixelDepth(bool antialias, int antialiasSubpixelD
4141
};
4242
var processor = new FillRegionProcessor(brush.Object, region, options);
4343
var img = new Image<Rgba32>(1, 1);
44-
processor.Apply(img, bounds);
44+
processor.Execute(img, bounds);
4545

4646
Assert.Equal(4, region.ScanInvocationCounter);
4747
}
@@ -54,7 +54,7 @@ public void FillOffCanvas()
5454
var options = new GraphicsOptions(true);
5555
var processor = new FillRegionProcessor(brush.Object, new MockRegion1(), options);
5656
var img = new Image<Rgba32>(10, 10);
57-
processor.Apply(img, bounds);
57+
processor.Execute(img, bounds);
5858
}
5959

6060
[Fact]

0 commit comments

Comments
 (0)