Skip to content

Commit b7eef92

Browse files
committed
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.
1 parent 4b2683e commit b7eef92

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

web/pdf_thumbnail_view.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -366,24 +366,21 @@ class PDFThumbnailView {
366366
}
367367

368368
#getReducedImageDims(canvas) {
369-
let reducedWidth = canvas.width << MAX_NUM_SCALING_STEPS,
370-
reducedHeight = canvas.height << MAX_NUM_SCALING_STEPS;
369+
const width = canvas.width << MAX_NUM_SCALING_STEPS,
370+
height = canvas.height << MAX_NUM_SCALING_STEPS;
371371

372372
const outputScale = new OutputScale();
373373
// Here we're not actually "rendering" to the canvas and the `OutputScale`
374374
// is thus only used to limit the canvas size, hence the identity scale.
375375
outputScale.sx = outputScale.sy = 1;
376376

377377
outputScale.limitCanvas(
378-
reducedWidth,
379-
reducedHeight,
378+
width,
379+
height,
380380
this.maxCanvasPixels,
381381
this.maxCanvasDim
382382
);
383-
reducedWidth = (reducedWidth * outputScale.sx) | 0;
384-
reducedHeight = (reducedHeight * outputScale.sy) | 0;
385-
386-
return [reducedWidth, reducedHeight];
383+
return [(width * outputScale.sx) | 0, (height * outputScale.sy) | 0];
387384
}
388385

389386
#reduceImage(img) {

0 commit comments

Comments
 (0)