aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Drawing/ImageExtensions.cs33
-rw-r--r--MediaBrowser.Controller/Drawing/ImageManager.cs2
-rw-r--r--MediaBrowser.Controller/Library/IUserManager.cs2
3 files changed, 35 insertions, 2 deletions
diff --git a/MediaBrowser.Controller/Drawing/ImageExtensions.cs b/MediaBrowser.Controller/Drawing/ImageExtensions.cs
index cecbfe74a..32268011f 100644
--- a/MediaBrowser.Controller/Drawing/ImageExtensions.cs
+++ b/MediaBrowser.Controller/Drawing/ImageExtensions.cs
@@ -65,6 +65,39 @@ namespace MediaBrowser.Controller.Drawing
}
/// <summary>
+ /// Determines whether [is pixel format supported by graphics object] [the specified format].
+ /// </summary>
+ /// <param name="format">The format.</param>
+ /// <returns><c>true</c> if [is pixel format supported by graphics object] [the specified format]; otherwise, <c>false</c>.</returns>
+ public static bool IsPixelFormatSupportedByGraphicsObject(PixelFormat format)
+ {
+ // http://msdn.microsoft.com/en-us/library/system.drawing.graphics.fromimage.aspx
+
+ if (format.HasFlag(PixelFormat.Indexed))
+ {
+ return false;
+ }
+ if (format.HasFlag(PixelFormat.Undefined))
+ {
+ return false;
+ }
+ if (format.HasFlag(PixelFormat.DontCare))
+ {
+ return false;
+ }
+ if (format.HasFlag(PixelFormat.Format16bppArgb1555))
+ {
+ return false;
+ }
+ if (format.HasFlag(PixelFormat.Format16bppGrayScale))
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ /// <summary>
/// Crops an image by removing whitespace and transparency from the edges
/// </summary>
/// <param name="bmp">The BMP.</param>
diff --git a/MediaBrowser.Controller/Drawing/ImageManager.cs b/MediaBrowser.Controller/Drawing/ImageManager.cs
index 3c6f845e5..6bae3510a 100644
--- a/MediaBrowser.Controller/Drawing/ImageManager.cs
+++ b/MediaBrowser.Controller/Drawing/ImageManager.cs
@@ -179,7 +179,7 @@ namespace MediaBrowser.Controller.Drawing
var newHeight = Convert.ToInt32(newSize.Height);
// Graphics.FromImage will throw an exception if the PixelFormat is Indexed, so we need to handle that here
- var thumbnail = originalImage.PixelFormat.HasFlag(PixelFormat.Indexed) ? new Bitmap(originalImage, newWidth, newHeight) : new Bitmap(newWidth, newHeight, originalImage.PixelFormat);
+ var thumbnail = !ImageExtensions.IsPixelFormatSupportedByGraphicsObject(originalImage.PixelFormat) ? new Bitmap(originalImage, newWidth, newHeight) : new Bitmap(newWidth, newHeight, originalImage.PixelFormat);
// Preserve the original resolution
thumbnail.SetResolution(originalImage.HorizontalResolution, originalImage.VerticalResolution);
diff --git a/MediaBrowser.Controller/Library/IUserManager.cs b/MediaBrowser.Controller/Library/IUserManager.cs
index f1cef1d66..910ba13b2 100644
--- a/MediaBrowser.Controller/Library/IUserManager.cs
+++ b/MediaBrowser.Controller/Library/IUserManager.cs
@@ -20,7 +20,7 @@ namespace MediaBrowser.Controller.Library
/// Gets the active connections.
/// </summary>
/// <value>The active connections.</value>
- IEnumerable<ClientConnectionInfo> ConnectedUsers { get; }
+ IEnumerable<ClientConnectionInfo> RecentConnections { get; }
/// <summary>
/// Occurs when [playback start].