1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Lookup image-data correctly in paintImageMaskXObjectGroup (issue 14990)

*This fixes a regression from PR 14754.*

We didn't lookup the image-data correctly, with the result that we tried to render some ImageMasks using a string rather than the intended TypedArray. To make matters worse, this code-path was apparently not *properly* covered by existing test-cases.
This commit is contained in:
Jonas Jenwald 2022-06-05 12:12:05 +02:00
parent 193a28431c
commit 59dd4ea2b0
3 changed files with 16 additions and 6 deletions

View file

@ -3132,10 +3132,9 @@ class CanvasGraphics {
const fillColor = this.current.fillColor;
const isPatternFill = this.current.patternFill;
for (let i = 0, ii = images.length; i < ii; i++) {
const image = images[i];
const width = image.width,
height = image.height;
for (const image of images) {
const { data, width, height, transform } = image;
const maskCanvas = this.cachedCanvases.getCanvas(
"maskCanvas",
@ -3146,7 +3145,8 @@ class CanvasGraphics {
const maskCtx = maskCanvas.context;
maskCtx.save();
putBinaryImageMask(maskCtx, image);
const img = this.getObject(data, image);
putBinaryImageMask(maskCtx, img);
maskCtx.globalCompositeOperation = "source-in";
@ -3163,7 +3163,7 @@ class CanvasGraphics {
maskCtx.restore();
ctx.save();
ctx.transform.apply(ctx, image.transform);
ctx.transform.apply(ctx, transform);
ctx.scale(1, -1);
drawImageAtIntegerCoords(
ctx,