diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-08-12 19:28:10 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-08-12 19:28:10 +0200 |
commit | df9597ecde1687ac037101314b477c0f01d3b6a6 (patch) | |
tree | 49ed0ead61d3708e889cfcdfd1ac07716162ef8e /sys/src/cmd/resample.c | |
parent | 1b58ec9279f0740d505ea15074b497295573d135 (diff) |
resample: fix XRGB32 color channel handling
Diffstat (limited to 'sys/src/cmd/resample.c')
-rw-r--r-- | sys/src/cmd/resample.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sys/src/cmd/resample.c b/sys/src/cmd/resample.c index a1487a398..d5aa14de2 100644 --- a/sys/src/cmd/resample.c +++ b/sys/src/cmd/resample.c @@ -133,7 +133,7 @@ max(int a, int b) Memimage* resample(int xsize, int ysize, Memimage *m) { - int i, j, bpl, nchan; + int i, j, d, bpl, nchan; Memimage *new; uchar **oscan, **nscan; @@ -166,13 +166,12 @@ resample(int xsize, int ysize, Memimage *m) } /* resample in X */ - nchan = m->depth/8; + nchan = d = m->depth/8; + if(m->chan == XRGB32) + nchan--; for(i=0; i<Dy(m->r); i++){ - for(j=0; j<nchan; j++){ - if(j==0 && m->chan==XRGB32) - continue; - resamplex(oscan[i], j, nchan, Dx(m->r), nscan[i], xsize); - } + for(j=0; j<nchan; j++) + resamplex(oscan[i], j, d, Dx(m->r), nscan[i], xsize); free(oscan[i]); oscan[i] = nscan[i]; nscan[i] = malloc(bpl); @@ -183,7 +182,7 @@ resample(int xsize, int ysize, Memimage *m) /* resample in Y */ for(i=0; i<xsize; i++) for(j=0; j<nchan; j++) - resampley(oscan, nchan*i+j, Dy(m->r), nscan, ysize); + resampley(oscan, d*i+j, Dy(m->r), nscan, ysize); /* pack data into destination */ bpl = bytesperline(new->r, m->depth); |