Reuse paint objects.

This commit is contained in:
Patrick Barron 2020-07-19 14:39:11 -04:00
parent d983d65d8a
commit 2569793ff0
2 changed files with 41 additions and 49 deletions

View File

@ -22,18 +22,15 @@ namespace Jellyfin.Drawing.Skia
{
var x = imageSize.Width - OffsetFromTopRightCorner;
using (var paint = new SKPaint())
using var paint = new SKPaint
{
paint.Color = SKColor.Parse("#CC00A4DC");
paint.Style = SKPaintStyle.Fill;
Color = SKColor.Parse("#CC00A4DC"),
Style = SKPaintStyle.Fill
};
canvas.DrawCircle(x, OffsetFromTopRightCorner, 20, paint);
}
using (var paint = new SKPaint())
{
paint.Color = new SKColor(255, 255, 255, 255);
paint.Style = SKPaintStyle.Fill;
paint.TextSize = 30;
paint.IsAntialias = true;
@ -49,4 +46,3 @@ namespace Jellyfin.Drawing.Skia
}
}
}
}

View File

@ -28,18 +28,15 @@ namespace Jellyfin.Drawing.Skia
var x = imageSize.Width - OffsetFromTopRightCorner;
var text = count.ToString(CultureInfo.InvariantCulture);
using (var paint = new SKPaint())
using var paint = new SKPaint
{
paint.Color = SKColor.Parse("#CC00A4DC");
paint.Style = SKPaintStyle.Fill;
Color = SKColor.Parse("#CC00A4DC"),
Style = SKPaintStyle.Fill
};
canvas.DrawCircle(x, OffsetFromTopRightCorner, 20, paint);
}
using (var paint = new SKPaint())
{
paint.Color = new SKColor(255, 255, 255, 255);
paint.Style = SKPaintStyle.Fill;
paint.TextSize = 24;
paint.IsAntialias = true;
@ -65,4 +62,3 @@ namespace Jellyfin.Drawing.Skia
}
}
}
}