Skip to content

Commit b6f3040

Browse files
Update BaseGlyphBuilder.cs
1 parent 9960a9d commit b6f3040

1 file changed

Lines changed: 4 additions & 19 deletions

File tree

src/ImageSharp.Drawing/Shapes/Text/BaseGlyphBuilder.cs

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ namespace SixLabors.ImageSharp.Drawing.Text
1313
internal class BaseGlyphBuilder : IGlyphRenderer
1414
{
1515
private readonly List<IPath> paths = new();
16-
private Vector2 currentPoint;
1716

1817
/// <summary>
1918
/// Initializes a new instance of the <see cref="BaseGlyphBuilder"/> class.
@@ -58,10 +57,7 @@ bool IGlyphRenderer.BeginGlyph(FontRectangle bounds, GlyphRendererParameters par
5857
/// <param name="thirdControlPoint">The third control point.</param>
5958
/// <param name="point">The point.</param>
6059
void IGlyphRenderer.CubicBezierTo(Vector2 secondControlPoint, Vector2 thirdControlPoint, Vector2 point)
61-
{
62-
this.Builder.AddBezier(this.currentPoint, secondControlPoint, thirdControlPoint, point);
63-
this.currentPoint = point;
64-
}
60+
=> this.Builder.CubicBezierTo(secondControlPoint, thirdControlPoint, point);
6561

6662
/// <summary>
6763
/// Ends the glyph.
@@ -77,32 +73,21 @@ void IGlyphRenderer.CubicBezierTo(Vector2 secondControlPoint, Vector2 thirdContr
7773
/// Draws a line from the current point to the <paramref name="point"/>.
7874
/// </summary>
7975
/// <param name="point">The point.</param>
80-
void IGlyphRenderer.LineTo(Vector2 point)
81-
{
82-
this.Builder.AddLine(this.currentPoint, point);
83-
this.currentPoint = point;
84-
}
76+
void IGlyphRenderer.LineTo(Vector2 point) => this.Builder.LineTo(point);
8577

8678
/// <summary>
8779
/// Moves to current point to the supplied vector.
8880
/// </summary>
8981
/// <param name="point">The point.</param>
90-
void IGlyphRenderer.MoveTo(Vector2 point)
91-
{
92-
this.Builder.StartFigure();
93-
this.currentPoint = point;
94-
}
82+
void IGlyphRenderer.MoveTo(Vector2 point) => this.Builder.MoveTo(point);
9583

9684
/// <summary>
9785
/// Draws a quadratics bezier from the current point to the <paramref name="point"/>
9886
/// </summary>
9987
/// <param name="secondControlPoint">The second control point.</param>
10088
/// <param name="point">The point.</param>
10189
void IGlyphRenderer.QuadraticBezierTo(Vector2 secondControlPoint, Vector2 point)
102-
{
103-
this.Builder.AddBezier(this.currentPoint, secondControlPoint, point);
104-
this.currentPoint = point;
105-
}
90+
=> this.Builder.QuadraticBezierTo(secondControlPoint, point);
10691

10792
/// <summary>Called before any glyphs have been rendered.</summary>
10893
/// <param name="bounds">The bounds the text will be rendered at and at what size.</param>

0 commit comments

Comments
 (0)