From 5c982dab355bb1436acb99f81143ae7be676cb59 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 2 Sep 2017 15:22:19 -0400 Subject: [PATCH] update image orientation --- Emby.Drawing.Skia/SkiaEncoder.cs | 80 +------------------ .../ApplicationHost.cs | 1 + 2 files changed, 2 insertions(+), 79 deletions(-) diff --git a/Emby.Drawing.Skia/SkiaEncoder.cs b/Emby.Drawing.Skia/SkiaEncoder.cs index c3030a2085..b5d6010b07 100644 --- a/Emby.Drawing.Skia/SkiaEncoder.cs +++ b/Emby.Drawing.Skia/SkiaEncoder.cs @@ -423,88 +423,10 @@ namespace Emby.Drawing.Skia } default: - return RotateAndFlip(bitmap, origin); + return bitmap; } } - private SKBitmap RotateAndFlip(SKBitmap original, SKCodecOrigin origin) - { - // these are the origins that represent a 90 degree turn in some fashion - var differentOrientations = new SKCodecOrigin[] - { - SKCodecOrigin.LeftBottom, - SKCodecOrigin.LeftTop, - SKCodecOrigin.RightBottom, - SKCodecOrigin.RightTop - }; - - // check if we need to turn the image - bool isDifferentOrientation = differentOrientations.Any(o => o == origin); - - // define new width/height - var width = isDifferentOrientation ? original.Height : original.Width; - var height = isDifferentOrientation ? original.Width : original.Height; - - var bitmap = new SKBitmap(width, height, true); - - // todo: the stuff in this switch statement should be rewritten to use pointers - switch (origin) - { - case SKCodecOrigin.LeftBottom: - - for (var x = 0; x < original.Width; x++) - for (var y = 0; y < original.Height; y++) - bitmap.SetPixel(y, original.Width - 1 - x, original.GetPixel(x, y)); - break; - - case SKCodecOrigin.RightTop: - - for (var x = 0; x < original.Width; x++) - for (var y = 0; y < original.Height; y++) - bitmap.SetPixel(original.Height - 1 - y, x, original.GetPixel(x, y)); - break; - - case SKCodecOrigin.RightBottom: - - for (var x = 0; x < original.Width; x++) - for (var y = 0; y < original.Height; y++) - bitmap.SetPixel(original.Height - 1 - y, original.Width - 1 - x, original.GetPixel(x, y)); - - break; - - case SKCodecOrigin.LeftTop: - - for (var x = 0; x < original.Width; x++) - for (var y = 0; y < original.Height; y++) - bitmap.SetPixel(y, x, original.GetPixel(x, y)); - break; - - case SKCodecOrigin.BottomLeft: - - for (var x = 0; x < original.Width; x++) - for (var y = 0; y < original.Height; y++) - bitmap.SetPixel(x, original.Height - 1 - y, original.GetPixel(x, y)); - break; - - case SKCodecOrigin.BottomRight: - - for (var x = 0; x < original.Width; x++) - for (var y = 0; y < original.Height; y++) - bitmap.SetPixel(original.Width - 1 - x, original.Height - 1 - y, original.GetPixel(x, y)); - break; - - case SKCodecOrigin.TopRight: - - for (var x = 0; x < original.Width; x++) - for (var y = 0; y < original.Height; y++) - bitmap.SetPixel(original.Width - 1 - x, y, original.GetPixel(x, y)); - break; - - } - - return bitmap; - } - public string EncodeImage(string inputPath, DateTime dateModified, string outputPath, bool autoOrient, ImageOrientation? orientation, int quality, ImageProcessingOptions options, ImageFormat selectedOutputFormat) { if (string.IsNullOrWhiteSpace(inputPath)) diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index a9d3247e65..b3d39a5206 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -1073,6 +1073,7 @@ namespace Emby.Server.Implementations builder.AppendLine(string.Format("Operating system: {0}", Environment.OSVersion)); builder.AppendLine(string.Format("64-Bit OS: {0}", Environment.Is64BitOperatingSystem)); builder.AppendLine(string.Format("64-Bit Process: {0}", Environment.Is64BitProcess)); + builder.AppendLine(string.Format("User Interactive: {0}", Environment.UserInteractive)); Type type = Type.GetType("Mono.Runtime"); if (type != null)