Merge pull request #20255 from nicolo-ribaudo/low-res
Reduce background canvas resolution
This commit is contained in:
commit
f049360689
@ -363,12 +363,16 @@ describe("PDF viewer", () => {
|
|||||||
.toBeLessThan(originalCanvasSize * factor ** 2);
|
.toBeLessThan(originalCanvasSize * factor ** 2);
|
||||||
|
|
||||||
expect(canvasSize)
|
expect(canvasSize)
|
||||||
.withContext(`In ${browserName}, <= MAX_CANVAS_PIXELS`)
|
.withContext(`In ${browserName}, <= MAX_CANVAS_PIXELS / 100`)
|
||||||
.toBeLessThanOrEqual(MAX_CANVAS_PIXELS.get(browserName));
|
.toBeLessThanOrEqual(MAX_CANVAS_PIXELS.get(browserName) / 100);
|
||||||
|
|
||||||
expect(canvasSize)
|
expect(canvasSize)
|
||||||
.withContext(`In ${browserName}, > MAX_CANVAS_PIXELS * 0.99`)
|
.withContext(
|
||||||
.toBeGreaterThan(MAX_CANVAS_PIXELS.get(browserName) * 0.99);
|
`In ${browserName}, > MAX_CANVAS_PIXELS / 100 * 0.95`
|
||||||
|
)
|
||||||
|
.toBeGreaterThan(
|
||||||
|
(MAX_CANVAS_PIXELS.get(browserName) / 100) * 0.95
|
||||||
|
);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -565,10 +569,10 @@ describe("PDF viewer", () => {
|
|||||||
.toBe(2);
|
.toBe(2);
|
||||||
expect(after[0].width)
|
expect(after[0].width)
|
||||||
.withContext(`In ${browserName}`)
|
.withContext(`In ${browserName}`)
|
||||||
.toBe(582 * pixelRatio);
|
.toBe(Math.floor(58.2 * pixelRatio));
|
||||||
expect(after[0].height)
|
expect(after[0].height)
|
||||||
.withContext(`In ${browserName}`)
|
.withContext(`In ${browserName}`)
|
||||||
.toBe(823 * pixelRatio);
|
.toBe(Math.floor(82.3 * pixelRatio));
|
||||||
|
|
||||||
// The dimensions of the detail canvas are capped to 800x600 but
|
// The dimensions of the detail canvas are capped to 800x600 but
|
||||||
// it depends on the visible area which depends itself of the
|
// it depends on the visible area which depends itself of the
|
||||||
|
|||||||
@ -798,6 +798,12 @@ class PDFPageView extends BasePDFPageView {
|
|||||||
this.maxCanvasDim,
|
this.maxCanvasDim,
|
||||||
this.capCanvasAreaFactor
|
this.capCanvasAreaFactor
|
||||||
);
|
);
|
||||||
|
if (this.#needsRestrictedScaling && this.enableDetailCanvas) {
|
||||||
|
// If we are going to have a high-res detail view, further reduce
|
||||||
|
// the canvas resolution to improve rendering performance.
|
||||||
|
outputScale.sx /= 10;
|
||||||
|
outputScale.sy /= 10;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user