code: function(context) {
              var devicePixelRatio = window.devicePixelRatio || 1,
                  backingStoreRatio =
                  context.webkitBackingStorePixelRatio ||
                  context.mozBackingStorePixelRatio ||
                  context.msBackingStorePixelRatio ||
                  context.oBackingStorePixelRatio ||
                  context.backingStorePixelRatio || 1;
              return devicePixelRatio / backingStoreRatio;
          }
docs: - getPixelRatio(context)
  
  This function returns the current pixel ratio defined by the product of desktop
  zoom and page zoom.
  Additional info: https://www.html5rocks.com/en/tutorials/canvas/hidpi/