Skip to content

Commit

Permalink
Fix stack overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow committed Jan 8, 2025
1 parent 0020f0d commit 94bf9d9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Graphics/src/Graphics.Skia/SkiaCanvasState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,17 @@ private void UpdateTypeface()
if (!_typefaceInvalid)
return;

if (_fontPaint is not null)
{
#pragma warning disable CS0618 // Type or member is obsolete
FontPaint.Typeface = _font?.ToSKTypeface() ?? SKTypeface.Default;
_fontPaint.Typeface = _font?.ToSKTypeface() ?? SKTypeface.Default;
#pragma warning restore CS0618 // Type or member is obsolete
FontFont.Typeface = _font?.ToSKTypeface() ?? SKTypeface.Default;
}

if (_fontFont is not null)
{
_fontFont.Typeface = _font?.ToSKTypeface() ?? SKTypeface.Default;
}

_typefaceInvalid = false;
}
Expand Down Expand Up @@ -468,7 +475,7 @@ public void SetScale(float sx, float sy)

[Obsolete("Use Reset(SKPaint, SKFont, SKPaint, SKPaint) instead")]
public void Reset(SKPaint fontPaint, SKPaint fillPaint, SKPaint strokePaint)
{
{
Reset(fontPaint, fontPaint?.ToFont(), fillPaint, strokePaint);
}

Expand Down

0 comments on commit 94bf9d9

Please sign in to comment.