Improve JPEG file detection (mainly for background image use)

This commit is contained in:
Henrik Rydgård committed 2020-08-18 15:31:16 +02:00
1 parent b4efca9480
commit 60801e066f
2 files changed
+7 -4

No files matched your search

+4 -1
View File
@@ -25,13 +25,16 @@ static Draw::DataFormat ZimToT3DFormat(int zim) {
}
static ImageFileType DetectImageFileType(const uint8_t *data, size_t size) {
if (size < 4) {
return TYPE_UNKNOWN;
}
if (!memcmp(data, "ZIMG", 4)) {
return ZIM;
}
else if (!memcmp(data, "\x89\x50\x4E\x47", 4)) {
return PNG;
}
else if (!memcmp(data, "\xff\xd8\xff\xe0", 4)) {
else if (!memcmp(data, "\xff\xd8\xff\xe0", 4) || !memcmp(data, "\xff\xd8\xff\xe1", 4)) {
return JPEG;
}
else {