diff options
| -rw-r--r-- | sys/src/cmd/paint.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/src/cmd/paint.c b/sys/src/cmd/paint.c index dafb29fa4..31996c3f1 100644 --- a/sys/src/cmd/paint.c +++ b/sys/src/cmd/paint.c @@ -259,10 +259,16 @@ restore(int n) if((tmp = undo[x]) == nil) return; undo[x] = nil; - expand(tmp->r); - draw(canvas, tmp->r, tmp, nil, tmp->r.min); - update(&tmp->r); - freeimage(tmp); + if(canvas != nil && canvas->chan != tmp->chan){ + freeimage(canvas); + canvas = tmp; + update(nil); + } else { + expand(tmp->r); + draw(canvas, tmp->r, tmp, nil, tmp->r.min); + update(&tmp->r); + freeimage(tmp); + } } } |
