textures: Parse SVG from data stored in buffer

This commit is contained in:
Joel16 2020-09-26 23:24:15 -04:00
parent 9fa1d60d54
commit 4729aa646a
3 changed files with 4 additions and 4 deletions

View File

@ -22,7 +22,7 @@ namespace Textures {
bool LoadImageJPEG(unsigned char **data, SceOff *size, Tex *texture);
bool LoadImagePCX(unsigned char **data, SceOff *size, Tex *texture);
bool LoadImagePNG(unsigned char **data, SceOff *size, Tex *texture);
bool LoadImageSVG(const std::string &path, Tex *texture);
bool LoadImageSVG(unsigned char **data, Tex *texture);
bool LoadImageTIFF(const std::string &path, Tex *texture);
bool LoadImageWEBP(unsigned char **data, SceOff *size, Tex *texture);
void Free(Tex *texture);

View File

@ -382,9 +382,9 @@ namespace Textures {
return ret;
}
bool LoadImageSVG(const std::string &path, Tex *texture) {
bool LoadImageSVG(unsigned char **data, Tex *texture) {
NSVGimage *svg;
svg = nsvgParseFromFile(path.c_str(), "px", 96);
svg = nsvgParse(reinterpret_cast<char *>(*data), "px", 96);
texture->width = svg->width;
texture->height = svg->height;

View File

@ -59,7 +59,7 @@ namespace Windows {
else if (ext == ".PNG")
image_ret = Textures::LoadImagePNG(&data, &size, &item->texture);
else if (ext == ".SVG")
image_ret = Textures::LoadImageSVG(path, &item->texture);
image_ret = Textures::LoadImageSVG(&data, &item->texture);
else if (ext == ".TIFF")
image_ret = Textures::LoadImageTIFF(path, &item->texture);
else if (ext == ".WEBP")