Implement proper support for HiDPI screens.

For performance reason optional for now, activated by setting the hidpi attribute on the canvas element.