From 3e4caf2e13be802797f3a6a180f16102914d5060 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 13 Nov 2022 16:15:30 +0100 Subject: [PATCH] Take the mask-offset into account when rendering repeated image masks (bug 1799927) *Please note:* As usual when I'm working with the `src/display/canvas.js` code I don't really know what I'm doing, but it at least *appears* to work. --- src/display/canvas.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/display/canvas.js b/src/display/canvas.js index 278be8388..61db15ef1 100644 --- a/src/display/canvas.js +++ b/src/display/canvas.js @@ -2902,7 +2902,14 @@ class CanvasGraphics { ctx.transform(scaleX, skewX, skewY, scaleY, 0, 0); const mask = this._createMaskCanvas(img); - ctx.setTransform(1, 0, 0, 1, 0, 0); + ctx.setTransform( + 1, + 0, + 0, + 1, + mask.offsetX - currentTransform[4], + mask.offsetY - currentTransform[5] + ); for (let i = 0, ii = positions.length; i < ii; i += 2) { const trans = Util.transform(currentTransform, [ scaleX,