mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-07-06 07:25:11 +08:00
Add missing bmp and gif mimetypes
This commit is contained in:
parent
0d9a495fd1
commit
f8a8d9caa0
30
tiny_gltf.h
30
tiny_gltf.h
@ -449,7 +449,7 @@ struct Image {
|
|||||||
int component;
|
int component;
|
||||||
std::vector<unsigned char> image;
|
std::vector<unsigned char> image;
|
||||||
int bufferView; // (required if no uri)
|
int bufferView; // (required if no uri)
|
||||||
std::string mimeType; // (required if no uri) ["image/jpeg", "image/png"]
|
std::string mimeType; // (required if no uri) ["image/jpeg", "image/png", "image/bmp", "image/gif"]
|
||||||
std::string uri; // (reqiored if no mimeType)
|
std::string uri; // (reqiored if no mimeType)
|
||||||
Value extras;
|
Value extras;
|
||||||
|
|
||||||
@ -1224,13 +1224,23 @@ static bool IsDataURI(const std::string &in) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
header = "data:image/jpeg;base64,";
|
||||||
|
if (in.find(header) == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
header = "data:image/png;base64,";
|
header = "data:image/png;base64,";
|
||||||
if (in.find(header) == 0) {
|
if (in.find(header) == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
header = "data:image/jpeg;base64,";
|
header = "data:image/bmp;base64,";
|
||||||
if (in.find(header) == 0) {
|
if(in.find(header) == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
header = "data:image/gif;base64,";
|
||||||
|
if(in.find(header) == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1265,6 +1275,20 @@ static bool DecodeDataURI(std::vector<unsigned char> *out,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.empty()) {
|
||||||
|
header = "data:image/bmp;base64,";
|
||||||
|
if (in.find(header) == 0) {
|
||||||
|
data = base64_decode(in.substr(header.size())); // cut mime string.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.empty()) {
|
||||||
|
header = "data:image/gif;base64,";
|
||||||
|
if (in.find(header) == 0) {
|
||||||
|
data = base64_decode(in.substr(header.size())); // cut mime string.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (data.empty()) {
|
if (data.empty()) {
|
||||||
header = "data:text/plain;base64,";
|
header = "data:text/plain;base64,";
|
||||||
if (in.find(header) == 0) {
|
if (in.find(header) == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user