mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 16:58:36 -07:00
Asset Packs: Optimize icon loader (#164)
* Original pointer can be const * Back to const icons * Missed this one * Simpler string alloc * Single allocation and header struct for static icons * Shared allocation and meta struct for animated icons * Only try to load if dir exists * Restructure momentum lib * Use some internal headers * Swap icons at draw * Properly init and free, no more original in icon struct
This commit is contained in:
@@ -2,11 +2,13 @@
|
||||
#include "icon_i.h" // IWYU pragma: keep
|
||||
|
||||
#include <furi.h>
|
||||
#include <momentum/asset_packs_i.h>
|
||||
|
||||
IconAnimation* icon_animation_alloc(const Icon* icon) {
|
||||
furi_check(icon);
|
||||
|
||||
IconAnimation* instance = malloc(sizeof(IconAnimation));
|
||||
icon = asset_packs_swap_icon(icon);
|
||||
instance->icon = icon;
|
||||
instance->timer =
|
||||
furi_timer_alloc(icon_animation_timer_callback, FuriTimerTypePeriodic, instance);
|
||||
|
||||
Reference in New Issue
Block a user