ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/bmpfile.c
(Generate patch)

Comparing ray/src/common/bmpfile.c (file contents):
Revision 2.13 by greg, Fri Mar 18 21:04:05 2005 UTC vs.
Revision 2.14 by greg, Fri Apr 8 17:49:55 2005 UTC

# Line 188 | Line 188 | BMPopenReader(int (*cget)(void *), int (*seek)(uint32,
188          br->hdr->hRes = rdint32(br);            /* horizontal resolution */
189          br->hdr->vRes = rdint32(br);            /* vertical resolution */
190          br->hdr->nColors = rdint32(br);         /* # colors used */
191 +        if (!br->hdr->nColors && br->hdr->bpp <= 8)
192 +                br->hdr->nColors = 1<<br->hdr->bpp;
193          br->hdr->impColors = rdint32(br);       /* # important colors */
194          if (br->hdr->impColors < 0)
195                  goto err;                       /* catch premature EOF */
# Line 257 | Line 259 | BMPisGrayscale(const BMPHeader *hdr)
259                  return -1;
260          if (hdr->bpp > 8)               /* assume they had a reason for it */
261                  return 0;
262 <        for (rgbp = hdr->palette, n = hdr->nColors; n-- > 0; rgbp++)
263 <                if (((rgbp->r != rgbp->g) | (rgbp->g != rgbp->b)))
262 >        for (rgbp = hdr->palette, n = hdr->impColors; n-- > 0; rgbp++)
263 >                if ((rgbp->r != rgbp->g) | (rgbp->g != rgbp->b))
264                          return 0;
265          return 1;                       /* all colors neutral in map */
266   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines