diff --git a/src/components/cardbuilder/cardBuilder.js b/src/components/cardbuilder/cardBuilder.js index c20f6999f9..6cdbf55149 100644 --- a/src/components/cardbuilder/cardBuilder.js +++ b/src/components/cardbuilder/cardBuilder.js @@ -2,7 +2,6 @@ define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'focusMana function (datetime, imageLoader, connectionManager, itemHelper, focusManager, indicators, globalize, layoutManager, appHost, dom, browser, playbackManager, itemShortcuts, imageHelper) { 'use strict'; - var devicePixelRatio = window.devicePixelRatio || 1; var enableFocusTransform = !browser.slow && !browser.edge; function getCardsHtml(items, options) { @@ -592,7 +591,7 @@ define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'focusMana }); } else if (item.AlbumId && item.AlbumPrimaryImageTag) { - width = primaryImageAspectRatio ? Math.round(height * primaryImageAspectRatio) : null; + height = width && primaryImageAspectRatio ? Math.round(width / primaryImageAspectRatio) : null; imgUrl = apiClient.getScaledImageUrl(item.AlbumId, { type: "Primary", diff --git a/src/components/cardbuilder/chaptercardbuilder.js b/src/components/cardbuilder/chaptercardbuilder.js index 02d583abc0..16326b6c59 100644 --- a/src/components/cardbuilder/chaptercardbuilder.js +++ b/src/components/cardbuilder/chaptercardbuilder.js @@ -68,7 +68,7 @@ define(['datetime', 'imageLoader', 'connectionManager', 'layoutManager', 'browse return apiClient.getScaledImageUrl(item.Id, { - maxWidth: maxWidth, + maxWidth: maxWidth * 2, tag: chapter.ImageTag, type: "Chapter", index: index diff --git a/src/components/dom.js b/src/components/dom.js index a000373b6d..bdd7d5d95f 100644 --- a/src/components/dom.js +++ b/src/components/dom.js @@ -114,8 +114,8 @@ define([], function () { var standardWidths = [480, 720, 1280, 1440, 1920, 2560, 3840, 5120, 7680]; function getScreenWidth() { - var width = window.innerWidth * window.devicePixelRatio; - var height = window.innerHeight * window.devicePixelRatio; + var width = window.innerWidth; + var height = window.innerHeight; if (height > width) { /* If we're in portrait, compute the proper width for this height, diff --git a/src/controllers/auth/login.js b/src/controllers/auth/login.js index a97f2e849d..4296b8bfb3 100644 --- a/src/controllers/auth/login.js +++ b/src/controllers/auth/login.js @@ -106,7 +106,7 @@ define(["apphost", "appSettings", "dom", "connectionManager", "loading", "layout if (user.PrimaryImageTag) { imgUrl = apiClient.getUserImageUrl(user.Id, { - width: 300 * window.devicePixelRatio, + width: 300, tag: user.PrimaryImageTag, type: "Primary" }); diff --git a/src/controllers/dashboard/dashboard.js b/src/controllers/dashboard/dashboard.js index 51e8c2e190..6a260d8dfb 100644 --- a/src/controllers/dashboard/dashboard.js +++ b/src/controllers/dashboard/dashboard.js @@ -493,15 +493,15 @@ define(["datetime", "events", "itemHelper", "serverNotifications", "dom", "globa if (nowPlayingItem.ImageTags && nowPlayingItem.ImageTags.Logo) { imgUrl = ApiClient.getScaledImageUrl(nowPlayingItem.Id, { tag: nowPlayingItem.ImageTags.Logo, - maxHeight: 24 * window.devicePixelRatio, - maxWidth: 130 * window.devicePixelRatio, + maxHeight: 24, + maxWidth: 130, type: "Logo" }); } else if (nowPlayingItem.ParentLogoImageTag) { imgUrl = ApiClient.getScaledImageUrl(nowPlayingItem.ParentLogoItemId, { tag: nowPlayingItem.ParentLogoImageTag, - maxHeight: 24 * window.devicePixelRatio, - maxWidth: 130 * window.devicePixelRatio, + maxHeight: 24, + maxWidth: 130, type: "Logo" }); } diff --git a/src/controllers/playback/videoosd.js b/src/controllers/playback/videoosd.js index bf605976c3..24b6548544 100644 --- a/src/controllers/playback/videoosd.js +++ b/src/controllers/playback/videoosd.js @@ -334,24 +334,24 @@ define(["playbackManager", "dom", "inputManager", "datetime", "itemHelper", "med if (item) { var imgUrl = seriesImageUrl(item, { - maxWidth: Math.round(dom.getScreenWidth() * 0.20), + maxWidth: osdPoster.clientWidth * 2, type: "Primary" }) || seriesImageUrl(item, { - maxWidth: Math.round(dom.getScreenWidth() * 0.20), + maxWidth: osdPoster.clientWidth * 2, type: "Thumb" }) || imageUrl(item, { - maxWidth: Math.round(dom.getScreenWidth() * 0.20), + maxWidth: osdPoster.clientWidth * 2, type: "Primary" }); if (!imgUrl && secondaryItem && (imgUrl = seriesImageUrl(secondaryItem, { - maxWidth: Math.round(dom.getScreenWidth() * 0.20), + maxWidth: osdPoster.clientWidth * 2, type: "Primary" }) || seriesImageUrl(secondaryItem, { - maxWidth: Math.round(dom.getScreenWidth() * 0.20), + maxWidth: osdPoster.clientWidth * 2, type: "Thumb" }) || imageUrl(secondaryItem, { - maxWidth: Math.round(dom.getScreenWidth() * 0.20), + maxWidth: osdPoster.clientWidth * 2, type: "Primary" })), imgUrl) { return void (osdPoster.innerHTML = ''); diff --git a/src/controllers/userprofilespage.js b/src/controllers/userprofilespage.js index 3e41c04858..2a2387ab60 100644 --- a/src/controllers/userprofilespage.js +++ b/src/controllers/userprofilespage.js @@ -88,7 +88,7 @@ define(["loading", "dom", "globalize", "humanedate", "paper-icon-button-light", if (user.PrimaryImageTag) { imgUrl = ApiClient.getUserImageUrl(user.Id, { - width: 300 * window.devicePixelRatio, + width: 300, tag: user.PrimaryImageTag, type: "Primary" }); diff --git a/src/libraries/apiclient/apiclient.js b/src/libraries/apiclient/apiclient.js index d848358c3e..58cfa300b9 100644 --- a/src/libraries/apiclient/apiclient.js +++ b/src/libraries/apiclient/apiclient.js @@ -59,8 +59,8 @@ define(["libraries/apiclient/apiclientcore", "localassetmanager"], function(ApiC }) } - function ApiClientEx(serverAddress, clientName, applicationVersion, deviceName, deviceId, devicePixelRatio) { - ApiClient.call(this, serverAddress, clientName, applicationVersion, deviceName, deviceId, devicePixelRatio) + function ApiClientEx(serverAddress, clientName, applicationVersion, deviceName, deviceId) { + ApiClient.call(this, serverAddress, clientName, applicationVersion, deviceName, deviceId) } var localPrefix = "local:", localViewPrefix = "localview:"; diff --git a/src/libraries/apiclient/apiclientcore.js b/src/libraries/apiclient/apiclientcore.js index ec1a329b13..557a4e1033 100644 --- a/src/libraries/apiclient/apiclientcore.js +++ b/src/libraries/apiclient/apiclientcore.js @@ -58,7 +58,7 @@ define(["events", "appStorage"], function(events, appStorage) { return request.data && ("string" == typeof request.data ? fetchRequest.body = request.data : (fetchRequest.body = paramsToString(request.data), contentType = contentType || "application/x-www-form-urlencoded; charset=UTF-8")), contentType && (headers["Content-Type"] = contentType), request.timeout ? fetchWithTimeout(request.url, fetchRequest, request.timeout) : fetch(request.url, fetchRequest) } - function ApiClient(serverAddress, appName, appVersion, deviceName, deviceId, devicePixelRatio) { + function ApiClient(serverAddress, appName, appVersion, deviceName, deviceId) { if (!serverAddress) { throw new Error("Must supply a serverAddress"); } @@ -75,7 +75,6 @@ define(["events", "appStorage"], function(events, appStorage) { this._deviceName = deviceName; this._appName = appName; this._appVersion = appVersion; - this._devicePixelRatio = devicePixelRatio; } function setSavedEndpointInfo(instance, info) { @@ -218,7 +217,7 @@ define(["events", "appStorage"], function(events, appStorage) { } function normalizeImageOptions(instance, options) { - var ratio = instance._devicePixelRatio || 1; + var ratio = window.devicePixelRatio; ratio && (options.minScale && (ratio = Math.max(options.minScale, ratio)), options.width && (options.width = Math.round(options.width * ratio)), options.height && (options.height = Math.round(options.height * ratio)), options.maxWidth && (options.maxWidth = Math.round(options.maxWidth * ratio)), options.maxHeight && (options.maxHeight = Math.round(options.maxHeight * ratio))), options.quality = options.quality || instance.getDefaultImageQuality(options.type), instance.normalizeImageOptions && instance.normalizeImageOptions(options) } diff --git a/src/libraries/apiclient/connectionmanager.js b/src/libraries/apiclient/connectionmanager.js index a8e389bd03..dc5ef406e5 100644 --- a/src/libraries/apiclient/connectionmanager.js +++ b/src/libraries/apiclient/connectionmanager.js @@ -186,7 +186,7 @@ define(["events", "apiclient", "appStorage"], function (events, apiClientFactory Manual: 2 }; - var ConnectionManager = function (credentialProvider, appName, appVersion, deviceName, deviceId, capabilities, devicePixelRatio) { + var ConnectionManager = function (credentialProvider, appName, appVersion, deviceName, deviceId, capabilities) { function onAuthenticated(apiClient, result, options, saveCredentials) { var credentials = credentialProvider.credentials(); @@ -540,7 +540,7 @@ define(["events", "apiclient", "appStorage"], function (events, apiClientFactory var apiClient = self.getApiClient(server.Id); if (!apiClient) { - apiClient = new apiClientFactory(serverUrl, appName, appVersion, deviceName, deviceId, devicePixelRatio); + apiClient = new apiClientFactory(serverUrl, appName, appVersion, deviceName, deviceId); self._apiClients.push(apiClient); apiClient.serverInfo(server); apiClient.onAuthenticated = function (instance, result) { diff --git a/src/scripts/site.js b/src/scripts/site.js index 7332ba7b83..5dae39a68f 100644 --- a/src/scripts/site.js +++ b/src/scripts/site.js @@ -280,7 +280,7 @@ var AppInfo = {}; capabilities.DeviceProfile = deviceProfile; - var connectionManager = new ConnectionManager(credentialProviderInstance, apphost.appName(), apphost.appVersion(), apphost.deviceName(), apphost.deviceId(), capabilities, window.devicePixelRatio); + var connectionManager = new ConnectionManager(credentialProviderInstance, apphost.appName(), apphost.appVersion(), apphost.deviceName(), apphost.deviceId(), capabilities); defineConnectionManager(connectionManager); bindConnectionManagerEvents(connectionManager, events, userSettings); @@ -291,7 +291,7 @@ var AppInfo = {}; return require(["apiclient"], function (apiClientFactory) { console.debug("creating ApiClient singleton"); - var apiClient = new apiClientFactory(Dashboard.serverAddress(), apphost.appName(), apphost.appVersion(), apphost.deviceName(), apphost.deviceId(), window.devicePixelRatio); + var apiClient = new apiClientFactory(Dashboard.serverAddress(), apphost.appName(), apphost.appVersion(), apphost.deviceName(), apphost.deviceId()); apiClient.enableAutomaticNetworking = false; apiClient.manualAddressOnly = true;