From 558b9558d4d90c0dabaa57c9a3fe79f9f5f626d5 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Thu, 18 Oct 2012 20:17:12 +0200 Subject: 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. --- sys/src/cmd/rotate.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'sys/src/cmd/rotate.c') 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); -- cgit v1.2.3