Skip to content

Commit 0d42e56

Browse files
authored
Merge pull request mozilla#18960 from calixteman/issue18956
Always fill the mask with the backdrop color
2 parents bde36f2 + d114f71 commit 0d42e56

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

src/display/canvas.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,6 +1498,7 @@ class CanvasGraphics {
14981498
let maskY = layerOffsetY - maskOffsetY;
14991499

15001500
if (backdrop) {
1501+
const backdropRGB = Util.makeHexColor(...backdrop);
15011502
if (
15021503
maskX < 0 ||
15031504
maskY < 0 ||
@@ -1511,24 +1512,22 @@ class CanvasGraphics {
15111512
);
15121513
const ctx = canvas.context;
15131514
ctx.drawImage(maskCanvas, -maskX, -maskY);
1514-
if (backdrop.some(c => c !== 0)) {
1515-
ctx.globalCompositeOperation = "destination-atop";
1516-
ctx.fillStyle = Util.makeHexColor(...backdrop);
1517-
ctx.fillRect(0, 0, width, height);
1518-
ctx.globalCompositeOperation = "source-over";
1519-
}
1515+
ctx.globalCompositeOperation = "destination-atop";
1516+
ctx.fillStyle = backdropRGB;
1517+
ctx.fillRect(0, 0, width, height);
1518+
ctx.globalCompositeOperation = "source-over";
15201519

15211520
maskCanvas = canvas.canvas;
15221521
maskX = maskY = 0;
1523-
} else if (backdrop.some(c => c !== 0)) {
1522+
} else {
15241523
maskCtx.save();
15251524
maskCtx.globalAlpha = 1;
15261525
maskCtx.setTransform(1, 0, 0, 1, 0, 0);
15271526
const clip = new Path2D();
15281527
clip.rect(maskX, maskY, width, height);
15291528
maskCtx.clip(clip);
15301529
maskCtx.globalCompositeOperation = "destination-atop";
1531-
maskCtx.fillStyle = Util.makeHexColor(...backdrop);
1530+
maskCtx.fillStyle = backdropRGB;
15321531
maskCtx.fillRect(maskX, maskY, width, height);
15331532
maskCtx.restore();
15341533
}

test/pdfs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,3 +679,4 @@
679679
!issue18036.pdf
680680
!issue18894.pdf
681681
!bug1922766.pdf
682+
!issue18956.pdf

test/pdfs/issue18956.pdf

8.99 KB
Binary file not shown.

test/test_manifest.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10734,5 +10734,12 @@
1073410734
"type": "eq",
1073510735
"link": true,
1073610736
"talos": false
10737+
},
10738+
{
10739+
"id": "issue18956",
10740+
"file": "pdfs/issue18956.pdf",
10741+
"md5": "73e8cd32bd063e42fcc4b270c78549b1",
10742+
"rounds": 1,
10743+
"type": "eq"
1073710744
}
1073810745
]

0 commit comments

Comments
 (0)