make ReadPNG and ReadJPEG take a filename instead of a FILE

-> read is a bit slower (memory allocation and such) than reading directly from disk.

-> we're not yet ready to accept stdin as input (-- -) because we still need to guess
the file type with GetImageType(). And since we can't rewind on stdin, this will need
a bit more work before being able to read from stdin.

Change-Id: I6491fac4b07d28d1854518325ead88669656ddbf
This commit is contained in:
Pascal Massimino
2015-12-06 09:23:17 +01:00
parent d478e58960
commit 4c60f63c64
5 changed files with 98 additions and 23 deletions

View File

@ -155,9 +155,9 @@ static int ReadPicture(const char* const filename, WebPPicture* const pic,
}
format = GetImageType(in_file);
if (format == PNG_) {
ok = ReadPNG(in_file, pic, keep_alpha, metadata);
ok = ReadPNG(filename, pic, keep_alpha, metadata);
} else if (format == JPEG_) {
ok = ReadJPEG(in_file, pic, metadata);
ok = ReadJPEG(filename, pic, metadata);
} else if (format == TIFF_) {
ok = ReadTIFF(filename, pic, keep_alpha, metadata);
} else if (format == WEBP_) {