Fixed 16 bit PNM image support (STR #1847)

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@6006 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2007-12-20 16:32:56 +00:00
parent 5097f4df5b
commit f0ccbbabd8
2 changed files with 20 additions and 11 deletions

View File

@ -5,6 +5,7 @@ CHANGES IN FLTK 1.1.8
STR #1639, STR #1645, STR #1644, STR #1792, STR #1793,
STR #1742, STR #1777, STR #1794, STR #1827, STR #1843,
STR #1796)
- Fixed 16 bit PNM image support (STR #1847)
- Fixed exposure event on zero size windows (STR #1824)
- Fixed overlay offset for OS X Quartz (STR #1729)
- gl_font() support for Xft+X11 (STR #1809)

View File

@ -155,21 +155,29 @@ Fl_PNM_Image::Fl_PNM_Image(const char *name) // I - File to read
}
}
break;
case 5 :
case 6 :
if (maxval < 256) {
fread(ptr, w(), d(), fp);
break;
} else {
for (x = d() * w(); x > 0; x --) {
val = (uchar)getc(fp);
val = (val<<8)|(uchar)getc(fp);
*ptr++ = (255*val)/maxval;
}
}
break;
case 7 : /* XV 3:3:2 thumbnail format */
for (x = w(); x > 0; x --) {
byte = (uchar)getc(fp);
*ptr++ = (uchar)(255 * ((byte >> 5) & 7) / 7);
*ptr++ = (uchar)(255 * ((byte >> 2) & 7) / 7);
*ptr++ = (uchar)(255 * (byte & 3) / 3);
}
break;
for (x = w(); x > 0; x --) {
byte = (uchar)getc(fp);
*ptr++ = (uchar)(255 * ((byte >> 5) & 7) / 7);
*ptr++ = (uchar)(255 * ((byte >> 2) & 7) / 7);
*ptr++ = (uchar)(255 * (byte & 3) / 3);
}
break;
}
}