Skip to content

Commit a2308a6

Browse files
Cleanup General Convolution (SixLabors#887)
* Remove multiple premultiplication. * Use in DenseMatrix everywhere. * Make private * Dont convert vector row on first pass * Remove incorrectly assigned alpha. * Remove boxing. * Use correct min row. * Reorder parameters * Correctly handle alpha component. * Update tests * Use dedicated methods over branching.
1 parent 1576d3f commit a2308a6

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/ImageSharp.Drawing/Processing/PatternBrush{TPixel}.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public PatternBrush(TPixel foreColor, TPixel backColor, bool[,] pattern)
6161
/// <param name="foreColor">Color of the fore.</param>
6262
/// <param name="backColor">Color of the back.</param>
6363
/// <param name="pattern">The pattern.</param>
64-
internal PatternBrush(TPixel foreColor, TPixel backColor, DenseMatrix<bool> pattern)
64+
internal PatternBrush(TPixel foreColor, TPixel backColor, in DenseMatrix<bool> pattern)
6565
{
6666
var foreColorVector = foreColor.ToVector4();
6767
var backColorVector = backColor.ToVector4();
@@ -93,10 +93,7 @@ internal PatternBrush(PatternBrush<TPixel> brush)
9393
}
9494

9595
/// <inheritdoc />
96-
public BrushApplicator<TPixel> CreateApplicator(ImageFrame<TPixel> source, RectangleF region, GraphicsOptions options)
97-
{
98-
return new PatternBrushApplicator(source, this.pattern, this.patternVector, options);
99-
}
96+
public BrushApplicator<TPixel> CreateApplicator(ImageFrame<TPixel> source, RectangleF region, GraphicsOptions options) => new PatternBrushApplicator(source, this.pattern, this.patternVector, options);
10097

10198
/// <summary>
10299
/// The pattern brush applicator.
@@ -116,7 +113,7 @@ private class PatternBrushApplicator : BrushApplicator<TPixel>
116113
/// <param name="pattern">The pattern.</param>
117114
/// <param name="patternVector">The patternVector.</param>
118115
/// <param name="options">The options</param>
119-
public PatternBrushApplicator(ImageFrame<TPixel> source, DenseMatrix<TPixel> pattern, DenseMatrix<Vector4> patternVector, GraphicsOptions options)
116+
public PatternBrushApplicator(ImageFrame<TPixel> source, in DenseMatrix<TPixel> pattern, DenseMatrix<Vector4> patternVector, GraphicsOptions options)
120117
: base(source, options)
121118
{
122119
this.pattern = pattern;

0 commit comments

Comments
 (0)