feat: jpeg image rendering, desktop backgrounds, fix memory regression

This commit is contained in:
2026-02-27 19:01:07 +01:00
parent f28b850db2
commit e95089192f
19 changed files with 9019 additions and 29 deletions
+6 -4
View File
@@ -39,13 +39,14 @@ namespace heap_detail {
g_head.next = node;
}
static inline void grow(uint64_t bytes) {
static inline bool grow(uint64_t bytes) {
uint64_t pages = (bytes + 0xFFF) / 0x1000;
if (pages < 4) pages = 4; // grow at least 16 KiB at a time
void* mem = zenith::alloc(pages * 0x1000);
if (mem != nullptr)
insert_free(mem, pages * 0x1000);
if (mem == nullptr) return false;
insert_free(mem, pages * 0x1000);
return true;
}
} // namespace heap_detail
@@ -93,7 +94,8 @@ namespace heap_detail {
}
// No fit — grow and retry
grow(needed);
if (!grow(needed))
return nullptr;
return malloc(size);
}