mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-23 16:48:08 +02:00
Merge pull request #19758 from Snuffleupagus/OperatorList-setOptions
Initialize the `isOffscreenCanvasSupported` option, in the `OperatorList` class, once per document
This commit is contained in:
commit
7cfb1be650
3 changed files with 7 additions and 11 deletions
|
@ -728,8 +728,6 @@ class PartialEvaluator {
|
|||
/* forceRGBA = */ true,
|
||||
/* isOffscreenCanvasSupported = */ false
|
||||
);
|
||||
operatorList.isOffscreenCanvasSupported =
|
||||
this.options.isOffscreenCanvasSupported;
|
||||
operatorList.addImageOps(
|
||||
OPS.paintInlineImageXObject,
|
||||
[imgData],
|
||||
|
|
|
@ -567,17 +567,12 @@ class QueueOptimizer extends NullOptimizer {
|
|||
iCurr: 0,
|
||||
fnArray: queue.fnArray,
|
||||
argsArray: queue.argsArray,
|
||||
isOffscreenCanvasSupported: false,
|
||||
isOffscreenCanvasSupported: OperatorList.isOffscreenCanvasSupported,
|
||||
};
|
||||
this.match = null;
|
||||
this.lastProcessed = 0;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line accessor-pairs
|
||||
set isOffscreenCanvasSupported(value) {
|
||||
this.context.isOffscreenCanvasSupported = value;
|
||||
}
|
||||
|
||||
_optimize() {
|
||||
// Process new fnArray item(s) chunk.
|
||||
const fnArray = this.queue.fnArray;
|
||||
|
@ -656,6 +651,8 @@ class OperatorList {
|
|||
// Close to chunk size.
|
||||
static CHUNK_SIZE_ABOUT = this.CHUNK_SIZE - 5;
|
||||
|
||||
static isOffscreenCanvasSupported = false;
|
||||
|
||||
constructor(intent = 0, streamSink) {
|
||||
this._streamSink = streamSink;
|
||||
this.fnArray = [];
|
||||
|
@ -670,9 +667,8 @@ class OperatorList {
|
|||
this._resolved = streamSink ? null : Promise.resolve();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line accessor-pairs
|
||||
set isOffscreenCanvasSupported(value) {
|
||||
this.optimizer.isOffscreenCanvasSupported = value;
|
||||
static setOptions({ isOffscreenCanvasSupported }) {
|
||||
this.isOffscreenCanvasSupported = isOffscreenCanvasSupported;
|
||||
}
|
||||
|
||||
get length() {
|
||||
|
|
|
@ -25,6 +25,7 @@ import { ImageResizer } from "./image_resizer.js";
|
|||
import { JpegStream } from "./jpeg_stream.js";
|
||||
import { JpxImage } from "./jpx.js";
|
||||
import { MissingDataException } from "./core_utils.js";
|
||||
import { OperatorList } from "./operator_list.js";
|
||||
import { PDFDocument } from "./document.js";
|
||||
import { Stream } from "./stream.js";
|
||||
|
||||
|
@ -74,6 +75,7 @@ class BasePdfManager {
|
|||
// Initialize image-options once per document.
|
||||
ImageResizer.setOptions(evaluatorOptions);
|
||||
JpegStream.setOptions(evaluatorOptions);
|
||||
OperatorList.setOptions(evaluatorOptions);
|
||||
|
||||
const options = { ...evaluatorOptions, handler };
|
||||
JpxImage.setOptions(options);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue