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:
Jonas Jenwald 2022-02-17 22:21:59 +01:00
parent d9a3a24353
commit 0159ec0a12
3 changed files with 9 additions and 17 deletions

View file

@ -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,