Skip to content

Commit

Permalink
canvas: Properly restore all the remaining items in stateStack in end…
Browse files Browse the repository at this point in the history
…Drawing.

We were correctly finishing the SMask group but not restoring all the extra
transformations applied in stateStack, so if somebody ends up drawing to the
same context after canceling mid-draw we'd get artifacts.

This fixes Mozilla bug 1664178[1].

[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1664178
  • Loading branch information
emilio committed Sep 12, 2020
1 parent 3fa1ce3 commit 04b71f8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/display/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -1009,8 +1009,8 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {

endDrawing: function CanvasGraphics_endDrawing() {
// Finishing all opened operations such as SMask group painting.
if (this.current.activeSMask !== null) {
this.endSMaskGroup();
while (this.stateStack.length || this.current.activeSMask !== null) {
this.restore();
}

this.ctx.restore();
Expand Down

0 comments on commit 04b71f8

Please sign in to comment.