--- ray/src/px/mt160r.c 1990/01/26 08:17:31 1.6 +++ ray/src/px/mt160r.c 1991/11/12 16:04:57 2.1 @@ -1,4 +1,4 @@ -/* Copyright (c) 1986 Regents of the University of California */ +/* Copyright (c) 1991 Regents of the University of California */ #ifndef lint static char SCCSid[] = "$SunId$ LBL"; @@ -13,6 +13,7 @@ static char SCCSid[] = "$SunId$ LBL"; #include #include "color.h" +#include "resolu.h" #define NCOLS 880 /* for wide carriage */ @@ -49,9 +50,12 @@ char *fname; return(-1); } /* discard header */ - getheader(input, NULL); + if (checkheader(input, COLRFMT, NULL) < 0) { + fprintf(stderr, "%s: not a Radiance picture\n", fname); + return(-1); + } /* get picture dimensions */ - if (fgetresolu(&xres, &yres, input) != (YMAJOR|YDECR)) { + if (fgetresolu(&xres, &yres, input) < 0) { fprintf(stderr, "%s: bad picture size\n", fname); return(-1); } @@ -115,14 +119,16 @@ COLR clr; register int x; { static int cerr[NCOLS]; - static int err; + static int err, errp; int b; register int isblack; b = normbright(clr); + errp = err; err += b + cerr[x]; isblack = err < 128; if (!isblack) err -= 256; - cerr[x] = err /= 2; + err /= 3; + cerr[x] = err + errp; return(isblack); }