update stb lib

This commit is contained in:
Sak32009 2024-08-18 11:05:49 +02:00
parent 31e500f4e3
commit f4d9f23ac6
6 changed files with 12180 additions and 3993 deletions

View File

@ -23,6 +23,7 @@
#define STBI_ONLY_JPEG
#if defined(__WINDOWS__)
#define STBI_WINDOWS_UTF8
#define STBIW_WINDOWS_UTF8
#endif
#include "stb/stb_image.h"
@ -31,7 +32,7 @@
#include "stb/stb_image_write.h"
#define STB_IMAGE_RESIZE_IMPLEMENTATION
#include "stb/stb_image_resize.h"
#include "stb/stb_image_resize2.h"
struct File_Data {
std::string name{};
@ -883,13 +884,13 @@ std::string Local_Storage::load_image_resized(std::string const& image_path, std
PRINT_DEBUG("stbi_load('%s') -> %s", image_path.c_str(), (img == nullptr ? stbi_failure_reason() : "loaded"));
if (img != nullptr) {
std::vector<char> out_resized(resized_img_size);
stbir_resize_uint8(img, width, height, 0, (unsigned char*)&out_resized[0], resolution, resolution, 0, 4);
stbir_resize_uint8_linear(img, width, height, 0, (unsigned char*)&out_resized[0], resolution, resolution, 0, STBIR_RGBA);
resized_image = std::string((char*)&out_resized[0], out_resized.size());
stbi_image_free(img);
}
} else if (image_data.length() > 0) {
std::vector<char> out_resized(resized_img_size);
stbir_resize_uint8((unsigned char*)image_data.c_str(), 184, 184, 0, (unsigned char*)&out_resized[0], resolution, resolution, 0, 4);
stbir_resize_uint8_linear((unsigned char*)image_data.c_str(), 184, 184, 0, (unsigned char*)&out_resized[0], resolution, resolution, 0, STBIR_RGBA);
resized_image = std::string((char*)&out_resized[0], out_resized.size());
}

View File

@ -1,3 +1,9 @@
============================================================================ INFO
https://github.com/nothings/stb
VERSION: https://github.com/nothings/stb/tree/f75e8d1cad7d90d72ef7a4661f1b994ef78b4e31
============================================================================ LICENSE MIT / PUBLIC DOMAIN
This software is available under 2 licenses -- choose whichever you prefer.
------------------------------------------------------------------------------
ALTERNATIVE A - MIT License

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

10572
libs/stb/stb_image_resize2.h Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff