diff --git a/ext/src/senders/mirroring.ts b/ext/src/senders/mirroring.ts index f4ead03..1d3fb2e 100644 --- a/ext/src/senders/mirroring.ts +++ b/ext/src/senders/mirroring.ts @@ -81,13 +81,16 @@ async function onRequestSessionSuccess (newSession: cast.Session) { } // Set initial size - canvas.width = window.innerWidth; - canvas.height = window.innerHeight; + canvas.width = window.innerWidth * window.devicePixelRatio; + canvas.height = window.innerHeight * window.devicePixelRatio; + ctx.scale(window.devicePixelRatio, window.devicePixelRatio); // Resize canvas whenever the window resizes window.addEventListener("resize", () => { - canvas.width = window.innerWidth; - canvas.height = window.innerHeight; + canvas.width = window.innerWidth * window.devicePixelRatio; + canvas.height = window.innerHeight * window.devicePixelRatio; + ctx.setTransform(1, 0, 0, 1, 0, 0); + ctx.scale(window.devicePixelRatio, window.devicePixelRatio); }); // TODO: Test performance