From 2fea9ee21bc8209626fae105e49399aeef7db995 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Fri, 17 Mar 2023 12:58:35 +0100 Subject: [PATCH] Simplify the `applyTransferMapsToCanvas` method (PR 16151 follow-up) During review of PR 16151 this method was simplified, however I overlooked the fact that we now can (and really should) improve this by removing duplication. --- src/display/canvas.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/display/canvas.js b/src/display/canvas.js index 7e758fbf7..0194fe3c0 100644 --- a/src/display/canvas.js +++ b/src/display/canvas.js @@ -2964,19 +2964,11 @@ class CanvasGraphics { } applyTransferMapsToCanvas(ctx) { - if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) { - if (this.current.transferMaps !== "none") { - warn("Ignoring transferMaps - `OffscreenCanvas` support is disabled."); - } - return ctx.canvas; + if (this.current.transferMaps !== "none") { + ctx.filter = this.current.transferMaps; + ctx.drawImage(ctx.canvas, 0, 0); + ctx.filter = "none"; } - if (this.current.transferMaps === "none") { - return ctx.canvas; - } - ctx.filter = this.current.transferMaps; - ctx.drawImage(ctx.canvas, 0, 0); - ctx.filter = "none"; - return ctx.canvas; }