From f4ac890a3ce8c20ce523822bb50baaddbf37ca3a Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 20 Sep 2018 22:14:48 +0200 Subject: [PATCH] arc and preload fixes --- lv_objx/lv_arc.c | 12 ++++++++++-- lv_objx/lv_img.c | 2 +- lv_objx/lv_preload.c | 11 ++++++++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/lv_objx/lv_arc.c b/lv_objx/lv_arc.c index 257bb35292..779163ecff 100644 --- a/lv_objx/lv_arc.c +++ b/lv_objx/lv_arc.c @@ -12,6 +12,7 @@ #include "../lv_misc/lv_math.h" #include "../lv_draw/lv_draw_arc.h" +#include "../lv_themes/lv_theme.h" /********************* @@ -76,7 +77,14 @@ lv_obj_t * lv_arc_create(lv_obj_t * par, const lv_obj_t * copy) /*Init the new arc arc*/ if(copy == NULL) { - lv_arc_set_style(new_arc, LV_ARC_STYLE_MAIN, &lv_style_plain_color); + /*Set the default styles*/ + lv_theme_t * th = lv_theme_get_current(); + if(th) { + lv_arc_set_style(new_arc, LV_ARC_STYLE_MAIN, th->preload); + } else { + lv_arc_set_style(new_arc, LV_ARC_STYLE_MAIN, &lv_style_plain_color); + } + } /*Copy an existing arc*/ else { @@ -237,7 +245,7 @@ static bool lv_arc_design(lv_obj_t * arc, const lv_area_t * mask, lv_design_mode lv_style_t cir_style; lv_style_copy(&cir_style, style); cir_style.body.empty = 0; - cir_style.body.grad_color = style->body.main_color; + cir_style.body.grad_color = style->line.color; lv_area_t cir_area; cir_area.x1 = cir_x + x - thick_2; cir_area.y1 = cir_y + y - thick_2; diff --git a/lv_objx/lv_img.c b/lv_objx/lv_img.c index 23dd1db53c..94503addbf 100644 --- a/lv_objx/lv_img.c +++ b/lv_objx/lv_img.c @@ -88,7 +88,7 @@ lv_obj_t * lv_img_create(lv_obj_t * par, const lv_obj_t * copy) * and must be screen sized*/ if(par != NULL) { ext->auto_size = 1; - lv_obj_set_style(new_img, NULL); /*Inherit the style by default*/ + lv_obj_set_style(new_img, &lv_style_plain); /*Inherit the style by default*/ } else { ext->auto_size = 0; lv_obj_set_style(new_img, &lv_style_plain); /*Set a style for screens*/ diff --git a/lv_objx/lv_preload.c b/lv_objx/lv_preload.c index 91100f9445..51d5d83ae2 100644 --- a/lv_objx/lv_preload.c +++ b/lv_objx/lv_preload.c @@ -12,6 +12,7 @@ #include "../lv_misc/lv_math.h" #include "../lv_draw/lv_draw_rect.h" #include "../lv_draw/lv_draw_arc.h" +#include "../lv_themes/lv_theme.h" /********************* * DEFINES @@ -95,8 +96,16 @@ lv_obj_t * lv_preload_create(lv_obj_t * par, const lv_obj_t * copy) /*Init the new pre loader pre loader*/ if(copy == NULL) { - lv_obj_set_style(new_preload, &lv_style_pretty_color); lv_obj_set_size(new_preload, LV_DPI / 2, LV_DPI / 2); + + /*Set the default styles*/ + lv_theme_t * th = lv_theme_get_current(); + if(th) { + lv_preload_set_style(new_preload, LV_PRELOAD_STYLE_MAIN, th->preload); + } else { + lv_obj_set_style(new_preload, &lv_style_pretty_color); + } + } /*Copy an existing pre loader*/ else {