From 3556058b2b29004b3c7167e6d5b624fec28d5cef Mon Sep 17 00:00:00 2001 From: pmohanj Date: Sun, 24 Dec 2023 10:36:16 +0530 Subject: [PATCH] fix the return of odd numbered pixels The point of subtracting a dimension%2 from its actual dimension is to avoid odd numbered pixels, so due to variation of DPR from device to device the subtraction should be done at the end of pixel calculation. --- addons/gst-web/src/input.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/gst-web/src/input.js b/addons/gst-web/src/input.js index 3768ac95..e773a7a0 100644 --- a/addons/gst-web/src/input.js +++ b/addons/gst-web/src/input.js @@ -535,8 +535,8 @@ class Input { getWindowResolution() { return [ - parseInt((document.body.offsetWidth - document.body.offsetWidth%2) * window.devicePixelRatio), - parseInt((document.body.offsetHeight - document.body.offsetHeight%2) * window.devicePixelRatio) + parseInt( (() => {var width = document.body.offsetWidth * window.devicePixelRatio; return width - width % 2})() ), + parseInt( (() => {var height = document.body.offsetHeight * window.devicePixelRatio; return height - height % 2})() ) ]; } }