From 49fc8ac98b9502d5bc243d43307113145a4d6dd8 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Fri, 5 May 2023 20:27:05 +1000 Subject: [PATCH 1/2] Create Issue_241.cs --- .../Issues/Issue_241.cs | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/ImageSharp.Drawing.Tests/Issues/Issue_241.cs diff --git a/tests/ImageSharp.Drawing.Tests/Issues/Issue_241.cs b/tests/ImageSharp.Drawing.Tests/Issues/Issue_241.cs new file mode 100644 index 00000000..ce7a40ee --- /dev/null +++ b/tests/ImageSharp.Drawing.Tests/Issues/Issue_241.cs @@ -0,0 +1,34 @@ +// Copyright (c) Six Labors. +// Licensed under the Apache License, Version 2.0. + +using System.Numerics; +using SixLabors.Fonts; +using SixLabors.ImageSharp.Drawing.Processing; +using SixLabors.ImageSharp.PixelFormats; +using SixLabors.ImageSharp.Processing; +using Xunit; + +namespace SixLabors.ImageSharp.Drawing.Tests.Issues +{ + public class Issue_241 + { + [Fact] + public void DoesNotThrowArgumentOutOfRangeException() + { + if (!TestEnvironment.IsWindows) + { + return; + } + + FontFamily fontFamily = SystemFonts.Get("Arial"); + RichTextOptions opt = new(fontFamily.CreateFont(100, FontStyle.Regular)) + { + Origin = new Vector2(159, 0) + }; + const string content = "TEST"; + + using Image image = new Image(512, 256, Color.Black); + image.Mutate(x => x.DrawText(opt, content, Brushes.Horizontal(Color.Orange))); + } + } +} From 25348775dcd7f1663558ac2ac13e8ad2d224af44 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Fri, 5 May 2023 20:28:45 +1000 Subject: [PATCH 2/2] Update PatternBrush.cs --- src/ImageSharp.Drawing/Processing/PatternBrush.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/ImageSharp.Drawing/Processing/PatternBrush.cs b/src/ImageSharp.Drawing/Processing/PatternBrush.cs index 461196f8..48d1ea5a 100644 --- a/src/ImageSharp.Drawing/Processing/PatternBrush.cs +++ b/src/ImageSharp.Drawing/Processing/PatternBrush.cs @@ -4,7 +4,6 @@ using System; using System.Numerics; using SixLabors.ImageSharp.Drawing.Utilities; -using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.PixelFormats; namespace SixLabors.ImageSharp.Drawing.Processing @@ -118,8 +117,6 @@ private sealed class PatternBrushApplicator : BrushApplicator where TPixel : unmanaged, IPixel { private readonly DenseMatrix pattern; - private readonly MemoryAllocator allocator; - private readonly int scalineWidth; private readonly ThreadLocalBlenderBuffers blenderBuffers; private bool isDisposed; @@ -138,8 +135,6 @@ public PatternBrushApplicator( : base(configuration, options, source) { this.pattern = pattern; - this.scalineWidth = source.Width; - this.allocator = configuration.MemoryAllocator; this.blenderBuffers = new ThreadLocalBlenderBuffers(configuration.MemoryAllocator, source.Width); }