code: function(canvas, useDevicePixelRatio) {
      var mult = useDevicePixelRatio ? window.devicePixelRatio : 1;
      mult = mult || 1;
      var width  = Math.floor(canvas.clientWidth  * mult);
      var height = Math.floor(canvas.clientHeight * mult);
      if (canvas.width !== width ||
          canvas.height !== height) {
        canvas.width = width;
        canvas.height = height;
        return true;
      }
    }
docs: Resizes a cavnas to match its CSS displayed size.
  @param {Canvas} canvas canvas to resize.
  @param {boolean?} useDevicePixelRatio if true canvas will be
  created to match devicePixelRatio.
  @memberOf module:Misc