Merge pull request #19621 from Snuffleupagus/bug-1943094-thumbs
Limit the maximum thumbnail canvas width/height, similar to pages (PR 19604 follow-up)
This commit is contained in:
commit
1bc98dfbd9
@ -215,9 +215,21 @@ class PDFThumbnailView {
|
|||||||
willReadFrequently: !enableHWA,
|
willReadFrequently: !enableHWA,
|
||||||
});
|
});
|
||||||
const outputScale = new OutputScale();
|
const outputScale = new OutputScale();
|
||||||
|
const width = upscaleFactor * this.canvasWidth,
|
||||||
|
height = upscaleFactor * this.canvasHeight;
|
||||||
|
|
||||||
canvas.width = (upscaleFactor * this.canvasWidth * outputScale.sx) | 0;
|
if (this.maxCanvasDim !== -1) {
|
||||||
canvas.height = (upscaleFactor * this.canvasHeight * outputScale.sy) | 0;
|
const maxScale = Math.min(
|
||||||
|
this.maxCanvasDim / width,
|
||||||
|
this.maxCanvasDim / height
|
||||||
|
);
|
||||||
|
if (outputScale.sx > maxScale || outputScale.sy > maxScale) {
|
||||||
|
outputScale.sx = maxScale;
|
||||||
|
outputScale.sy = maxScale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
canvas.width = (width * outputScale.sx) | 0;
|
||||||
|
canvas.height = (height * outputScale.sy) | 0;
|
||||||
|
|
||||||
const transform = outputScale.scaled
|
const transform = outputScale.scaled
|
||||||
? [outputScale.sx, 0, 0, outputScale.sy, 0, 0]
|
? [outputScale.sx, 0, 0, outputScale.sy, 0, 0]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user