野生安乃近
2018-08-14 17:30:53浏览 3211
//=== canvas 模糊问题 start
var ratio = getPixelRatio(ct);
if(ratio == 1) { // PC端 PixelRatio
ratio = 2;
}
cs.style.width = cs.width + 'px';
cs.style.height = cs.height + 'px';
cs.width = cs.width * ratio;
cs.height = cs.height * ratio;
ct.scale(ratio, ratio);
//=== canvas 模糊问题 end
var getPixelRatio = function (context) {
var backingStore = context.backingStorePixelRatio ||
context.webkitBackingStorePixelRatio ||
context.mozBackingStorePixelRatio ||
context.msBackingStorePixelRatio ||
context.oBackingStorePixelRatio ||
context.backingStorePixelRatio || 1;
return (window.devicePixelRatio || 1) / backingStore;
};