浏览代码

update skia

Luke Pulverenti 8 年之前
父节点
当前提交
3c60445311
共有 2 个文件被更改,包括 18 次插入3 次删除
  1. 17 2
      Emby.Drawing.Skia/SkiaEncoder.cs
  2. 1 1
      MediaBrowser.ServerApplication/ImageEncoderHelper.cs

+ 17 - 2
Emby.Drawing.Skia/SkiaEncoder.cs

@@ -192,17 +192,32 @@ namespace Emby.Drawing.Skia
             }
             }
         }
         }
 
 
+        private SKBitmap Decode(string path)
+        {
+            using (var stream = new SKFileStream(path))
+            {
+                var codec = SKCodec.Create(stream);
+
+                // create the bitmap
+                var bitmap = new SKBitmap(codec.Info.Width, codec.Info.Height);
+                // decode
+                codec.GetPixels(bitmap.Info, bitmap.GetPixels());
+
+                return bitmap;
+            }
+        }
+
         private SKBitmap GetBitmap(string path, bool cropWhitespace)
         private SKBitmap GetBitmap(string path, bool cropWhitespace)
         {
         {
             if (cropWhitespace)
             if (cropWhitespace)
             {
             {
-                using (var bitmap = SKBitmap.Decode(path))
+                using (var bitmap = Decode(path))
                 {
                 {
                     return CropWhiteSpace(bitmap);
                     return CropWhiteSpace(bitmap);
                 }
                 }
             } 
             } 
 
 
-            return SKBitmap.Decode(path);
+            return Decode(path);
         }
         }
 
 
         public void EncodeImage(string inputPath, string outputPath, bool autoOrient, int width, int height, int quality, ImageProcessingOptions options, ImageFormat selectedOutputFormat)
         public void EncodeImage(string inputPath, string outputPath, bool autoOrient, int width, int height, int quality, ImageProcessingOptions options, ImageFormat selectedOutputFormat)

+ 1 - 1
MediaBrowser.ServerApplication/ImageEncoderHelper.cs

@@ -26,7 +26,7 @@ namespace MediaBrowser.Server.Startup.Common
             {
             {
                 try
                 try
                 {
                 {
-                    //return new SkiaEncoder(logManager.GetLogger("ImageMagick"), appPaths, httpClient, fileSystem);
+                    return new SkiaEncoder(logManager.GetLogger("ImageMagick"), appPaths, httpClient, fileSystem);
                 }
                 }
                 catch
                 catch
                 {
                 {