Don't clip when the clip path is empty (issue #12306)
This commit is contained in:
parent
379125c37f
commit
3d74d2c6cb
@ -634,6 +634,10 @@ class CanvasExtraState {
|
||||
this.startNewPathAndClipBox(intersect || [0, 0, 0, 0]);
|
||||
}
|
||||
|
||||
isEmptyClip() {
|
||||
return this.minX === Infinity;
|
||||
}
|
||||
|
||||
startNewPathAndClipBox(box) {
|
||||
this.clipBox = box;
|
||||
this.minX = Infinity;
|
||||
@ -2434,7 +2438,7 @@ class CanvasGraphics {
|
||||
// TODO According to the spec we're also suppose to ignore any operators
|
||||
// that set color or include images while processing this type3 font.
|
||||
this.ctx.rect(llx, lly, urx - llx, ury - lly);
|
||||
this.clip();
|
||||
this.ctx.clip();
|
||||
this.endPath();
|
||||
}
|
||||
|
||||
@ -2820,7 +2824,7 @@ class CanvasGraphics {
|
||||
resetCtxToDefault(this.ctx);
|
||||
|
||||
this.ctx.rect(rect[0], rect[1], width, height);
|
||||
this.clip();
|
||||
this.ctx.clip();
|
||||
this.endPath();
|
||||
}
|
||||
}
|
||||
@ -3170,6 +3174,7 @@ class CanvasGraphics {
|
||||
// Helper functions
|
||||
|
||||
consumePath(clipBox) {
|
||||
const isEmpty = this.current.isEmptyClip();
|
||||
if (this.pendingClip) {
|
||||
this.current.updateClipFromPath();
|
||||
}
|
||||
@ -3178,11 +3183,13 @@ class CanvasGraphics {
|
||||
}
|
||||
const ctx = this.ctx;
|
||||
if (this.pendingClip) {
|
||||
if (!isEmpty) {
|
||||
if (this.pendingClip === EO_CLIP) {
|
||||
ctx.clip("evenodd");
|
||||
} else {
|
||||
ctx.clip();
|
||||
}
|
||||
}
|
||||
this.pendingClip = null;
|
||||
}
|
||||
this.current.startNewPathAndClipBox(this.current.clipBox);
|
||||
|
1
test/pdfs/issue12306.pdf.link
Normal file
1
test/pdfs/issue12306.pdf.link
Normal file
@ -0,0 +1 @@
|
||||
https://github.com/mozilla/pdf.js/files/5150027/document13-08-2020-122237.pdf
|
@ -6362,5 +6362,13 @@
|
||||
"link": true,
|
||||
"lastPage": 1,
|
||||
"type": "eq"
|
||||
},
|
||||
{ "id": "issue12306",
|
||||
"file": "pdfs/issue12306.pdf",
|
||||
"md5": "7fd05ba56791238b5a60adc6cc0e7a22",
|
||||
"rounds": 1,
|
||||
"link": true,
|
||||
"lastPage": 1,
|
||||
"type": "eq"
|
||||
}
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user