ref: 6bcc1eb399d794facd5b2a8678e5b9fc21bd7ea0
parent: a3f776a13e8c38df9cec041bae4cbdab6fab8e8d
author: cinap_lenrek <[email protected]>
date: Mon May 13 19:03:23 EDT 2013
writeppm: simplify
--- a/sys/src/cmd/jpg/writeppm.c
+++ b/sys/src/cmd/jpg/writeppm.c
@@ -90,14 +90,17 @@
pix = (data[i]>>depth*((xmask-x)&xmask))&pmask;
if(((x+1)&xmask) == 0)
i++;
- if(chan == GREY1)
- pix = pix == 1? 0: 1;
- if(rflag){
- if(chan == GREY1)
+ if(chan == GREY1){
+ pix ^= 1;
+ if(rflag){
Bputbit(fd, pix);
- else
+ continue;
+ }
+ } else {
+ if(rflag){
Bputc(fd, pix);
- continue;
+ continue;
+ }
}
col += Bprint(fd, "%d", pix);
if(col >= MAXLINE-(2+1)){