Skip to content

Instantly share code, notes, and snippets.

@arulprasad
Created April 22, 2013 01:50
Show Gist options
  • Save arulprasad/5431939 to your computer and use it in GitHub Desktop.
Save arulprasad/5431939 to your computer and use it in GitHub Desktop.
normalize html canvas for retina displays
// from https://github.com/subprotocol/verlet-js/blob/master/examples/shapes.html
var dpr = window.devicePixelRatio || 1;
canvas.width = width*dpr;
canvas.height = height*dpr;
canvas.getContext("2d").scale(dpr, dpr);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment