Commit 5de35ae6 authored by maimairel's avatar maimairel

Cleaner and portable function to get pixelratio

This patch is intended the make getPixelRatio function portable and cleaner :)

Previous indentation issue has also been fixed.

Thanks :)
parent 1262aa39
...@@ -724,12 +724,15 @@ ...@@ -724,12 +724,15 @@
// therefore has a pixel ratio of 2, while most normal devices have a ratio of 1. // therefore has a pixel ratio of 2, while most normal devices have a ratio of 1.
function getPixelRatio(cctx) { function getPixelRatio(cctx) {
if (window.devicePixelRatio > 1 && var devicePixelRatio = window.devicePixelRatio || 1;
(cctx.webkitBackingStorePixelRatio === undefined || var backingStoreRatio =
cctx.webkitBackingStorePixelRatio < 2)) cctx.webkitBackingStorePixelRatio ||
return window.devicePixelRatio; cctx.mozBackingStorePixelRatio ||
cctx.msBackingStorePixelRatio ||
return 1; cctx.oBackingStorePixelRatio ||
cctx.backingStorePixelRatio || 1;
return devicePixelRatio / backingStoreRatio;
} }
function makeCanvas(skipPositioning, cls) { function makeCanvas(skipPositioning, cls) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment