mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-20 17:14:42 +01:00
Start adding IDisposableAnalyzers to projects
This commit is contained in:
@@ -31,8 +31,12 @@
|
||||
<ProjectReference Include="..\..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Code analysers-->
|
||||
<!-- Code Analyzers-->
|
||||
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<PackageReference Include="IDisposableAnalyzers">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
|
||||
@@ -122,8 +122,8 @@ public class SkiaEncoder : IImageEncoder
|
||||
var svg = new SKSvg();
|
||||
try
|
||||
{
|
||||
svg.Load(path);
|
||||
return new ImageDimensions(Convert.ToInt32(svg.Picture.CullRect.Width), Convert.ToInt32(svg.Picture.CullRect.Height));
|
||||
using var picture = svg.Load(path);
|
||||
return new ImageDimensions(Convert.ToInt32(picture.CullRect.Width), Convert.ToInt32(picture.CullRect.Height));
|
||||
}
|
||||
catch (FormatException skiaColorException)
|
||||
{
|
||||
@@ -432,7 +432,8 @@ public class SkiaEncoder : IImageEncoder
|
||||
|
||||
// scale image (the FromImage creates a copy)
|
||||
var imageInfo = new SKImageInfo(width, height, bitmap.ColorType, bitmap.AlphaType, bitmap.ColorSpace);
|
||||
using var resizedBitmap = SKBitmap.FromImage(ResizeImage(bitmap, imageInfo));
|
||||
using var resizedImage = ResizeImage(bitmap, imageInfo);
|
||||
using var resizedBitmap = SKBitmap.FromImage(resizedImage);
|
||||
|
||||
// If all we're doing is resizing then we can stop now
|
||||
if (!hasBackgroundColor && !hasForegroundColor && blur == 0 && !hasIndicator)
|
||||
|
||||
@@ -19,7 +19,6 @@ public static class SkiaHelper
|
||||
public static SKBitmap? GetNextValidImage(SkiaEncoder skiaEncoder, IReadOnlyList<string> paths, int currentIndex, out int newIndex)
|
||||
{
|
||||
var imagesTested = new Dictionary<int, int>();
|
||||
SKBitmap? bitmap = null;
|
||||
|
||||
while (imagesTested.Count < paths.Count)
|
||||
{
|
||||
@@ -28,7 +27,7 @@ public static class SkiaHelper
|
||||
currentIndex = 0;
|
||||
}
|
||||
|
||||
bitmap = skiaEncoder.Decode(paths[currentIndex], false, null, out _);
|
||||
SKBitmap? bitmap = skiaEncoder.Decode(paths[currentIndex], false, null, out _);
|
||||
|
||||
imagesTested[currentIndex] = 0;
|
||||
|
||||
@@ -36,11 +35,12 @@ public static class SkiaHelper
|
||||
|
||||
if (bitmap is not null)
|
||||
{
|
||||
break;
|
||||
newIndex = currentIndex;
|
||||
return bitmap;
|
||||
}
|
||||
}
|
||||
|
||||
newIndex = currentIndex;
|
||||
return bitmap;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,12 +189,12 @@ public partial class StripCollageBuilder
|
||||
|
||||
// Scale image. The FromBitmap creates a copy
|
||||
var imageInfo = new SKImageInfo(cellWidth, cellHeight, currentBitmap.ColorType, currentBitmap.AlphaType, currentBitmap.ColorSpace);
|
||||
using var resizedBitmap = SKBitmap.FromImage(SkiaEncoder.ResizeImage(currentBitmap, imageInfo));
|
||||
using var resizeImage = SkiaEncoder.ResizeImage(currentBitmap, imageInfo);
|
||||
|
||||
// draw this image into the strip at the next position
|
||||
var xPos = x * cellWidth;
|
||||
var yPos = y * cellHeight;
|
||||
canvas.DrawBitmap(resizedBitmap, xPos, yPos);
|
||||
canvas.DrawImage(resizeImage, xPos, yPos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,12 @@
|
||||
<Compile Include="..\..\SharedVersion.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Code analysers-->
|
||||
<!-- Code Analyzers-->
|
||||
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<PackageReference Include="IDisposableAnalyzers">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
|
||||
@@ -34,6 +34,10 @@
|
||||
|
||||
<!-- Code Analyzers-->
|
||||
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<PackageReference Include="IDisposableAnalyzers">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
|
||||
<!-- Code Analyzers-->
|
||||
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<PackageReference Include="IDisposableAnalyzers">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
|
||||
<!-- Code Analyzers-->
|
||||
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<PackageReference Include="IDisposableAnalyzers">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
|
||||
Reference in New Issue
Block a user