summaryrefslogtreecommitdiff
path: root/sys/src/cmd/rotate.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-10-18 20:17:12 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2012-10-18 20:17:12 +0200
commit558b9558d4d90c0dabaa57c9a3fe79f9f5f626d5 (patch)
tree3b654e941df4b0068c537fe47d6e0ff1302876c9 /sys/src/cmd/rotate.c
parent0a3eb7d6b1ef7e9ef569dcc8e73c98a8446b52fc (diff)
more generic way to deal with image chan conversion for resize/resample/rotate
this is to catch crazy color channels like k8a8 and the 15/16 bit ones and CMAP. basically, just convert to RGBA32 or RGB24 depending on if it has an alpha channel.
Diffstat (limited to 'sys/src/cmd/rotate.c')
-rw-r--r--sys/src/cmd/rotate.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/sys/src/cmd/rotate.c b/sys/src/cmd/rotate.c
index 2c8503bda..f595b9826 100644
--- a/sys/src/cmd/rotate.c
+++ b/sys/src/cmd/rotate.c
@@ -10,27 +10,13 @@ rot90(Memimage *m)
ulong chan;
uchar *s, *d;
Memimage *w;
- char buf[12];
- bpp = m->depth/8;
+ bpp = (m->depth+7)/8;
chan = m->chan;
switch(chan){
- default:
- sysfatal("can't handle channel type %s", chantostr(buf, chan));
- case RGB15:
- bpp = 2;
- case CMAP8:
- case GREY8:
- case RGB16:
- case RGB24:
- case RGBA32:
- case ARGB32:
- case XRGB32:
- break;
case GREY1:
case GREY2:
case GREY4:
- bpp = 1;
if((w = allocmemimage(m->r, GREY8)) == nil)
sysfatal("allocmemimage: %r");
memimagedraw(w, w->r, m, m->r.min, nil, ZP, S);