ref: b3e120ecb6b363d2e3c58277097e53513e7d011b
parent: 5165864dbbdb90e41ef25c0576f5b06c990098d8
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Tue Jun 25 22:27:35 EDT 2013
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.
--- a/sys/src/cmd/paint.c
+++ b/sys/src/cmd/paint.c
@@ -259,10 +259,16 @@
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);
+ }
}
}
--
⑨