http://www.zhihu.com/question/37698502
let width = canvas.width,height=canvas.height;
if (window.devicePixelRatio) {//检测是否有像素比
canvas.style.width = width + "px";
canvas.style.height = height + "px";
canvas.height = height * window.devicePixelRatio;//将canvas画布转为真实像素大小
canvas.width = width * window.devicePixelRatio;
ctx.scale(window.devicePixelRatio, window.devicePixelRatio);//将画笔调为像素比大小
}
来解决Retina屏下的canvas锯齿问题。