diff --git a/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj b/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj index 3776830aec..661f33e081 100644 --- a/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj +++ b/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj @@ -39,7 +39,8 @@ - + + All diff --git a/src/ImageSharp.Drawing/Processing/Text/Processors/DrawTextProcessor.cs b/src/ImageSharp.Drawing/Processing/Text/Processors/DrawTextProcessor.cs index f6a66b566b..a38a0c3205 100644 --- a/src/ImageSharp.Drawing/Processing/Text/Processors/DrawTextProcessor.cs +++ b/src/ImageSharp.Drawing/Processing/Text/Processors/DrawTextProcessor.cs @@ -169,13 +169,13 @@ namespace SixLabors.ImageSharp.Processing.Text.Processors { private PathBuilder builder; - private Point currentRenderPosition = default(Point); - private int currentRenderingGlyph = 0; + private Point currentRenderPosition = default; + private GlyphRendererParameters currentRenderingGlyph = default; private int offset = 0; private PointF currentPoint = default(PointF); - private HashSet renderedGlyphs = new HashSet(); - private Dictionary> glyphMap; - private Dictionary> glyphMapPen; + private HashSet renderedGlyphs = new HashSet(); + private Dictionary> glyphMap; + private Dictionary> glyphMapPen; private bool renderOutline = false; private bool renderFill = false; private bool raterizationRequired = false; @@ -190,14 +190,14 @@ namespace SixLabors.ImageSharp.Processing.Text.Processors if (this.renderFill) { this.FillOperations = new List(size); - this.glyphMap = new Dictionary>(); + this.glyphMap = new Dictionary>(); } if (this.renderOutline) { this.offset = (int)MathF.Ceiling((pen.StrokeWidth * 2) + 2); this.OutlineOperations = new List(size); - this.glyphMapPen = new Dictionary>(); + this.glyphMapPen = new Dictionary>(); } this.builder = new PathBuilder(); @@ -218,14 +218,14 @@ namespace SixLabors.ImageSharp.Processing.Text.Processors this.builder.StartFigure(); } - public bool BeginGlyph(RectangleF bounds, int cacheKey) + public bool BeginGlyph(RectangleF bounds, GlyphRendererParameters paramters) { this.currentRenderPosition = Point.Truncate(bounds.Location); // we have offset our rendering origion a little bit down to prevent edge cropping, move the draw origin up to compensate this.currentRenderPosition = new Point(this.currentRenderPosition.X - this.offset, this.currentRenderPosition.Y - this.offset); - this.currentRenderingGlyph = cacheKey; - if (this.renderedGlyphs.Contains(cacheKey)) + this.currentRenderingGlyph = paramters; + if (this.renderedGlyphs.Contains(paramters)) { // we have already drawn the glyph vectors skip trying again this.raterizationRequired = false; @@ -259,7 +259,7 @@ namespace SixLabors.ImageSharp.Processing.Text.Processors { if (this.renderFill) { - foreach (KeyValuePair> m in this.glyphMap) + foreach (KeyValuePair> m in this.glyphMap) { m.Value.Dispose(); } @@ -267,7 +267,7 @@ namespace SixLabors.ImageSharp.Processing.Text.Processors if (this.renderOutline) { - foreach (KeyValuePair> m in this.glyphMapPen) + foreach (KeyValuePair> m in this.glyphMapPen) { m.Value.Dispose(); } diff --git a/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj b/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj index 9a58f350ac..67faa72138 100644 --- a/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj +++ b/tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj @@ -18,6 +18,7 @@ +