1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Use canvas and css width/height instead of css transform for high dpi.

This commit is contained in:
Brendan Dahl 2013-09-20 12:11:14 -07:00
parent 31fda50123
commit 6ef44da10b
2 changed files with 20 additions and 16 deletions

View file

@ -82,8 +82,14 @@ function getFileName(url) {
scales. The scaled property is set to false if scaling is
not required, true otherwise.
*/
function getOutputScale() {
var pixelRatio = 'devicePixelRatio' in window ? window.devicePixelRatio : 1;
function getOutputScale(ctx) {
var devicePixelRatio = window.devicePixelRatio || 1;
var backingStoreRatio = ctx.webkitBackingStorePixelRatio ||
ctx.mozBackingStorePixelRatio ||
ctx.msBackingStorePixelRatio ||
ctx.oBackingStorePixelRatio ||
ctx.backingStorePixelRatio || 1;
var pixelRatio = devicePixelRatio / backingStoreRatio;
return {
sx: pixelRatio,
sy: pixelRatio,