code: function (canvas) {
              var c = canvas || this._canvas;
              var ctx = c.getContext('2d');
              var devicePixelRatio = window.devicePixelRatio || 1;
              var backingStoreRatio =
                  ctx.webkitBackingStorePixelRatio ||
                  ctx.mozBackingStorePixelRatio ||
                  ctx.msBackingStorePixelRatio ||
                  ctx.oBackingStorePixelRatio ||
                  ctx.backingStorePixelRatio || 1;
              var ratio = devicePixelRatio / backingStoreRatio;
  
              if (devicePixelRatio !== backingStoreRatio) {
                  var oldWidth = this._container.clientWidth;
                  var oldHeight = this._container.clientHeight;
  
                  c.width = oldWidth * ratio;
                  c.height = oldHeight * ratio;
  
                  c.style.width = oldWidth + 'px';
                  c.style.height = oldHeight + 'px';
  
                  // now scale the context to counter the fact that we've
                  // manually scaled our canvas element
                  ctx.scale(ratio, ratio);
                  this._scale = ratio;
              }
              else {
                  c.width = this._container.clientWidth;
                  c.height = this._container.clientHeight;
              }
          }
docs: Adjust canvas for pixel ratio
  @param canvas