Browse Source

update scaling with MaxHeight

Luke Pulverenti 8 years ago
parent
commit
f5a6a418f5

+ 2 - 2
Emby.Drawing/GDI/DynamicImageHelpers.cs

@@ -34,7 +34,7 @@ namespace Emby.Drawing.GDI
                     graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                     graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                     graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
                     graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
 
 
-                    // This causes the image to be blank in OSX
+                    // SourceCopy causes the image to be blank in OSX
                     //graphics.CompositingMode = CompositingMode.SourceCopy;
                     //graphics.CompositingMode = CompositingMode.SourceCopy;
 
 
                     for (var row = 0; row < rows; row++)
                     for (var row = 0; row < rows; row++)
@@ -83,7 +83,7 @@ namespace Emby.Drawing.GDI
                     graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                     graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                     graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
                     graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
 
 
-                    // This causes the image to be blank in OSX
+                    // SourceCopy causes the image to be blank in OSX
                     //graphics.CompositingMode = CompositingMode.SourceCopy;
                     //graphics.CompositingMode = CompositingMode.SourceCopy;
 
 
                     for (var row = 0; row < rows; row++)
                     for (var row = 0; row < rows; row++)

+ 5 - 3
Emby.Drawing/GDI/GDIImageEncoder.cs

@@ -119,9 +119,11 @@ namespace Emby.Drawing.GDI
                         thumbnailGraph.SmoothingMode = SmoothingMode.HighQuality;
                         thumbnailGraph.SmoothingMode = SmoothingMode.HighQuality;
                         thumbnailGraph.InterpolationMode = InterpolationMode.HighQualityBicubic;
                         thumbnailGraph.InterpolationMode = InterpolationMode.HighQualityBicubic;
                         thumbnailGraph.PixelOffsetMode = PixelOffsetMode.HighQuality;
                         thumbnailGraph.PixelOffsetMode = PixelOffsetMode.HighQuality;
-                        thumbnailGraph.CompositingMode = !hasPostProcessing ?
-                            CompositingMode.SourceCopy :
-                            CompositingMode.SourceOver;
+
+                        // SourceCopy causes the image to be blank in OSX
+                        //thumbnailGraph.CompositingMode = !hasPostProcessing ?
+                        //    CompositingMode.SourceCopy :
+                        //    CompositingMode.SourceOver;
 
 
                         SetBackgroundColor(thumbnailGraph, options);
                         SetBackgroundColor(thumbnailGraph, options);
 
 

+ 1 - 1
MediaBrowser.Api/Playback/BaseStreamingService.cs

@@ -644,7 +644,7 @@ namespace MediaBrowser.Api.Playback
                 {
                 {
                     var maxHeightParam = request.MaxHeight.Value.ToString(UsCulture);
                     var maxHeightParam = request.MaxHeight.Value.ToString(UsCulture);
 
 
-                    filters.Add(string.Format("scale=trunc(oh*a/2)*2:min(ih\\,{0})", maxHeightParam));
+                    filters.Add(string.Format("scale=trunc(oh*a/2)*2:min(max(iw/dar\\,ih)\\,{0})", maxHeightParam));
                 }
                 }
             }
             }
 
 

+ 1 - 1
MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs

@@ -978,7 +978,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
                 {
                 {
                     var maxHeightParam = request.MaxHeight.Value.ToString(UsCulture);
                     var maxHeightParam = request.MaxHeight.Value.ToString(UsCulture);
 
 
-                    filters.Add(string.Format("scale=trunc(oh*a/2)*2:min(ih\\,{0})", maxHeightParam));
+                    filters.Add(string.Format("scale=trunc(oh*a/2)*2:min(max(iw/dar\\,ih)\\,{0})", maxHeightParam));
                 }
                 }
             }
             }