mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Reuse paint objects.
This commit is contained in:
parent
d983d65d8a
commit
2569793ff0
@ -22,18 +22,15 @@ namespace Jellyfin.Drawing.Skia
|
|||||||
{
|
{
|
||||||
var x = imageSize.Width - OffsetFromTopRightCorner;
|
var x = imageSize.Width - OffsetFromTopRightCorner;
|
||||||
|
|
||||||
using (var paint = new SKPaint())
|
using var paint = new SKPaint
|
||||||
{
|
{
|
||||||
paint.Color = SKColor.Parse("#CC00A4DC");
|
Color = SKColor.Parse("#CC00A4DC"),
|
||||||
paint.Style = SKPaintStyle.Fill;
|
Style = SKPaintStyle.Fill
|
||||||
|
};
|
||||||
|
|
||||||
canvas.DrawCircle(x, OffsetFromTopRightCorner, 20, paint);
|
canvas.DrawCircle(x, OffsetFromTopRightCorner, 20, paint);
|
||||||
}
|
|
||||||
|
|
||||||
using (var paint = new SKPaint())
|
|
||||||
{
|
|
||||||
paint.Color = new SKColor(255, 255, 255, 255);
|
paint.Color = new SKColor(255, 255, 255, 255);
|
||||||
paint.Style = SKPaintStyle.Fill;
|
|
||||||
|
|
||||||
paint.TextSize = 30;
|
paint.TextSize = 30;
|
||||||
paint.IsAntialias = true;
|
paint.IsAntialias = true;
|
||||||
|
|
||||||
@ -48,5 +45,4 @@ namespace Jellyfin.Drawing.Skia
|
|||||||
canvas.DrawText(Text, (float)x - 20, OffsetFromTopRightCorner + 12, paint);
|
canvas.DrawText(Text, (float)x - 20, OffsetFromTopRightCorner + 12, paint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -28,18 +28,15 @@ namespace Jellyfin.Drawing.Skia
|
|||||||
var x = imageSize.Width - OffsetFromTopRightCorner;
|
var x = imageSize.Width - OffsetFromTopRightCorner;
|
||||||
var text = count.ToString(CultureInfo.InvariantCulture);
|
var text = count.ToString(CultureInfo.InvariantCulture);
|
||||||
|
|
||||||
using (var paint = new SKPaint())
|
using var paint = new SKPaint
|
||||||
{
|
{
|
||||||
paint.Color = SKColor.Parse("#CC00A4DC");
|
Color = SKColor.Parse("#CC00A4DC"),
|
||||||
paint.Style = SKPaintStyle.Fill;
|
Style = SKPaintStyle.Fill
|
||||||
|
};
|
||||||
|
|
||||||
canvas.DrawCircle(x, OffsetFromTopRightCorner, 20, paint);
|
canvas.DrawCircle(x, OffsetFromTopRightCorner, 20, paint);
|
||||||
}
|
|
||||||
|
|
||||||
using (var paint = new SKPaint())
|
|
||||||
{
|
|
||||||
paint.Color = new SKColor(255, 255, 255, 255);
|
paint.Color = new SKColor(255, 255, 255, 255);
|
||||||
paint.Style = SKPaintStyle.Fill;
|
|
||||||
|
|
||||||
paint.TextSize = 24;
|
paint.TextSize = 24;
|
||||||
paint.IsAntialias = true;
|
paint.IsAntialias = true;
|
||||||
|
|
||||||
@ -64,5 +61,4 @@ namespace Jellyfin.Drawing.Skia
|
|||||||
canvas.DrawText(text, x, y, paint);
|
canvas.DrawText(text, x, y, paint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user