diff --git a/src/display/canvas.js b/src/display/canvas.js index 814dc3d811f27..098741ce9d275 100644 --- a/src/display/canvas.js +++ b/src/display/canvas.js @@ -1498,6 +1498,7 @@ class CanvasGraphics { let maskY = layerOffsetY - maskOffsetY; if (backdrop) { + const backdropRGB = Util.makeHexColor(...backdrop); if ( maskX < 0 || maskY < 0 || @@ -1511,16 +1512,14 @@ class CanvasGraphics { ); const ctx = canvas.context; ctx.drawImage(maskCanvas, -maskX, -maskY); - if (backdrop.some(c => c !== 0)) { - ctx.globalCompositeOperation = "destination-atop"; - ctx.fillStyle = Util.makeHexColor(...backdrop); - ctx.fillRect(0, 0, width, height); - ctx.globalCompositeOperation = "source-over"; - } + ctx.globalCompositeOperation = "destination-atop"; + ctx.fillStyle = backdropRGB; + ctx.fillRect(0, 0, width, height); + ctx.globalCompositeOperation = "source-over"; maskCanvas = canvas.canvas; maskX = maskY = 0; - } else if (backdrop.some(c => c !== 0)) { + } else { maskCtx.save(); maskCtx.globalAlpha = 1; maskCtx.setTransform(1, 0, 0, 1, 0, 0); @@ -1528,7 +1527,7 @@ class CanvasGraphics { clip.rect(maskX, maskY, width, height); maskCtx.clip(clip); maskCtx.globalCompositeOperation = "destination-atop"; - maskCtx.fillStyle = Util.makeHexColor(...backdrop); + maskCtx.fillStyle = backdropRGB; maskCtx.fillRect(maskX, maskY, width, height); maskCtx.restore(); } diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 7af1f403d887e..b10be1106d6b6 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -679,3 +679,4 @@ !issue18036.pdf !issue18894.pdf !bug1922766.pdf +!issue18956.pdf diff --git a/test/pdfs/issue18956.pdf b/test/pdfs/issue18956.pdf new file mode 100755 index 0000000000000..7f71918c691cd Binary files /dev/null and b/test/pdfs/issue18956.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 38698ad8a4d03..da0e82f7f77c3 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -10734,5 +10734,12 @@ "type": "eq", "link": true, "talos": false + }, + { + "id": "issue18956", + "file": "pdfs/issue18956.pdf", + "md5": "73e8cd32bd063e42fcc4b270c78549b1", + "rounds": 1, + "type": "eq" } ]