//解决锯齿
var width = canvas.width,height=canvas.height;
if (window.devicePixelRatio) {
devicePixelRatio = window.devicePixelRatio;
canvas.style.width = width + "px";
canvas.style.height = height + "px";
canvas.height = height * devicePixelRatio;
canvas.width = width * devicePixelRatio;
ctx.scale(devicePixelRatio, devicePixelRatio);
}