resample: fix XRGB32 color channel handling
This commit is contained in:
parent
1b58ec9279
commit
df9597ecde
1 changed files with 7 additions and 8 deletions
|
@ -133,7 +133,7 @@ max(int a, int b)
|
||||||
Memimage*
|
Memimage*
|
||||||
resample(int xsize, int ysize, Memimage *m)
|
resample(int xsize, int ysize, Memimage *m)
|
||||||
{
|
{
|
||||||
int i, j, bpl, nchan;
|
int i, j, d, bpl, nchan;
|
||||||
Memimage *new;
|
Memimage *new;
|
||||||
uchar **oscan, **nscan;
|
uchar **oscan, **nscan;
|
||||||
|
|
||||||
|
@ -166,13 +166,12 @@ resample(int xsize, int ysize, Memimage *m)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* resample in X */
|
/* 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(i=0; i<Dy(m->r); i++){
|
||||||
for(j=0; j<nchan; j++){
|
for(j=0; j<nchan; j++)
|
||||||
if(j==0 && m->chan==XRGB32)
|
resamplex(oscan[i], j, d, Dx(m->r), nscan[i], xsize);
|
||||||
continue;
|
|
||||||
resamplex(oscan[i], j, nchan, Dx(m->r), nscan[i], xsize);
|
|
||||||
}
|
|
||||||
free(oscan[i]);
|
free(oscan[i]);
|
||||||
oscan[i] = nscan[i];
|
oscan[i] = nscan[i];
|
||||||
nscan[i] = malloc(bpl);
|
nscan[i] = malloc(bpl);
|
||||||
|
@ -183,7 +182,7 @@ resample(int xsize, int ysize, Memimage *m)
|
||||||
/* resample in Y */
|
/* resample in Y */
|
||||||
for(i=0; i<xsize; i++)
|
for(i=0; i<xsize; i++)
|
||||||
for(j=0; j<nchan; j++)
|
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 */
|
/* pack data into destination */
|
||||||
bpl = bytesperline(new->r, m->depth);
|
bpl = bytesperline(new->r, m->depth);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue