writeppm: simplify

This commit is contained in:
cinap_lenrek 2013-05-13 23:03:23 +02:00
parent a3f776a13e
commit 6bcc1eb399

View file

@ -90,14 +90,17 @@ writedata(Biobuf *fd, Image *image, Memimage *memimage, int rflag)
pix = (data[i]>>depth*((xmask-x)&xmask))&pmask; pix = (data[i]>>depth*((xmask-x)&xmask))&pmask;
if(((x+1)&xmask) == 0) if(((x+1)&xmask) == 0)
i++; i++;
if(chan == GREY1) if(chan == GREY1){
pix = pix == 1? 0: 1; pix ^= 1;
if(rflag){ if(rflag){
if(chan == GREY1)
Bputbit(fd, pix); Bputbit(fd, pix);
else continue;
}
} else {
if(rflag){
Bputc(fd, pix); Bputc(fd, pix);
continue; continue;
}
} }
col += Bprint(fd, "%d", pix); col += Bprint(fd, "%d", pix);
if(col >= MAXLINE-(2+1)){ if(col >= MAXLINE-(2+1)){