update skia encoder

This commit is contained in:
Luke Pulverenti 2017-07-01 15:15:28 -04:00
parent e7277f4350
commit 2ec8a685cd
2 changed files with 6 additions and 4 deletions

View File

@ -183,8 +183,8 @@ namespace Emby.Drawing.Skia
}
}
private string[] TransparentImageTypes = new string[] { ".png", ".gif", ".webp" };
private SKBitmap Decode(string path, bool forceCleanBitmap, out SKCodecOrigin origin)
private static string[] TransparentImageTypes = new string[] { ".png", ".gif", ".webp" };
internal static SKBitmap Decode(string path, bool forceCleanBitmap, out SKCodecOrigin origin)
{
var requiresTransparencyHack = TransparentImageTypes.Contains(Path.GetExtension(path) ?? string.Empty);

View File

@ -82,7 +82,8 @@ namespace Emby.Drawing.Skia
for (int i = 0; i < 4; i++)
{
using (var currentBitmap = SKBitmap.Decode(paths[imageIndex]))
SKCodecOrigin origin;
using (var currentBitmap = SkiaEncoder.Decode(paths[imageIndex], false, out origin))
{
// resize to the same aspect as the original
int iWidth = (int)Math.Abs(iHeight * currentBitmap.Width / currentBitmap.Height);
@ -163,7 +164,8 @@ namespace Emby.Drawing.Skia
{
for (var y = 0; y < 2; y++)
{
using (var currentBitmap = SKBitmap.Decode(paths[imageIndex]))
SKCodecOrigin origin;
using (var currentBitmap = SkiaEncoder.Decode(paths[imageIndex], false, out origin))
{
using (var resizedBitmap = new SKBitmap(cellWidth, cellHeight, currentBitmap.ColorType, currentBitmap.AlphaType))
{