mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Merge pull request #19716 from calixteman/issue16742
Take into account the group bbox
This commit is contained in:
commit
b57da32d70
4 changed files with 209 additions and 1 deletions
|
@ -1380,7 +1380,7 @@ class CanvasGraphics {
|
|||
this.suspendedCtx = this.ctx;
|
||||
this.ctx = scratchCanvas.context;
|
||||
const ctx = this.ctx;
|
||||
ctx.setTransform(...getCurrentTransform(this.suspendedCtx));
|
||||
ctx.setTransform(this.suspendedCtx.getTransform());
|
||||
copyCtxState(this.suspendedCtx, ctx);
|
||||
mirrorContextOperations(ctx, this.suspendedCtx);
|
||||
|
||||
|
@ -2551,6 +2551,17 @@ class CanvasGraphics {
|
|||
groupCtx.translate(-offsetX, -offsetY);
|
||||
groupCtx.transform(...currentTransform);
|
||||
|
||||
// Apply the bbox to the group context.
|
||||
let clip = new Path2D();
|
||||
const [x0, y0, x1, y1] = group.bbox;
|
||||
clip.rect(x0, y0, x1 - x0, y1 - y0);
|
||||
if (group.matrix) {
|
||||
const path = new Path2D();
|
||||
path.addPath(clip, new DOMMatrix(group.matrix));
|
||||
clip = path;
|
||||
}
|
||||
groupCtx.clip(clip);
|
||||
|
||||
if (group.smask) {
|
||||
// Saving state and cached mask to be used in setGState.
|
||||
this.smaskStack.push({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue