mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-07 03:48:06 +02:00
Convert to switch expressions
This commit is contained in:
parent
1be3e1e037
commit
a9806d8f4a
1 changed files with 17 additions and 30 deletions
|
@ -102,19 +102,14 @@ namespace Jellyfin.Drawing.Skia
|
||||||
/// <returns>The converted format.</returns>
|
/// <returns>The converted format.</returns>
|
||||||
public static SKEncodedImageFormat GetImageFormat(ImageFormat selectedFormat)
|
public static SKEncodedImageFormat GetImageFormat(ImageFormat selectedFormat)
|
||||||
{
|
{
|
||||||
switch (selectedFormat)
|
return selectedFormat switch
|
||||||
{
|
{
|
||||||
case ImageFormat.Bmp:
|
ImageFormat.Bmp => SKEncodedImageFormat.Bmp,
|
||||||
return SKEncodedImageFormat.Bmp;
|
ImageFormat.Jpg => SKEncodedImageFormat.Jpeg,
|
||||||
case ImageFormat.Jpg:
|
ImageFormat.Gif => SKEncodedImageFormat.Gif,
|
||||||
return SKEncodedImageFormat.Jpeg;
|
ImageFormat.Webp => SKEncodedImageFormat.Webp,
|
||||||
case ImageFormat.Gif:
|
_ => SKEncodedImageFormat.Png
|
||||||
return SKEncodedImageFormat.Gif;
|
};
|
||||||
case ImageFormat.Webp:
|
|
||||||
return SKEncodedImageFormat.Webp;
|
|
||||||
default:
|
|
||||||
return SKEncodedImageFormat.Png;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsTransparentRow(SKBitmap bmp, int row)
|
private static bool IsTransparentRow(SKBitmap bmp, int row)
|
||||||
|
@ -279,25 +274,17 @@ namespace Jellyfin.Drawing.Skia
|
||||||
return SKEncodedOrigin.TopLeft;
|
return SKEncodedOrigin.TopLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (orientation.Value)
|
return orientation.Value switch
|
||||||
{
|
{
|
||||||
case ImageOrientation.TopRight:
|
ImageOrientation.TopRight => SKEncodedOrigin.TopRight,
|
||||||
return SKEncodedOrigin.TopRight;
|
ImageOrientation.RightTop => SKEncodedOrigin.RightTop,
|
||||||
case ImageOrientation.RightTop:
|
ImageOrientation.RightBottom => SKEncodedOrigin.RightBottom,
|
||||||
return SKEncodedOrigin.RightTop;
|
ImageOrientation.LeftTop => SKEncodedOrigin.LeftTop,
|
||||||
case ImageOrientation.RightBottom:
|
ImageOrientation.LeftBottom => SKEncodedOrigin.LeftBottom,
|
||||||
return SKEncodedOrigin.RightBottom;
|
ImageOrientation.BottomRight => SKEncodedOrigin.BottomRight,
|
||||||
case ImageOrientation.LeftTop:
|
ImageOrientation.BottomLeft => SKEncodedOrigin.BottomLeft,
|
||||||
return SKEncodedOrigin.LeftTop;
|
_ => SKEncodedOrigin.TopLeft
|
||||||
case ImageOrientation.LeftBottom:
|
};
|
||||||
return SKEncodedOrigin.LeftBottom;
|
|
||||||
case ImageOrientation.BottomRight:
|
|
||||||
return SKEncodedOrigin.BottomRight;
|
|
||||||
case ImageOrientation.BottomLeft:
|
|
||||||
return SKEncodedOrigin.BottomLeft;
|
|
||||||
default:
|
|
||||||
return SKEncodedOrigin.TopLeft;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in a new issue