mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 14:48:08 +02:00
Merge pull request #18960 from calixteman/issue18956
Always fill the mask with the backdrop color
This commit is contained in:
commit
0d42e56cab
4 changed files with 15 additions and 8 deletions
|
@ -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();
|
||||
}
|
||||
|
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
|
@ -679,3 +679,4 @@
|
|||
!issue18036.pdf
|
||||
!issue18894.pdf
|
||||
!bug1922766.pdf
|
||||
!issue18956.pdf
|
||||
|
|
BIN
test/pdfs/issue18956.pdf
Executable file
BIN
test/pdfs/issue18956.pdf
Executable file
Binary file not shown.
|
@ -10734,5 +10734,12 @@
|
|||
"type": "eq",
|
||||
"link": true,
|
||||
"talos": false
|
||||
},
|
||||
{
|
||||
"id": "issue18956",
|
||||
"file": "pdfs/issue18956.pdf",
|
||||
"md5": "73e8cd32bd063e42fcc4b270c78549b1",
|
||||
"rounds": 1,
|
||||
"type": "eq"
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue