Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

canvas: fix restore() with existing SMask groups and re-land #12363. #12369

Merged
merged 2 commits into from
Sep 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 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 Expand Up @@ -1192,7 +1192,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
groupCtx.clearRect(0, 0, groupCtx.canvas.width, groupCtx.canvas.height);
groupCtx.restore();
},
resumeSMaskGroup: function CanvasGraphics_endSMaskGroup() {
resumeSMaskGroup: function CanvasGraphics_resumeSMaskGroup() {
// Resuming state saved by suspendSMaskGroup. We don't need to restore
// any groupCtx state since restore() command (the only caller) will do
// that for us. See also beginSMaskGroup.
Expand Down Expand Up @@ -1254,6 +1254,9 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
this.pendingClip = null;

this._cachedGetSinglePixelWidth = null;
} else {
// We've finished all the SMask groups, reflect that in our state.
this.current.activeSMask = null;
}
},
transform: function CanvasGraphics_transform(a, b, c, d, e, f) {
Expand Down