intense desloppification, performance improvements, openmp ready, add audio, refactor everything, fix warnings and bad practices

This commit is contained in:
maksw committed 2026-02-24 10:41:40 +01:00
1 parent 0c24781c81
commit a12c9a3e8f
15 files changed
+1615 -700

No files matched your search

+7 -4
View File
@@ -9,6 +9,9 @@
#include <cstdint>
#include <image.h>
#define STR2(x) #x
#define STR(x) STR2(x)
extern "C" {
uint32_t* image_load(const char* filename, int* width, int* height) {
int n;
@@ -18,7 +21,7 @@ uint32_t* image_load(const char* filename, int* width, int* height) {
// Convert RGBA to ARGB
uint32_t* out = (uint32_t*)malloc(*width * *height * sizeof(uint32_t));
if (!out) {
fprintf(stderr, "image.cpp 19: malloc failed!");
stbi_image_free(data);
return nullptr;
}
for (int i = 0; i < *width * *height; ++i) {
@@ -40,7 +43,7 @@ uint32_t* image_load_resized(const char* filename, int desired_width, int desire
// Allocate buffer for resized image
unsigned char* resized = (unsigned char*)malloc(desired_width * desired_height * 4);
if (!resized) {
fprintf(stderr, "image.cpp 43: malloc failed!");
stbi_image_free(data);
return nullptr;
}
@@ -54,7 +57,6 @@ uint32_t* image_load_resized(const char* filename, int desired_width, int desire
// Convert RGBA to ARGB
uint32_t* out = (uint32_t*)malloc(desired_width * desired_height * sizeof(uint32_t));
if (!out) {
fprintf(stderr, "image.cpp 55: malloc failed!");
free(resized);
return nullptr;
}
@@ -72,4 +74,5 @@ uint32_t* image_load_resized(const char* filename, int desired_width, int desire
void image_free(uint32_t* data) {
free(data);
}
}
} // extern "C"