Skip to content

Commit 0b65ce8

Browse files
committed
Fix canvas state getting out of sync from smasks. (bug 1755507)
When ending an smask from restore, we first called restore on the context which would update the current context and the suspended context. However, we then called checkSMaskState which copies the current context state to the suspended context. This caused us to overwrite the restored values. Instead, restore the context after we end the smask. Fixes #11328 and bug 1755507
1 parent f8b2a99 commit 0b65ce8

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

src/display/canvas.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1602,8 +1602,8 @@ class CanvasGraphics {
16021602

16031603
if (this.stateStack.length !== 0) {
16041604
this.current = this.stateStack.pop();
1605-
this.ctx.restore();
16061605
this.checkSMaskState();
1606+
this.ctx.restore();
16071607

16081608
// Ensure that the clipping path is reset (fixes issue6413.pdf).
16091609
this.pendingClip = null;

test/pdfs/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
!issue7901.pdf
6868
!issue8061.pdf
6969
!bug1721218_reduced.pdf
70+
!bug1755507_page1_reduced.pdf
7071
!issue8088.pdf
7172
!issue8125.pdf
7273
!issue8229.pdf
487 KB
Binary file not shown.

test/test_manifest.json

+6
Original file line numberDiff line numberDiff line change
@@ -3685,6 +3685,12 @@
36853685
"rounds": 1,
36863686
"type": "eq"
36873687
},
3688+
{ "id": "bug1755507_page1_reduced",
3689+
"file": "pdfs/bug1755507_page1_reduced.pdf",
3690+
"md5": "319d73b8fd680cdc583d69b7f7ab29e9",
3691+
"rounds": 1,
3692+
"type": "eq"
3693+
},
36883694
{ "id": "issue4244",
36893695
"file": "pdfs/issue4244.pdf",
36903696
"md5": "26845274a32a537182ced1fd693a38b2",

0 commit comments

Comments
 (0)