mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-25 16:37:22 +02:00
Merge pull request #19756 from Snuffleupagus/canvas-unconditional-ctx-filter
Use `ctx.filter` unconditionally in the `src/display/canvas.js` file
This commit is contained in:
commit
a70f42339e
@ -20,7 +20,6 @@ import {
|
|||||||
IDENTITY_MATRIX,
|
IDENTITY_MATRIX,
|
||||||
ImageKind,
|
ImageKind,
|
||||||
info,
|
info,
|
||||||
isNodeJS,
|
|
||||||
OPS,
|
OPS,
|
||||||
shadow,
|
shadow,
|
||||||
TextRenderingMode,
|
TextRenderingMode,
|
||||||
@ -589,14 +588,9 @@ function resetCtxToDefault(ctx) {
|
|||||||
ctx.setLineDash([]);
|
ctx.setLineDash([]);
|
||||||
ctx.lineDashOffset = 0;
|
ctx.lineDashOffset = 0;
|
||||||
}
|
}
|
||||||
if (
|
const { filter } = ctx;
|
||||||
(typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) ||
|
if (filter !== "none" && filter !== "") {
|
||||||
!isNodeJS
|
ctx.filter = "none";
|
||||||
) {
|
|
||||||
const { filter } = ctx;
|
|
||||||
if (filter !== "none" && filter !== "") {
|
|
||||||
ctx.filter = "none";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2734,18 +2728,13 @@ class CanvasGraphics {
|
|||||||
|
|
||||||
this.save();
|
this.save();
|
||||||
|
|
||||||
if (
|
// The filter, if any, will be applied in applyTransferMapsToBitmap.
|
||||||
(typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) ||
|
// It must be applied to the image before rescaling else some artifacts
|
||||||
!isNodeJS
|
// could appear.
|
||||||
) {
|
// The final restore will reset it to its value.
|
||||||
// The filter, if any, will be applied in applyTransferMapsToBitmap.
|
const { filter } = ctx;
|
||||||
// It must be applied to the image before rescaling else some artifacts
|
if (filter !== "none" && filter !== "") {
|
||||||
// could appear.
|
ctx.filter = "none";
|
||||||
// The final restore will reset it to its value.
|
|
||||||
const { filter } = ctx;
|
|
||||||
if (filter !== "none" && filter !== "") {
|
|
||||||
ctx.filter = "none";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// scale the image to the unit square
|
// scale the image to the unit square
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user