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 <citro3d.h>
#include "screen.h" #include "screen.h"
#include "lodepng.h" #include "stb_image.h"
#include "util.h" #include "util.h"
#include "default_shbin.h" #include "default_shbin.h"
GX_TRANSFER_FORMAT gpuToGxFormat[13] = { 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); snprintf(realPath, realPathSize, "romfs:/%s", path);
} }
unsigned char* image; int width;
unsigned width; int height;
unsigned height; int depth;
unsigned pngErr = lodepng_decode32_file(&image, &width, &height, realPath); u8* image = stbi_load(realPath, &width, &height, &depth, STBI_rgb_alpha);
if(pngErr != 0) { if(image == NULL || depth != STBI_rgb_alpha) {
util_panic("Failed to load PNG file \"%s\": %u", realPath, pngErr); util_panic("Failed to load PNG file \"%s\".", realPath);
return; 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); 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