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:
parent
4b2683ecb6
commit
b7eef925ac
@ -366,8 +366,8 @@ class PDFThumbnailView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#getReducedImageDims(canvas) {
|
#getReducedImageDims(canvas) {
|
||||||
let reducedWidth = canvas.width << MAX_NUM_SCALING_STEPS,
|
const width = canvas.width << MAX_NUM_SCALING_STEPS,
|
||||||
reducedHeight = canvas.height << MAX_NUM_SCALING_STEPS;
|
height = canvas.height << MAX_NUM_SCALING_STEPS;
|
||||||
|
|
||||||
const outputScale = new OutputScale();
|
const outputScale = new OutputScale();
|
||||||
// Here we're not actually "rendering" to the canvas and the `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.sx = outputScale.sy = 1;
|
||||||
|
|
||||||
outputScale.limitCanvas(
|
outputScale.limitCanvas(
|
||||||
reducedWidth,
|
width,
|
||||||
reducedHeight,
|
height,
|
||||||
this.maxCanvasPixels,
|
this.maxCanvasPixels,
|
||||||
this.maxCanvasDim
|
this.maxCanvasDim
|
||||||
);
|
);
|
||||||
reducedWidth = (reducedWidth * outputScale.sx) | 0;
|
return [(width * outputScale.sx) | 0, (height * outputScale.sy) | 0];
|
||||||
reducedHeight = (reducedHeight * outputScale.sy) | 0;
|
|
||||||
|
|
||||||
return [reducedWidth, reducedHeight];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#reduceImage(img) {
|
#reduceImage(img) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user