GUI: Icons and IconsAnimation refactoring. Switch assets to new Icon Api (#566)
* GUI: Icons and IconsAnimation refactoring. Switch assets to new Icon API. * Gui: icon and animation draw now do not accept null pointer * Format Sources * Fix no debug build * Furi: stricter checks in memmgr
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "canvas_i.h"
|
||||
#include "icon_i.h"
|
||||
#include "icon_animation_i.h"
|
||||
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
@@ -175,23 +176,35 @@ uint16_t canvas_string_width(Canvas* canvas, const char* str) {
|
||||
return u8g2_GetStrWidth(&canvas->fb, str);
|
||||
}
|
||||
|
||||
void canvas_draw_icon(Canvas* canvas, uint8_t x, uint8_t y, Icon* icon) {
|
||||
void canvas_draw_icon_animation(
|
||||
Canvas* canvas,
|
||||
uint8_t x,
|
||||
uint8_t y,
|
||||
IconAnimation* icon_animation) {
|
||||
furi_assert(canvas);
|
||||
if(!icon) return;
|
||||
furi_assert(icon_animation);
|
||||
|
||||
x += canvas->offset_x;
|
||||
y += canvas->offset_y;
|
||||
u8g2_DrawXBM(
|
||||
&canvas->fb,
|
||||
x,
|
||||
y,
|
||||
icon_animation_get_width(icon_animation),
|
||||
icon_animation_get_height(icon_animation),
|
||||
icon_animation_get_data(icon_animation));
|
||||
}
|
||||
|
||||
void canvas_draw_icon(Canvas* canvas, uint8_t x, uint8_t y, const Icon* icon) {
|
||||
furi_assert(canvas);
|
||||
furi_assert(icon);
|
||||
|
||||
x += canvas->offset_x;
|
||||
y += canvas->offset_y;
|
||||
u8g2_DrawXBM(
|
||||
&canvas->fb, x, y, icon_get_width(icon), icon_get_height(icon), icon_get_data(icon));
|
||||
}
|
||||
|
||||
void canvas_draw_icon_name(Canvas* canvas, uint8_t x, uint8_t y, IconName name) {
|
||||
furi_assert(canvas);
|
||||
const IconData* data = assets_icons_get_data(name);
|
||||
x += canvas->offset_x;
|
||||
y += canvas->offset_y;
|
||||
u8g2_DrawXBM(&canvas->fb, x, y, data->width, data->height, data->frames[0]);
|
||||
}
|
||||
|
||||
void canvas_draw_dot(Canvas* canvas, uint8_t x, uint8_t y) {
|
||||
furi_assert(canvas);
|
||||
x += canvas->offset_x;
|
||||
|
Reference in New Issue
Block a user