refactor(snapshot): use draw buffer interface (#5487)

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
Co-authored-by: Benign X <1341398182@qq.com>
This commit is contained in:
Neo Xu
2024-01-30 16:18:54 +08:00
committed by GitHub
parent 396d7ae82b
commit 135ad49dce
5 changed files with 101 additions and 93 deletions

View File

@@ -14,7 +14,7 @@ void test_snapshot_should_not_leak_memory(void)
uint32_t final_available_memory = 0;
lv_mem_monitor_t monitor;
lv_image_dsc_t * snapshots[NUM_SNAPSHOTS] = {NULL};
lv_draw_buf_t * snapshots[NUM_SNAPSHOTS] = {NULL};
lv_mem_monitor(&monitor);
initial_available_memory = monitor.free_size;
@@ -25,7 +25,7 @@ void test_snapshot_should_not_leak_memory(void)
}
for(idx = 0; idx < NUM_SNAPSHOTS; idx++) {
lv_snapshot_free(snapshots[idx]);
lv_draw_buf_destroy(snapshots[idx]);
}
lv_mem_monitor(&monitor);
@@ -40,7 +40,7 @@ void test_snapshot_take_snapshot_immidiately_after_obj_create(void)
lv_obj_set_style_text_font(label, &lv_font_montserrat_28, 0);
lv_label_set_text(label, "Wubba lubba dub dub!");
lv_image_dsc_t * draw_dsc = lv_snapshot_take(label, LV_COLOR_FORMAT_ARGB8888);
lv_draw_buf_t * draw_dsc = lv_snapshot_take(label, LV_COLOR_FORMAT_ARGB8888);
lv_obj_t * img_obj = lv_image_create(lv_screen_active());
lv_image_set_src(img_obj, draw_dsc);