From 4892c32b40003c17294e66835d1741181d70790b Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 15 Oct 2022 11:57:17 +0200 Subject: [PATCH] Fix blur caused by fractional DPI scaling. --- profiler/build/wasm/index.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/profiler/build/wasm/index.html b/profiler/build/wasm/index.html index 6525add5..2246823b 100644 --- a/profiler/build/wasm/index.html +++ b/profiler/build/wasm/index.html @@ -90,9 +90,11 @@ var preloadElement = document.getElementById('preload'); function resizeHandler() { - Module.ccall('nativeResize', 'number', ['number', 'number'], [window.innerWidth * window.devicePixelRatio, window.innerHeight * window.devicePixelRatio]); - Module.canvas.style.width = window.innerWidth + 'px'; - Module.canvas.style.height = window.innerHeight + 'px'; + let w = Math.floor(Math.floor(window.innerWidth * window.devicePixelRatio) / window.devicePixelRatio); + let h = Math.floor(Math.floor(window.innerHeight * window.devicePixelRatio) / window.devicePixelRatio); + Module.ccall('nativeResize', 'number', ['number', 'number'], [w * window.devicePixelRatio, h * window.devicePixelRatio]); + Module.canvas.style.width = w + 'px'; + Module.canvas.style.height = h + 'px'; } var Module = {