From 226e898070a57d9de77c82a8035ff3704f3bd594 Mon Sep 17 00:00:00 2001 From: Jonathan Giuffrida Date: Sun, 27 Aug 2017 14:31:33 -0500 Subject: [PATCH] Support for retina resolution `devicePixelRatio` is a window-scoped variable --- src/simg.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/simg.js b/src/simg.js index d1b0f16..1328915 100755 --- a/src/simg.js +++ b/src/simg.js @@ -48,6 +48,12 @@ canvas.width = img.width; canvas.height = img.height; + context.imageSmoothingEnabled = false; + if(devicePixelRatio >= 2){ + canvas.width *= 2; + canvas.height *= 2; + context.setTransform(2,0,0,2,0,0); + } context.drawImage(img, 0, 0); cb(canvas);