From 99b07e740ec843175f5c043841318af0b2ecb0c6 Mon Sep 17 00:00:00 2001 From: Derek Schaab Date: Sat, 30 Sep 2017 21:35:29 -0500 Subject: [PATCH] Restore previous state in Context.Pop() Fixes #27. --- context.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/context.go b/context.go index e828af8..ecbe46f 100644 --- a/context.go +++ b/context.go @@ -782,10 +782,9 @@ func (dc *Context) Push() { // Pop restores the last saved context state from the stack. func (dc *Context) Pop() { - before := *dc s := dc.stack - x, s := s[len(s)-1], s[:len(s)-1] - *dc = *x + before, s := s[len(s)-1], s[:len(s)-1] + *dc = *before dc.mask = before.mask dc.strokePath = before.strokePath dc.fillPath = before.fillPath