Restore previous state in Context.Pop()

Fixes #27.
This commit is contained in:
Derek Schaab 2017-09-30 21:35:29 -05:00
parent e611489b86
commit 99b07e740e

View File

@ -782,10 +782,9 @@ func (dc *Context) Push() {
// Pop restores the last saved context state from the stack. // Pop restores the last saved context state from the stack.
func (dc *Context) Pop() { func (dc *Context) Pop() {
before := *dc
s := dc.stack s := dc.stack
x, s := s[len(s)-1], s[:len(s)-1] before, s := s[len(s)-1], s[:len(s)-1]
*dc = *x *dc = *before
dc.mask = before.mask dc.mask = before.mask
dc.strokePath = before.strokePath dc.strokePath = before.strokePath
dc.fillPath = before.fillPath dc.fillPath = before.fillPath