mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-28 01:47:22 +02:00
Merge pull request #21467 from Snuffleupagus/canvas-rm-unused
Remove unused branches in the `src/display/canvas.js` file
This commit is contained in:
commit
e74be44919
@ -320,11 +320,6 @@ class CanvasExtraState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function putBinaryImageData(ctx, imgData) {
|
function putBinaryImageData(ctx, imgData) {
|
||||||
if (imgData instanceof ImageData) {
|
|
||||||
ctx.putImageData(imgData, 0, 0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Put the image data to the canvas in chunks, rather than putting the
|
// Put the image data to the canvas in chunks, rather than putting the
|
||||||
// whole image at once. This saves JS memory, because the ImageData object
|
// whole image at once. This saves JS memory, because the ImageData object
|
||||||
// is smaller. It also possibly saves C++ memory within the implementation
|
// is smaller. It also possibly saves C++ memory within the implementation
|
||||||
@ -3996,12 +3991,6 @@ class CanvasGraphics {
|
|||||||
const result = this.applyTransferMapsToBitmap(imgData);
|
const result = this.applyTransferMapsToBitmap(imgData);
|
||||||
imgToPaint = result.img;
|
imgToPaint = result.img;
|
||||||
inlineImgCanvas = result.canvasEntry;
|
inlineImgCanvas = result.canvasEntry;
|
||||||
} else if (
|
|
||||||
(typeof HTMLElement === "function" && imgData instanceof HTMLElement) ||
|
|
||||||
!imgData.data
|
|
||||||
) {
|
|
||||||
// typeof check is needed due to node.js support, see issue #8489
|
|
||||||
imgToPaint = imgData;
|
|
||||||
} else {
|
} else {
|
||||||
const tmpCanvas = this.canvasFactory.create(width, height);
|
const tmpCanvas = this.canvasFactory.create(width, height);
|
||||||
putBinaryImageData(tmpCanvas.context, imgData);
|
putBinaryImageData(tmpCanvas.context, imgData);
|
||||||
|
|||||||
@ -51,13 +51,6 @@ if (isNodeJS) {
|
|||||||
warn("Cannot polyfill `DOMMatrix`, rendering may be broken.");
|
warn("Cannot polyfill `DOMMatrix`, rendering may be broken.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!globalThis.ImageData) {
|
|
||||||
if (canvas?.ImageData) {
|
|
||||||
globalThis.ImageData = canvas.ImageData;
|
|
||||||
} else {
|
|
||||||
warn("Cannot polyfill `ImageData`, rendering may be broken.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!globalThis.Path2D) {
|
if (!globalThis.Path2D) {
|
||||||
if (canvas?.Path2D) {
|
if (canvas?.Path2D) {
|
||||||
globalThis.Path2D = canvas.Path2D;
|
globalThis.Path2D = canvas.Path2D;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user