Fix blur caused by fractional DPI scaling.

This commit is contained in:
Bartosz Taudul 2022-10-15 11:57:17 +02:00
parent 9503280f33
commit 4892c32b40
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -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 = {