Switch to stb_image.

This commit is contained in:
Steven Smith 2016-04-10 21:19:59 -07:00
parent 961b0263fa
commit 167dc5a1a1
5 changed files with 6626 additions and 7888 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5,8 +5,9 @@
#include <citro3d.h>
#include "screen.h"
#include "lodepng.h"
#include "stb_image.h"
#include "util.h"
#include "default_shbin.h"
GX_TRANSFER_FORMAT gpuToGxFormat[13] = {
@ -309,12 +310,12 @@ void screen_load_texture_file(u32 id, const char* path, bool linearFilter) {
snprintf(realPath, realPathSize, "romfs:/%s", path);
}
unsigned char* image;
unsigned width;
unsigned height;
unsigned pngErr = lodepng_decode32_file(&image, &width, &height, realPath);
if(pngErr != 0) {
util_panic("Failed to load PNG file \"%s\": %u", realPath, pngErr);
int width;
int height;
int depth;
u8* image = stbi_load(realPath, &width, &height, &depth, STBI_rgb_alpha);
if(image == NULL || depth != STBI_rgb_alpha) {
util_panic("Failed to load PNG file \"%s\".", realPath);
return;
}
@ -334,7 +335,7 @@ void screen_load_texture_file(u32 id, const char* path, bool linearFilter) {
}
}
screen_load_texture(id, image, width * height * 4, width, height, GPU_RGBA8, linearFilter);
screen_load_texture(id, image, (u32) (width * height * 4), (u32) width, (u32) height, GPU_RGBA8, linearFilter);
free(image);
}

2
source/stb_image.c Normal file
View File

@ -0,0 +1,2 @@
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"

6615
source/stb_image.h Normal file

File diff suppressed because it is too large Load Diff