canvas: restore() should reflect that smask groups are finished when stateStack is empty.

This fixes the issue that caused #12363 to get reverted, see #12367.
When we end the SMask group and stateStack.length is zero, nothing updates
this.current to reflect it.
This commit is contained in:
Emilio Cobos Álvarez 2020-09-12 16:16:34 +02:00
parent b058266a7a
commit 3a277f3ba5

View File

@ -1192,7 +1192,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
groupCtx.clearRect(0, 0, groupCtx.canvas.width, groupCtx.canvas.height); groupCtx.clearRect(0, 0, groupCtx.canvas.width, groupCtx.canvas.height);
groupCtx.restore(); groupCtx.restore();
}, },
resumeSMaskGroup: function CanvasGraphics_endSMaskGroup() { resumeSMaskGroup: function CanvasGraphics_resumeSMaskGroup() {
// Resuming state saved by suspendSMaskGroup. We don't need to restore // Resuming state saved by suspendSMaskGroup. We don't need to restore
// any groupCtx state since restore() command (the only caller) will do // any groupCtx state since restore() command (the only caller) will do
// that for us. See also beginSMaskGroup. // that for us. See also beginSMaskGroup.
@ -1254,6 +1254,9 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
this.pendingClip = null; this.pendingClip = null;
this._cachedGetSinglePixelWidth = 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) { transform: function CanvasGraphics_transform(a, b, c, d, e, f) {