1
0
Fork 0
This commit is contained in:
Henrik Hautakoski 2020-10-21 12:59:55 +02:00
parent 58513d70c0
commit 0c6105e418
7 changed files with 168 additions and 2 deletions

View file

@ -5,6 +5,8 @@
#include <Spectre/Graphics/Image.h>
#include "ImageLoader.h"
#include "Image/IcoFormat.h"
// Disable some file formats that we don't use.
#define STBI_NO_PSD
#define STBI_NO_PIC
@ -50,6 +52,11 @@ bool ImageLoader::loadFromMemory(const void *data, unsigned size, Image& img)
int w, h, n_comp;
const stbi_uc *ptr = (const stbi_uc *) data;
if (ptr[0] == 0x0) {
image::IcoFormat ico;
return ico.decode(img, ptr, size);
}
unsigned char *pixels = stbi_load_from_memory(ptr, size, &w, &h, &n_comp, 4);
if (pixels) {