Always fill the mask with the backdrop color
It fixes #18956. In the patch #18029, for performance reasons and because I thought it was useless, I deliberately chose to not fill the mask with the backdrop color when it's full black: it was a bad idea. So in this patch we always add the backdrop color to the mask.
This commit is contained in:
parent
bde36f28be
commit
d114f71feb
@ -1498,6 +1498,7 @@ class CanvasGraphics {
|
|||||||
let maskY = layerOffsetY - maskOffsetY;
|
let maskY = layerOffsetY - maskOffsetY;
|
||||||
|
|
||||||
if (backdrop) {
|
if (backdrop) {
|
||||||
|
const backdropRGB = Util.makeHexColor(...backdrop);
|
||||||
if (
|
if (
|
||||||
maskX < 0 ||
|
maskX < 0 ||
|
||||||
maskY < 0 ||
|
maskY < 0 ||
|
||||||
@ -1511,16 +1512,14 @@ class CanvasGraphics {
|
|||||||
);
|
);
|
||||||
const ctx = canvas.context;
|
const ctx = canvas.context;
|
||||||
ctx.drawImage(maskCanvas, -maskX, -maskY);
|
ctx.drawImage(maskCanvas, -maskX, -maskY);
|
||||||
if (backdrop.some(c => c !== 0)) {
|
ctx.globalCompositeOperation = "destination-atop";
|
||||||
ctx.globalCompositeOperation = "destination-atop";
|
ctx.fillStyle = backdropRGB;
|
||||||
ctx.fillStyle = Util.makeHexColor(...backdrop);
|
ctx.fillRect(0, 0, width, height);
|
||||||
ctx.fillRect(0, 0, width, height);
|
ctx.globalCompositeOperation = "source-over";
|
||||||
ctx.globalCompositeOperation = "source-over";
|
|
||||||
}
|
|
||||||
|
|
||||||
maskCanvas = canvas.canvas;
|
maskCanvas = canvas.canvas;
|
||||||
maskX = maskY = 0;
|
maskX = maskY = 0;
|
||||||
} else if (backdrop.some(c => c !== 0)) {
|
} else {
|
||||||
maskCtx.save();
|
maskCtx.save();
|
||||||
maskCtx.globalAlpha = 1;
|
maskCtx.globalAlpha = 1;
|
||||||
maskCtx.setTransform(1, 0, 0, 1, 0, 0);
|
maskCtx.setTransform(1, 0, 0, 1, 0, 0);
|
||||||
@ -1528,7 +1527,7 @@ class CanvasGraphics {
|
|||||||
clip.rect(maskX, maskY, width, height);
|
clip.rect(maskX, maskY, width, height);
|
||||||
maskCtx.clip(clip);
|
maskCtx.clip(clip);
|
||||||
maskCtx.globalCompositeOperation = "destination-atop";
|
maskCtx.globalCompositeOperation = "destination-atop";
|
||||||
maskCtx.fillStyle = Util.makeHexColor(...backdrop);
|
maskCtx.fillStyle = backdropRGB;
|
||||||
maskCtx.fillRect(maskX, maskY, width, height);
|
maskCtx.fillRect(maskX, maskY, width, height);
|
||||||
maskCtx.restore();
|
maskCtx.restore();
|
||||||
}
|
}
|
||||||
|
|||||||
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -679,3 +679,4 @@
|
|||||||
!issue18036.pdf
|
!issue18036.pdf
|
||||||
!issue18894.pdf
|
!issue18894.pdf
|
||||||
!bug1922766.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",
|
"type": "eq",
|
||||||
"link": true,
|
"link": true,
|
||||||
"talos": false
|
"talos": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "issue18956",
|
||||||
|
"file": "pdfs/issue18956.pdf",
|
||||||
|
"md5": "73e8cd32bd063e42fcc4b270c78549b1",
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user