Merge pull request #20256 from nicolo-ribaudo/bboxes-when-needed
Only record bboxes when needed
This commit is contained in:
commit
e78c7d0cc2
@ -187,11 +187,15 @@ class PDFPageDetailView extends BasePDFPageView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_getRenderingContext(canvas, transform) {
|
_getRenderingContext(canvas, transform) {
|
||||||
const baseContext = this.pageView._getRenderingContext(canvas, transform);
|
const baseContext = this.pageView._getRenderingContext(
|
||||||
|
canvas,
|
||||||
|
transform,
|
||||||
|
false
|
||||||
|
);
|
||||||
const recordedBBoxes = this.pdfPage.recordedBBoxes;
|
const recordedBBoxes = this.pdfPage.recordedBBoxes;
|
||||||
|
|
||||||
if (!recordedBBoxes || !this.enableOptimizedPartialRendering) {
|
if (!recordedBBoxes || !this.enableOptimizedPartialRendering) {
|
||||||
return { ...baseContext, recordOperations: false };
|
return baseContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@ -211,7 +215,6 @@ class PDFPageDetailView extends BasePDFPageView {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
...baseContext,
|
...baseContext,
|
||||||
recordOperations: false,
|
|
||||||
operationsFilter(index) {
|
operationsFilter(index) {
|
||||||
if (recordedBBoxes.isEmpty(index)) {
|
if (recordedBBoxes.isEmpty(index)) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -929,7 +929,7 @@ class PDFPageView extends BasePDFPageView {
|
|||||||
return canvasWrapper;
|
return canvasWrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
_getRenderingContext(canvas, transform) {
|
_getRenderingContext(canvas, transform, recordOperations) {
|
||||||
return {
|
return {
|
||||||
canvas,
|
canvas,
|
||||||
transform,
|
transform,
|
||||||
@ -939,8 +939,7 @@ class PDFPageView extends BasePDFPageView {
|
|||||||
annotationCanvasMap: this._annotationCanvasMap,
|
annotationCanvasMap: this._annotationCanvasMap,
|
||||||
pageColors: this.pageColors,
|
pageColors: this.pageColors,
|
||||||
isEditing: this.#isEditing,
|
isEditing: this.#isEditing,
|
||||||
recordOperations:
|
recordOperations,
|
||||||
this.enableOptimizedPartialRendering && !this.recordedBBoxes,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1058,12 +1057,17 @@ class PDFPageView extends BasePDFPageView {
|
|||||||
this.#scaleRoundY = sfy[1];
|
this.#scaleRoundY = sfy[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const recordBBoxes =
|
||||||
|
this.enableOptimizedPartialRendering &&
|
||||||
|
this.#hasRestrictedScaling &&
|
||||||
|
!this.recordedBBoxes;
|
||||||
|
|
||||||
// Rendering area
|
// Rendering area
|
||||||
const transform = outputScale.scaled
|
const transform = outputScale.scaled
|
||||||
? [outputScale.sx, 0, 0, outputScale.sy, 0, 0]
|
? [outputScale.sx, 0, 0, outputScale.sy, 0, 0]
|
||||||
: null;
|
: null;
|
||||||
const resultPromise = this._drawCanvas(
|
const resultPromise = this._drawCanvas(
|
||||||
this._getRenderingContext(canvas, transform),
|
this._getRenderingContext(canvas, transform, recordBBoxes),
|
||||||
() => {
|
() => {
|
||||||
prevCanvas?.remove();
|
prevCanvas?.remove();
|
||||||
this._resetCanvas();
|
this._resetCanvas();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user