aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Drawing.Skia
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2020-04-23 11:29:19 +0200
committerBond_009 <bond.009@outlook.com>2020-04-23 11:29:19 +0200
commit118f30059c11cf43d9780c8e0328423e35b44b76 (patch)
tree3dae865e35e3cd026e188706b5eec739cb33bf7b /Jellyfin.Drawing.Skia
parent10afa4509db6fc7e3c2e7dd6ccc8997dfe3b10f9 (diff)
parent97e383d108a4adb7e57c13d67f1d36bd1b5ce7b5 (diff)
Merge branch 'master' into nullable4
Diffstat (limited to 'Jellyfin.Drawing.Skia')
-rw-r--r--Jellyfin.Drawing.Skia/Jellyfin.Drawing.Skia.csproj5
-rw-r--r--Jellyfin.Drawing.Skia/SkiaEncoder.cs17
2 files changed, 18 insertions, 4 deletions
diff --git a/Jellyfin.Drawing.Skia/Jellyfin.Drawing.Skia.csproj b/Jellyfin.Drawing.Skia/Jellyfin.Drawing.Skia.csproj
index e4b4c058e..a6e1f490a 100644
--- a/Jellyfin.Drawing.Skia/Jellyfin.Drawing.Skia.csproj
+++ b/Jellyfin.Drawing.Skia/Jellyfin.Drawing.Skia.csproj
@@ -1,5 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
+ <!-- ProjectGuid is only included as a requirement for SonarQube analysis -->
+ <PropertyGroup>
+ <ProjectGuid>{154872D9-6C12-4007-96E3-8F70A58386CE}</ProjectGuid>
+ </PropertyGroup>
+
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
diff --git a/Jellyfin.Drawing.Skia/SkiaEncoder.cs b/Jellyfin.Drawing.Skia/SkiaEncoder.cs
index 723c52340..5c7462ee2 100644
--- a/Jellyfin.Drawing.Skia/SkiaEncoder.cs
+++ b/Jellyfin.Drawing.Skia/SkiaEncoder.cs
@@ -78,12 +78,21 @@ namespace Jellyfin.Drawing.Skia
=> new HashSet<ImageFormat>() { ImageFormat.Webp, ImageFormat.Jpg, ImageFormat.Png };
/// <summary>
- /// Test to determine if the native lib is available.
+ /// Check if the native lib is available.
/// </summary>
- public static void TestSkia()
+ /// <returns>True if the native lib is available, otherwise false.</returns>
+ public static bool IsNativeLibAvailable()
{
- // test an operation that requires the native library
- SKPMColor.PreMultiply(SKColors.Black);
+ try
+ {
+ // test an operation that requires the native library
+ SKPMColor.PreMultiply(SKColors.Black);
+ return true;
+ }
+ catch (Exception)
+ {
+ return false;
+ }
}
private static bool IsTransparent(SKColor color)