feat: jpeg image rendering, desktop backgrounds, fix memory regression
This commit is contained in:
@@ -21,10 +21,17 @@ static constexpr int PANEL_HEIGHT = 32;
|
||||
struct DesktopSettings {
|
||||
// Background
|
||||
bool bg_gradient; // true = gradient, false = solid
|
||||
bool bg_image; // true = JPEG wallpaper
|
||||
Color bg_solid; // solid background color
|
||||
Color bg_grad_top; // gradient top color
|
||||
Color bg_grad_bottom; // gradient bottom color
|
||||
|
||||
// Wallpaper (valid when bg_image == true)
|
||||
char bg_image_path[128]; // VFS path to current wallpaper
|
||||
uint32_t* bg_wallpaper; // scaled ARGB pixel buffer (screen-sized)
|
||||
int bg_wallpaper_w; // scaled width
|
||||
int bg_wallpaper_h; // scaled height
|
||||
|
||||
// Panel
|
||||
Color panel_color; // panel background color
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user