mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
Remove the backingStorePixelRatio
-part of the getOutputScale
helper function
The `CanvasRenderingContext2D.backingStorePixelRatio` property was never standardized, and only Safari set (its prefixed version of) it to anything other than `1`. Note that e.g. MDN doesn't contain any information about this property, and one of the few sources of information (at this point) is the following post: https://stackoverflow.com/questions/24332639/why-context2d-backingstorepixelratio-deprecated Hence we can simplify the `getOutputScale` helper function, by removing some dead code, and now it no longer requires any parameters when called.
This commit is contained in:
parent
d9a3a24353
commit
0159ec0a12
3 changed files with 9 additions and 17 deletions
|
@ -79,18 +79,11 @@ const AutoPrintRegExp = /\bprint\s*\(/;
|
|||
|
||||
/**
|
||||
* Returns scale factor for the canvas. It makes sense for the HiDPI displays.
|
||||
* @returns {Object} The object with horizontal (sx) and vertical (sy)
|
||||
* scales. The scaled property is set to false if scaling is
|
||||
* not required, true otherwise.
|
||||
* @returns {Object} The object with horizontal (sx) and vertical (sy) scales.
|
||||
* The scaled property is false if scaling is not required, true otherwise.
|
||||
*/
|
||||
function getOutputScale(ctx) {
|
||||
const devicePixelRatio = window.devicePixelRatio || 1;
|
||||
const backingStoreRatio =
|
||||
ctx.webkitBackingStorePixelRatio ||
|
||||
ctx.mozBackingStorePixelRatio ||
|
||||
ctx.backingStorePixelRatio ||
|
||||
1;
|
||||
const pixelRatio = devicePixelRatio / backingStoreRatio;
|
||||
function getOutputScale() {
|
||||
const pixelRatio = window.devicePixelRatio || 1;
|
||||
return {
|
||||
sx: pixelRatio,
|
||||
sy: pixelRatio,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue