1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 06:38:07 +02:00

Shorten the PDFThumbnailView.prototype.#getReducedImageDims method (PR 19635 follow-up)

This method is slightly more verbose than necessary, hence we can shorten the code a little bit.
This commit is contained in:
Jonas Jenwald 2025-03-15 13:19:34 +01:00
parent 4b2683ecb6
commit b7eef925ac

View file

@ -366,8 +366,8 @@ class PDFThumbnailView {
}
#getReducedImageDims(canvas) {
let reducedWidth = canvas.width << MAX_NUM_SCALING_STEPS,
reducedHeight = canvas.height << MAX_NUM_SCALING_STEPS;
const width = canvas.width << MAX_NUM_SCALING_STEPS,
height = canvas.height << MAX_NUM_SCALING_STEPS;
const outputScale = new OutputScale();
// Here we're not actually "rendering" to the canvas and the `OutputScale`
@ -375,15 +375,12 @@ class PDFThumbnailView {
outputScale.sx = outputScale.sy = 1;
outputScale.limitCanvas(
reducedWidth,
reducedHeight,
width,
height,
this.maxCanvasPixels,
this.maxCanvasDim
);
reducedWidth = (reducedWidth * outputScale.sx) | 0;
reducedHeight = (reducedHeight * outputScale.sy) | 0;
return [reducedWidth, reducedHeight];
return [(width * outputScale.sx) | 0, (height * outputScale.sy) | 0];
}
#reduceImage(img) {