_determinePixelRatio() {
    const ctx = this.getContext();
    if (ctx === undefined) {
      throw new Error("Could not get canvax context");
    }

    let numerator = 1;
    if (typeof window !== "undefined") {
      // (window !== undefined) doesn't work here!
      // Protection during unit tests, where 'window' can be missing
      numerator = window.devicePixelRatio || 1;
    }

    const denominator =
      ctx.webkitBackingStorePixelRatio ||
      ctx.mozBackingStorePixelRatio ||
      ctx.msBackingStorePixelRatio ||
      ctx.oBackingStorePixelRatio ||
      ctx.backingStorePixelRatio ||
      1;

    return numerator / denominator;
  }
Determine the pixel ratio for various browsers.
@returns {number}
@private