rulimine/common/stb_image.patch

65 lines
1.6 KiB
Diff

--- common/stb/stb_image.h 2023-02-18 09:34:39.771655260 +0100
+++ common/stb/stb_image.h 2023-02-18 09:35:26.014990183 +0100
@@ -127,6 +127,28 @@
#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)
+
+#define STBI_MALLOC(x) ext_mem_alloc(x)
+#define STBI_REALLOC(x, y) ({ \
+ void *STBI_REALLOC_new_buf = ext_mem_alloc(y); \
+ memcpy(STBI_REALLOC_new_buf, x, y); \
+ STBI_REALLOC_new_buf; \
+})
+#define STBI_FREE(x)
+
+#define STBI_NO_THREAD_LOCALS
+#define STBI_NO_STDIO
+#define STBI_NO_SIMD
+#define STBI_NO_LINEAR
+
+#define STBI_ONLY_ZLIB
+#define STBI_SUPPORT_ZLIB
+
// DOCUMENTATION
//
// Limitations:
@@ -381,7 +403,7 @@
STBI_rgb_alpha = 4
};
-#include <stdlib.h>
+// #include <stdlib.h>
typedef unsigned char stbi_uc;
typedef unsigned short stbi_us;
@@ -584,8 +606,8 @@
#include <stdarg.h>
#include <stddef.h> // ptrdiff_t on osx
-#include <stdlib.h>
-#include <string.h>
+// #include <stdlib.h>
+// #include <string.h>
#include <limits.h>
#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR)
@@ -1574,10 +1596,12 @@
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; }
+*/
//////////////////////////////////////////////////////////////////////////////