Skip to content

Commit f72bd7a

Browse files
Merge pull request #274 from SixLabors/js/fix-241
Add tests for PatterBrush issue 241
2 parents 83747f4 + 746f10f commit f72bd7a

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

src/ImageSharp.Drawing/Processing/PatternBrush.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System;
55
using System.Numerics;
66
using SixLabors.ImageSharp.Drawing.Utilities;
7-
using SixLabors.ImageSharp.Memory;
87
using SixLabors.ImageSharp.PixelFormats;
98

109
namespace SixLabors.ImageSharp.Drawing.Processing
@@ -118,8 +117,6 @@ private sealed class PatternBrushApplicator<TPixel> : BrushApplicator<TPixel>
118117
where TPixel : unmanaged, IPixel<TPixel>
119118
{
120119
private readonly DenseMatrix<TPixel> pattern;
121-
private readonly MemoryAllocator allocator;
122-
private readonly int scalineWidth;
123120
private readonly ThreadLocalBlenderBuffers<TPixel> blenderBuffers;
124121
private bool isDisposed;
125122

@@ -138,8 +135,6 @@ public PatternBrushApplicator(
138135
: base(configuration, options, source)
139136
{
140137
this.pattern = pattern;
141-
this.scalineWidth = source.Width;
142-
this.allocator = configuration.MemoryAllocator;
143138
this.blenderBuffers = new ThreadLocalBlenderBuffers<TPixel>(configuration.MemoryAllocator, source.Width);
144139
}
145140

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright (c) Six Labors.
2+
// Licensed under the Apache License, Version 2.0.
3+
4+
using System.Numerics;
5+
using SixLabors.Fonts;
6+
using SixLabors.ImageSharp.Drawing.Processing;
7+
using SixLabors.ImageSharp.PixelFormats;
8+
using SixLabors.ImageSharp.Processing;
9+
using Xunit;
10+
11+
namespace SixLabors.ImageSharp.Drawing.Tests.Issues
12+
{
13+
public class Issue_241
14+
{
15+
[Fact]
16+
public void DoesNotThrowArgumentOutOfRangeException()
17+
{
18+
if (!TestEnvironment.IsWindows)
19+
{
20+
return;
21+
}
22+
23+
FontFamily fontFamily = SystemFonts.Get("Arial");
24+
RichTextOptions opt = new(fontFamily.CreateFont(100, FontStyle.Regular))
25+
{
26+
Origin = new Vector2(159, 0)
27+
};
28+
const string content = "TEST";
29+
30+
using Image image = new Image<Rgba32>(512, 256, Color.Black);
31+
image.Mutate(x => x.DrawText(opt, content, Brushes.Horizontal(Color.Orange)));
32+
}
33+
}
34+
}

0 commit comments

Comments
 (0)