diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-06-26 02:27:35 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-06-26 02:27:35 +0200 |
commit | b3e120ecb6b363d2e3c58277097e53513e7d011b (patch) | |
tree | ab0905d19eb74b878e04c7a80019833647a1c72a /sys | |
parent | 5165864dbbdb90e41ef25c0576f5b06c990098d8 (diff) |
paint: restore color channel on undo after conversion thru pipe
converting image thru pipe would not properly restore the
original color channel on undo. like |iconv -c k8 would
still be grayscale after undo.
Diffstat (limited to 'sys')
-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); + } } } |