limine/common/stb_image.patch

68 lines
1.6 KiB
Diff
Raw Normal View History

2023-03-05 09:57:54 +03:00
--- common/stb/stb_image.h 2023-03-05 06:32:45.628671768 +0100
+++ common/stb/stb_image.h 2023-03-05 07:47:29.931051098 +0100
@@ -127,6 +127,31 @@
#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
2023-03-05 09:57:54 +03:00
+#define STBI_ONLY_JPEG
+#define STBI_ONLY_PNG
+#define STBI_ONLY_BMP
+
// DOCUMENTATION
//
// Limitations:
2023-03-05 09:57:54 +03:00
@@ -381,7 +406,7 @@
STBI_rgb_alpha = 4
};
-#include <stdlib.h>
+// #include <stdlib.h>
typedef unsigned char stbi_uc;
typedef unsigned short stbi_us;
2023-03-05 09:57:54 +03:00
@@ -584,8 +609,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)
2023-03-05 09:57:54 +03:00
@@ -1574,10 +1599,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; }
+*/
//////////////////////////////////////////////////////////////////////////////