mirror of
https://gitlab.com/Theopse/fbi-i18n-zh.git
synced 2025-04-06 03:58:02 +08:00
Switch to stb_image.
This commit is contained in:
parent
961b0263fa
commit
167dc5a1a1
6167
source/lodepng.c
6167
source/lodepng.c
File diff suppressed because it is too large
Load Diff
1713
source/lodepng.h
1713
source/lodepng.h
File diff suppressed because it is too large
Load Diff
@ -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
2
source/stb_image.c
Normal file
@ -0,0 +1,2 @@
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include "stb_image.h"
|
6615
source/stb_image.h
Normal file
6615
source/stb_image.h
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user