2023-03-05 21:01:31 +03:00
|
|
|
--- common/stb/stb_image.h 2023-03-05 18:57:03.930649341 +0100
|
|
|
|
+++ common/stb/stb_image.h 2023-03-05 18:55:53.767318782 +0100
|
2023-05-03 20:36:47 +03:00
|
|
|
@@ -127,6 +127,54 @@
|
2023-02-15 13:19:00 +03:00
|
|
|
#ifndef STBI_INCLUDE_STB_IMAGE_H
|
|
|
|
#define STBI_INCLUDE_STB_IMAGE_H
|
|
|
|
|
|
|
|
+#include <stddef.h>
|
|
|
|
+#include <lib/libc.h>
|
|
|
|
+#include <mm/pmm.h>
|
|
|
|
+
|
|
|
|
+#define STBI_ASSERT(x)
|
|
|
|
+
|
2023-03-05 10:29:27 +03:00
|
|
|
+#define STBI_MALLOC(x) ({ \
|
|
|
|
+ size_t STBI_MALLOC_alloc_size = (x); \
|
|
|
|
+ STBI_MALLOC_alloc_size += 16; \
|
|
|
|
+ void *STBI_MALLOC_buf = ext_mem_alloc(STBI_MALLOC_alloc_size); \
|
|
|
|
+ size_t *STBI_MALLOC_alloc_size_ptr = STBI_MALLOC_buf; \
|
|
|
|
+ *STBI_MALLOC_alloc_size_ptr = STBI_MALLOC_alloc_size; \
|
|
|
|
+ STBI_MALLOC_buf + 16; \
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+#define STBI_FREE(x) do { \
|
|
|
|
+ void *STBI_FREE_buf = (x); \
|
2023-03-05 21:01:31 +03:00
|
|
|
+ if (STBI_FREE_buf == NULL) { \
|
|
|
|
+ break; \
|
|
|
|
+ } \
|
2023-03-05 10:29:27 +03:00
|
|
|
+ STBI_FREE_buf -= 16; \
|
|
|
|
+ size_t *STBI_FREE_alloc_size_ptr = STBI_FREE_buf; \
|
|
|
|
+ size_t STBI_FREE_alloc_size = *STBI_FREE_alloc_size_ptr; \
|
|
|
|
+ pmm_free(STBI_FREE_buf, STBI_FREE_alloc_size); \
|
|
|
|
+} while (0)
|
|
|
|
+
|
2023-02-15 13:19:00 +03:00
|
|
|
+#define STBI_REALLOC(x, y) ({ \
|
2023-03-05 10:29:27 +03:00
|
|
|
+ void *STBI_REALLOC_buf = (x); \
|
|
|
|
+ size_t STBI_REALLOC_alloc_size = (y); \
|
|
|
|
+ void *STBI_REALLOC_new_buf = STBI_MALLOC(STBI_REALLOC_alloc_size); \
|
2023-03-05 21:01:31 +03:00
|
|
|
+ if (STBI_REALLOC_buf != NULL) { \
|
|
|
|
+ memcpy(STBI_REALLOC_new_buf, STBI_REALLOC_buf, STBI_REALLOC_alloc_size); \
|
|
|
|
+ STBI_FREE(STBI_REALLOC_buf); \
|
|
|
|
+ } \
|
2023-02-15 13:19:00 +03:00
|
|
|
+ STBI_REALLOC_new_buf; \
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+#define STBI_NO_THREAD_LOCALS
|
|
|
|
+#define STBI_NO_STDIO
|
|
|
|
+#define STBI_NO_SIMD
|
|
|
|
+#define STBI_NO_LINEAR
|
|
|
|
+
|
2023-05-03 20:36:47 +03:00
|
|
|
+#define STBI_ONLY_ZLIB
|
|
|
|
+#define STBI_SUPPORT_ZLIB
|
2023-03-05 09:57:54 +03:00
|
|
|
+#define STBI_ONLY_JPEG
|
|
|
|
+#define STBI_ONLY_PNG
|
|
|
|
+#define STBI_ONLY_BMP
|
2023-02-15 13:19:00 +03:00
|
|
|
+
|
|
|
|
// DOCUMENTATION
|
|
|
|
//
|
|
|
|
// Limitations:
|
2023-03-05 21:01:31 +03:00
|
|
|
@@ -381,7 +429,7 @@
|
2023-02-15 13:19:00 +03:00
|
|
|
STBI_rgb_alpha = 4
|
|
|
|
};
|
|
|
|
|
|
|
|
-#include <stdlib.h>
|
|
|
|
+// #include <stdlib.h>
|
|
|
|
typedef unsigned char stbi_uc;
|
|
|
|
typedef unsigned short stbi_us;
|
|
|
|
|
2023-03-05 21:01:31 +03:00
|
|
|
@@ -584,8 +632,8 @@
|
2023-02-15 13:19:00 +03:00
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stddef.h> // ptrdiff_t on osx
|
|
|
|
-#include <stdlib.h>
|
|
|
|
-#include <string.h>
|
|
|
|
+// #include <stdlib.h>
|
|
|
|
+// #include <string.h>
|
2023-02-18 11:41:30 +03:00
|
|
|
#include <limits.h>
|
2023-02-15 13:19:00 +03:00
|
|
|
|
|
|
|
#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR)
|
2023-03-05 21:01:31 +03:00
|
|
|
@@ -1574,10 +1622,12 @@
|
2023-02-15 13:53:07 +03:00
|
|
|
STBIDEF void stbi_ldr_to_hdr_scale(float scale) { stbi__l2h_scale = scale; }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+/*
|
|
|
|
static float stbi__h2l_gamma_i=1.0f/2.2f, stbi__h2l_scale_i=1.0f;
|
|
|
|
|
|
|
|
STBIDEF void stbi_hdr_to_ldr_gamma(float gamma) { stbi__h2l_gamma_i = 1/gamma; }
|
|
|
|
STBIDEF void stbi_hdr_to_ldr_scale(float scale) { stbi__h2l_scale_i = 1/scale; }
|
|
|
|
+*/
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|