diff --git a/lv_conf_templ.h b/lv_conf_templ.h index 9f052c9f5..3729ab8ef 100644 --- a/lv_conf_templ.h +++ b/lv_conf_templ.h @@ -28,7 +28,7 @@ /* Horizontal and vertical resolution of the library. * Screen resolution multiplied by LV_DOWN_SCALE*/ -#define LV_DPI (100 << LV_ANTIALIAS) +#define LV_DPI 100 /* Buffered rendering: >= lv_disp_hor_res() or 0 to disable buffering*/ #define LV_VDB_SIZE (40 * lv_disp_hor_res()) @@ -59,7 +59,7 @@ /*Input device settings*/ #define LV_INDEV_READ_PERIOD 50 /*Input device read period in milliseconds*/ #define LV_INDEV_POINT_MARKER 0 /*Mark the pressed points*/ -#define LV_INDEV_DRAG_LIMIT (10 << LV_ANTIALIAS) /*Drag threshold in pixels */ +#define LV_INDEV_DRAG_LIMIT 10 /*Drag threshold in pixels */ #define LV_INDEV_DRAG_THROW 20 /*Drag throw slow-down in [%]. Greater value means faster slow-down */ #define LV_INDEV_LONG_PRESS_TIME 400 /*Long press time in milliseconds*/ #define LV_INDEV_LONG_PRESS_REP_TIME 100 /*Repeated trigger period in long press [ms] */ @@ -152,7 +152,7 @@ *==================*/ #define LV_OBJ_FREE_NUM_TYPE uint32_t /*Type of free number attribute (comment out disable free number)*/ #define LV_OBJ_FREE_PTR 1 /*Enable the free pointer attribute*/ -#define LV_OBJ_GROUP 1 /*Enable object groups (for keyboards)*/ +#define USE_LV_GROUP 1 /*Enable object groups (for keyboards)*/ /*================== * LV OBJ X USAGE @@ -165,7 +165,7 @@ /*Label (dependencies: -*/ #define USE_LV_LABEL 1 #if USE_LV_LABEL != 0 -#define LV_LABEL_SCROLL_SPEED (25 << LV_ANTIALIAS) /*Hor, or ver. scroll speed (px/sec) in 'LV_LABEL_LONG_SCROLL/ROLL' mode*/ +#define LV_LABEL_SCROLL_SPEED 25 /*Hor, or ver. scroll speed (px/sec) in 'LV_LABEL_LONG_SCROLL/ROLL' mode*/ #endif /*Image (dependencies: lv_label (if symbols are enabled) from misc: FSINT, UFS)*/ diff --git a/lv_core/lv_group.c b/lv_core/lv_group.c index 4c2036172..eecd0f764 100644 --- a/lv_core/lv_group.c +++ b/lv_core/lv_group.c @@ -7,7 +7,7 @@ * INCLUDES *********************/ #include "lv_group.h" -#if LV_OBJ_GROUP != 0 +#if USE_LV_GROUP != 0 #include /********************* @@ -267,4 +267,4 @@ static void style_mod_def(lv_style_t * style) style->text.color = lv_color_mix(style->text.color, LV_COLOR_ORANGE, LV_OPA_70); } -#endif /*LV_OBJ_GROUP != 0*/ +#endif /*USE_LV_GROUP != 0*/ diff --git a/lv_core/lv_group.h b/lv_core/lv_group.h index 98179754b..d217d0517 100644 --- a/lv_core/lv_group.h +++ b/lv_core/lv_group.h @@ -30,7 +30,7 @@ extern "C" { #define LV_GROUP_KEY_NEXT 9 /*0x09, '\t'*/ #define LV_GROUP_KEY_PREV 11 /*0x0B, '*/ -#if LV_OBJ_GROUP != 0 +#if USE_LV_GROUP != 0 /********************** * TYPEDEFS **********************/ @@ -125,7 +125,7 @@ lv_obj_t * lv_group_get_focused(lv_group_t * group); * MACROS **********************/ -#endif /*LV_OBJ_GROUP != 0*/ +#endif /*USE_LV_GROUP != 0*/ #ifdef __cplusplus } /* extern "C" */ diff --git a/lv_core/lv_indev.c b/lv_core/lv_indev.c index f072dc433..2515a2a75 100644 --- a/lv_core/lv_indev.c +++ b/lv_core/lv_indev.c @@ -128,7 +128,7 @@ void lv_indev_set_cursor(lv_indev_t *indev, lv_obj_t *cur_obj) lv_obj_set_pos(indev->cursor, indev->proc.act_point.x, indev->proc.act_point.y); } -#if LV_OBJ_GROUP +#if USE_LV_GROUP /** * Set a destination group for a keypad input device * @param indev pointer to an input device (type: 'LV_INDEV_TYPE_KEYPAD') @@ -227,19 +227,19 @@ static void indev_proc_task(void * param) (i->proc.last_point.x != data.point.x || i->proc.last_point.y != data.point.y)) { - lv_obj_set_pos_scale(i->cursor, data.point.x, data.point.y); + lv_obj_set_pos(i->cursor, data.point.x, data.point.y); } if(i->driver.type == LV_INDEV_TYPE_POINTER) { - i->proc.act_point.x = data.point.x << LV_ANTIALIAS; - i->proc.act_point.y = data.point.y << LV_ANTIALIAS; + i->proc.act_point.x = data.point.x; + i->proc.act_point.y = data.point.y;; /*Process the current point*/ indev_proc_point(&i->proc); } else if (i->driver.type == LV_INDEV_TYPE_KEYPAD) { -#if LV_OBJ_GROUP +#if USE_LV_GROUP if(i->group != NULL && data.key != 0 && data.state == LV_INDEV_STATE_PR && i->proc.last_state == LV_INDEV_STATE_REL) { @@ -289,10 +289,10 @@ static void indev_proc_point(lv_indev_proc_t * indev) if(indev->event == LV_INDEV_STATE_PR){ #if LV_INDEV_POINT_MARKER != 0 area_t area; - area.x1 = (indev->act_point.x >> LV_ANTIALIAS) - (LV_INDEV_POINT_MARKER >> 1); - area.y1 = (indev->act_point.y >> LV_ANTIALIAS) - (LV_INDEV_POINT_MARKER >> 1); - area.x2 = (indev->act_point.x >> LV_ANTIALIAS) + ((LV_INDEV_POINT_MARKER >> 1) | 0x1); - area.y2 = (indev->act_point.y >> LV_ANTIALIAS) + ((LV_INDEV_POINT_MARKER >> 1) | 0x1); + area.x1 = indev->act_point.x - (LV_INDEV_POINT_MARKER >> 1); + area.y1 = indev->act_point.y - (LV_INDEV_POINT_MARKER >> 1); + area.x2 = indev->act_point.x + ((LV_INDEV_POINT_MARKER >> 1) | 0x1); + area.y2 = indev->act_point.y + ((LV_INDEV_POINT_MARKER >> 1) | 0x1); lv_rfill(&area, NULL, LV_COLOR_MAKE(0xFF, 0, 0), LV_OPA_COVER); #endif indev_proc_press(indev); diff --git a/lv_core/lv_indev.h b/lv_core/lv_indev.h index 93c9964e8..5539fb2e7 100644 --- a/lv_core/lv_indev.h +++ b/lv_core/lv_indev.h @@ -66,7 +66,7 @@ void lv_indev_enable(lv_hal_indev_type_t type, bool enable); */ void lv_indev_set_cursor(lv_indev_t *indev, lv_obj_t *cur_obj); -#if LV_OBJ_GROUP +#if USE_LV_GROUP /** * Set a destination group for a keypad input device * @param indev pointer to an input device (type: 'LV_INDEV_TYPE_KEYPAD') diff --git a/lv_core/lv_obj.c b/lv_core/lv_obj.c index 7cb7ac006..8dcf36490 100644 --- a/lv_core/lv_obj.c +++ b/lv_core/lv_obj.c @@ -64,16 +64,16 @@ void lv_init(void) /*Initialize the lv_misc modules*/ lv_mem_init(); lv_task_init(); + +#if USE_LV_FILESYSTEM lv_fs_init(); lv_ufs_init(); +#endif + lv_font_init(); -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION lv_anim_init(); #endif - /*Clear the screen*/ - lv_area_t scr_area; - lv_area_set(&scr_area, 0, 0, LV_HOR_RES, LV_VER_RES); - lv_rfill(&scr_area, NULL, LV_COLOR_BLACK, LV_OPA_COVER); /*Init. the sstyles*/ lv_style_init(); @@ -146,7 +146,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy) new_obj->free_ptr = NULL; #endif -#if LV_OBJ_GROUP +#if USE_LV_GROUP new_obj->group_p = NULL; #endif /*Set attributes*/ @@ -191,7 +191,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy) #if LV_OBJ_FREE_PTR != 0 new_obj->free_ptr = NULL; #endif -#if LV_OBJ_GROUP +#if USE_LV_GROUP new_obj->group_p = NULL; #endif @@ -229,7 +229,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy) new_obj->style_p = copy->style_p; -#if LV_OBJ_GROUP +#if USE_LV_GROUP /*Add to the same group*/ if(copy->group_p != NULL) { lv_group_add_obj(copy->group_p, new_obj); @@ -274,7 +274,7 @@ lv_res_t lv_obj_del(lv_obj_t * obj) /*Set i to the next node*/ i = i_next; } -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION /*Remove the animations from this object*/ lv_anim_del(obj, NULL); #endif @@ -905,7 +905,7 @@ void lv_obj_set_free_ptr(lv_obj_t * obj, void * free_p) } #endif -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION /** * Animate an object * @param obj pointer to an object to animate @@ -1204,7 +1204,7 @@ lv_style_t * lv_obj_get_style(lv_obj_t * obj) par = par->par; } } -#if LV_OBJ_GROUP +#if USE_LV_GROUP if(obj->group_p) { if(lv_group_get_focused(obj->group_p) == obj) { style_act = lv_group_mod_style(obj->group_p, style_act); @@ -1361,7 +1361,7 @@ void * lv_obj_get_free_ptr(lv_obj_t * obj) } #endif -#if LV_OBJ_GROUP +#if USE_LV_GROUP /** * Get the group of the object * @param obj pointer to an object @@ -1532,12 +1532,12 @@ static void delete_children(lv_obj_t * obj) } /*Remove the animations from this object*/ -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION lv_anim_del(obj, NULL); #endif /*Delete from the group*/ -#if LV_OBJ_GROUP +#if USE_LV_GROUP if(obj->group_p != NULL) lv_group_remove_obj(obj); #endif diff --git a/lv_core/lv_obj.h b/lv_core/lv_obj.h index 6552ae49d..69fef3c89 100644 --- a/lv_core/lv_obj.h +++ b/lv_core/lv_obj.h @@ -263,18 +263,6 @@ void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent); */ void lv_obj_set_pos(lv_obj_t * obj, lv_coord_t x, lv_coord_t y); -/** - * Set relative the position of an object (relative to the parent). - * The coordinates will be up scaled LV_ANTIALIAS is enabled. - * @param obj pointer to an object - * @param x new distance from the left side of the parent. - * @param y new distance from the top of the parent. - */ -static inline void lv_obj_set_pos_scale(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) -{ - lv_obj_set_pos(obj, x << LV_ANTIALIAS, y << LV_ANTIALIAS); -} - /** * Set the x coordinate of a object * @param obj pointer to an object @@ -282,17 +270,6 @@ static inline void lv_obj_set_pos_scale(lv_obj_t * obj, lv_coord_t x, lv_coord_t */ void lv_obj_set_x(lv_obj_t * obj, lv_coord_t x); -/** - * Set the x coordinate of a object. - * The coordinate will be up scaled LV_ANTIALIAS is enabled. - * @param obj pointer to an object - * @param x new distance from the left side from the parent. - */ -static inline void lv_obj_set_x_scale(lv_obj_t * obj, lv_coord_t x) -{ - lv_obj_set_x(obj, x << LV_ANTIALIAS); -} - /** * Set the y coordinate of a object * @param obj pointer to an object @@ -300,17 +277,6 @@ static inline void lv_obj_set_x_scale(lv_obj_t * obj, lv_coord_t x) */ void lv_obj_set_y(lv_obj_t * obj, lv_coord_t y); -/** - * Set the y coordinate of a object. - * The coordinate will be up scaled LV_ANTIALIAS is enabled. - * @param obj pointer to an object - * @param y new distance from the top of the parent. - */ -static inline void lv_obj_set_y_scale(lv_obj_t * obj, lv_coord_t y) -{ - lv_obj_set_y(obj, y << LV_ANTIALIAS); -} - /** * Set the size of an object * @param obj pointer to an object @@ -319,18 +285,6 @@ static inline void lv_obj_set_y_scale(lv_obj_t * obj, lv_coord_t y) */ void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h); -/** - * Set the size of an object. - * The coordinates will be up scaled LV_ANTIALIAS is enabled. - * @param obj pointer to an object - * @param w new width - * @param h new height - */ -static inline void lv_obj_set_size_scale(lv_obj_t * obj, lv_coord_t w, lv_coord_t h) -{ - lv_obj_set_size(obj, w << LV_ANTIALIAS, h << LV_ANTIALIAS); -} - /** * Set the width of an object * @param obj pointer to an object @@ -338,17 +292,6 @@ static inline void lv_obj_set_size_scale(lv_obj_t * obj, lv_coord_t w, lv_coord_ */ void lv_obj_set_width(lv_obj_t * obj, lv_coord_t w); -/** - * Set the width of an object. - * The coordinates will be up scaled LV_ANTIALIAS is enabled. - * @param obj pointer to an object - * @param w new width - */ -static inline void lv_obj_set_width_scale(lv_obj_t * obj, lv_coord_t w) -{ - lv_obj_set_width(obj, w << LV_ANTIALIAS); -} - /** * Set the height of an object * @param obj pointer to an object @@ -356,17 +299,6 @@ static inline void lv_obj_set_width_scale(lv_obj_t * obj, lv_coord_t w) */ void lv_obj_set_height(lv_obj_t * obj, lv_coord_t h); -/** - * Set the height of an object. - * The coordinate will be up scaled LV_ANTIALIAS is enabled. - * @param obj pointer to an object - * @param h new height - */ -static inline void lv_obj_set_height_scale(lv_obj_t * obj, lv_coord_t h) -{ - lv_obj_set_height(obj, h << LV_ANTIALIAS); -} - /** * Align an object to an other object. * @param obj pointer to an object to align @@ -377,19 +309,6 @@ static inline void lv_obj_set_height_scale(lv_obj_t * obj, lv_coord_t h) */ void lv_obj_align(lv_obj_t * obj,lv_obj_t * base, lv_align_t align, lv_coord_t x_mod, lv_coord_t y_mod); -/** - * Align an object to an other object. - * The coordinates will be up scaled LV_ANTIALIAS is enabled. - * @param obj pointer to an object to align - * @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it. - * @param align type of alignment (see 'lv_align_t' enum) - * @param x_mod x coordinate shift after alignment - * @param y_mod y coordinate shift after alignment - */ -static inline void lv_obj_align_scale(lv_obj_t * obj,lv_obj_t * base, lv_align_t align, lv_coord_t x_mod, lv_coord_t y_mod) -{ - lv_obj_align(obj, base, align, x_mod << LV_ANTIALIAS, y_mod << LV_ANTIALIAS); -} /*--------------------- * Appearance set @@ -530,7 +449,7 @@ void lv_obj_set_free_num(lv_obj_t * obj, LV_OBJ_FREE_NUM_TYPE free_num); void lv_obj_set_free_ptr(lv_obj_t * obj, void * free_p); #endif -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION /** * Animate an object * @param obj pointer to an object to animate @@ -774,7 +693,7 @@ LV_OBJ_FREE_NUM_TYPE lv_obj_get_free_num(lv_obj_t * obj); void * lv_obj_get_free_ptr(lv_obj_t * obj); #endif -#if LV_OBJ_GROUP +#if USE_LV_GROUP /** * Get the group of the object * @param obj pointer to an object diff --git a/lv_core/lv_refr.c b/lv_core/lv_refr.c index 3078a11d1..bdbd92a03 100644 --- a/lv_core/lv_refr.c +++ b/lv_core/lv_refr.c @@ -258,13 +258,13 @@ static void lv_refr_area_no_vdb(const lv_area_t * area_p) static void lv_refr_area_with_vdb(const lv_area_t * area_p) { /*Calculate the max row num*/ - lv_coord_t max_row = (uint32_t) LV_VDB_SIZE / (lv_area_get_width(area_p)); - if(max_row > lv_area_get_height(area_p)) max_row = lv_area_get_height(area_p); - - /*Round the row number with downscale*/ -#if LV_ANTIALIAS == 1 - max_row &= (~0x1); -#endif + lv_coord_t w = lv_area_get_width(area_p); + lv_coord_t h = lv_area_get_height(area_p); + + lv_coord_t max_row = (uint32_t) LV_VDB_SIZE / (w << LV_AA); + if(max_row > (h << LV_AA)) max_row = (h << LV_AA); + + max_row = max_row >> LV_AA ; /*Always use the full row*/ lv_coord_t row; @@ -310,6 +310,13 @@ static void lv_refr_area_part_vdb(const lv_area_t * area_p) lv_area_t start_mask; lv_area_union(&start_mask, area_p, &vdb_p->area); +#if LV_ANTIALIAS + vdb_p->area.x1 = vdb_p->area.x1 << LV_AA; + vdb_p->area.x2 = (vdb_p->area.x2 << LV_AA) + 1; + vdb_p->area.y1 = (vdb_p->area.y1 << LV_AA); + vdb_p->area.y2 = (vdb_p->area.y2 << LV_AA) + 1; +#endif + /*Get the most top object which is not covered by others*/ top_p = lv_refr_get_top_obj(&start_mask, lv_scr_act()); diff --git a/lv_core/lv_style.c b/lv_core/lv_style.c index 9a6605613..a7f9e15bb 100644 --- a/lv_core/lv_style.c +++ b/lv_core/lv_style.c @@ -14,7 +14,7 @@ /********************* * DEFINES *********************/ -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION #define LV_STYLE_ANIM_RES 256 #define LV_STYLE_ANIM_SHIFT 8 /*log2(LV_STYLE_ANIM_RES)*/ @@ -25,7 +25,7 @@ /********************** * TYPEDEFS **********************/ -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION typedef struct { lv_style_t style_start; /*Save not only pointers because can be same as 'style_anim' then it will be modified too*/ lv_style_t style_end; @@ -37,7 +37,7 @@ typedef struct { /********************** * STATIC PROTOTYPES **********************/ -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION static void style_animator(lv_style_anim_dsc_t * dsc, int32_t val); static void style_animation_common_end_cb(void *ptr); #endif @@ -97,8 +97,8 @@ void lv_style_init (void) lv_style_scr.text.opa = LV_OPA_COVER; lv_style_scr.text.color = LV_COLOR_MAKE(0x30, 0x30, 0x30); lv_style_scr.text.font = LV_FONT_DEFAULT; - lv_style_scr.text.letter_space = 1 << LV_ANTIALIAS; - lv_style_scr.text.line_space = 2 << LV_ANTIALIAS; + lv_style_scr.text.letter_space = 2; + lv_style_scr.text.line_space = 2; lv_style_scr.image.opa = LV_OPA_COVER; lv_style_scr.image.color = LV_COLOR_MAKE(0x20, 0x20, 0x20); @@ -106,7 +106,7 @@ void lv_style_init (void) lv_style_scr.line.opa = LV_OPA_COVER; lv_style_scr.line.color = LV_COLOR_MAKE(0x20, 0x20, 0x20); - lv_style_scr.line.width = 1 << LV_ANTIALIAS; + lv_style_scr.line.width = 1; /*Plain style (by default near the same as the screen style)*/ memcpy(&lv_style_plain, &lv_style_scr, sizeof(lv_style_t)); @@ -216,7 +216,7 @@ void lv_style_copy(lv_style_t * dest, const lv_style_t * src) memcpy(dest, src, sizeof(lv_style_t)); } -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION /** * Create an animation from a pre-configured 'lv_style_anim_t' variable * @param anim pointer to a pre-configured 'lv_style_anim_t' variable (will be copied) @@ -251,7 +251,7 @@ void lv_style_anim_create(lv_style_anim_t * anim) /********************** * STATIC FUNCTIONS **********************/ -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION /** * Used by the style animations to set the values of a style according to start and end style. * @param dsc the 'animated variable' set by lv_style_anim_create() diff --git a/lv_core/lv_style.h b/lv_core/lv_style.h index 07997122a..cd1e5d730 100644 --- a/lv_core/lv_style.h +++ b/lv_core/lv_style.h @@ -101,7 +101,7 @@ typedef struct }line; }lv_style_t; -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION typedef struct { const lv_style_t * style_start; /*Pointer to the starting style*/ const lv_style_t * style_end; /*Pointer to the destination style*/ @@ -147,7 +147,7 @@ void lv_style_init (void); */ void lv_style_copy(lv_style_t * dest, const lv_style_t * src); -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION /** * Create an animation from a pre-configured 'lv_style_anim_t' variable * @param anim pointer to a pre-configured 'lv_style_anim_t' variable (will be copied) diff --git a/lv_draw/lv_draw.c b/lv_draw/lv_draw.c index d0ad85990..342d91fd2 100644 --- a/lv_draw/lv_draw.c +++ b/lv_draw/lv_draw.c @@ -45,7 +45,7 @@ static void lv_draw_rect_main_mid(const lv_area_t * coords, const lv_area_t * ma static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style); static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style); static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style); -#if LV_NO_SHADOW == 0 +#if USE_LV_SHADOW static void lv_draw_rect_shadow(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style); static void lv_draw_cont_shadow_full(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style); static void lv_draw_cont_shadow_bottom(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style); @@ -94,24 +94,41 @@ void lv_draw_rect(const lv_area_t * coords, const lv_area_t * mask, const lv_sty { if(lv_area_get_height(coords) < 1 || lv_area_get_width(coords) < 1) return; -#if LV_NO_SHADOW == 0 + lv_area_t coord_aa; + lv_area_t mask_aa; +#if LV_ANTIALIAS == 0 + lv_area_copy(&coord_aa, coords); + lv_area_copy(&mask_aa, mask); +#else + coord_aa.x1 = coords->x1 << LV_AA; + coord_aa.y1 = coords->y1 << LV_AA; + coord_aa.x2 = (coords->x2 << LV_AA) + 1; + coord_aa.y2 = (coords->y2 << LV_AA) + 1; + + mask_aa.x1 = mask->x1 << LV_AA; + mask_aa.y1 = mask->y1 << LV_AA; + mask_aa.x2 = (mask->x2 << LV_AA) + 1; + mask_aa.y2 = (mask->y2 << LV_AA) + 1; +#endif + +#if USE_LV_SHADOW if(style->body.shadow.width != 0) { - lv_draw_rect_shadow(coords, mask, style); + lv_draw_rect_shadow(&coord_aa, &mask_aa, style); } #endif if(style->body.empty == 0){ - lv_draw_rect_main_mid(coords, mask, style); + lv_draw_rect_main_mid(&coord_aa, &mask_aa, style); if(style->body.radius != 0) { - lv_draw_rect_main_corner(coords, mask, style); + lv_draw_rect_main_corner(&coord_aa, &mask_aa, style); } } if(style->body.border.width != 0 && style->body.border.part != LV_BORDER_NONE) { - lv_draw_rect_border_straight(coords, mask, style); + lv_draw_rect_border_straight(&coord_aa, &mask_aa, style); if(style->body.radius != 0) { - lv_draw_rect_border_corner(coords, mask, style); + lv_draw_rect_border_corner(&coord_aa, &mask_aa, style); } } } @@ -237,9 +254,26 @@ void lv_draw_triangle(const lv_point_t * points, const lv_area_t * mask, lv_colo void lv_draw_label(const lv_area_t * coords,const lv_area_t * mask, const lv_style_t * style, const char * txt, lv_txt_flag_t flag, lv_point_t * offset) { + lv_area_t coord_aa; + lv_area_t mask_aa; + +#if LV_ANTIALIAS == 0 + lv_area_copy(&coord_aa, coords); + lv_area_copy(&mask_aa, mask); +#else + coord_aa.x1 = coords->x1 << LV_AA; + coord_aa.y1 = coords->y1 << LV_AA; + coord_aa.x2 = (coords->x2 << LV_AA) + 1; + coord_aa.y2 = (coords->y2 << LV_AA) + 1; + + mask_aa.x1 = mask->x1 << LV_AA; + mask_aa.y1 = mask->y1 << LV_AA; + mask_aa.x2 = (mask->x2 << LV_AA) + 1; + mask_aa.y2 = (mask->y2 << LV_AA) + 1; +#endif + const lv_font_t * font = style->text.font; lv_coord_t w; - if((flag & LV_TXT_FLAG_EXPAND) == 0) { w = lv_area_get_width(coords); } else { @@ -247,26 +281,28 @@ void lv_draw_label(const lv_area_t * coords,const lv_area_t * mask, const lv_sty lv_txt_get_size(&p, txt, style->text.font, style->text.letter_space, style->text.line_space, LV_COORD_MAX, flag); w = p.x; } + /*Init variables for the first line*/ lv_coord_t line_length = 0; uint32_t line_start = 0; uint32_t line_end = lv_txt_get_next_line(txt, font, style->text.letter_space, w, flag); lv_point_t pos; - pos.x = coords->x1; - pos.y = coords->y1; + pos.x = coord_aa.x1; + pos.y = coord_aa.y1; /*Align the line to middle if enabled*/ if(flag & LV_TXT_FLAG_CENTER) { line_length = lv_txt_get_width(&txt[line_start], line_end - line_start, font, style->text.letter_space, flag); - pos.x += (w - line_length) / 2; + pos.x += ((w - line_length) / 2) << LV_AA; } cmd_state_t cmd_state = CMD_STATE_WAIT; uint32_t i; uint16_t par_start = 0; lv_color_t recolor; + lv_coord_t letter_w; if(offset != NULL) { pos.y += offset->y; @@ -321,25 +357,29 @@ void lv_draw_label(const lv_area_t * coords,const lv_area_t * mask, const lv_sty lv_color_t color = style->text.color; if(cmd_state == CMD_STATE_IN) color = recolor; - letter_fp(&pos, mask, font, letter, color, style->text.opa); - - pos.x += lv_font_get_width_scale(font, letter) + style->text.letter_space; + letter_fp(&pos, &mask_aa, font, letter, color, style->text.opa); + letter_w = lv_font_get_width(font, letter) >> LV_FONT_ANTIALIAS; + pos.x += letter_w + (style->text.letter_space << LV_AA); + /* Round error occurs in x position + * When odd widths are scaled down the last 1 is lost. So the letters seems shorter. + * Now calculate according to is to be consequent */ + if(letter_w & 0x01) pos.x--; } /*Go to next line*/ line_start = line_end; line_end += lv_txt_get_next_line(&txt[line_start], font, style->text.letter_space, w, flag); - pos.x = coords->x1; + pos.x = coord_aa.x1; /*Align to middle*/ if(flag & LV_TXT_FLAG_CENTER) { line_length = lv_txt_get_width(&txt[line_start], line_end - line_start, font, style->text.letter_space, flag); - pos.x += (w - line_length) / 2; + pos.x += ((w - line_length) / 2) << LV_AA; } /*Go the next line position*/ - pos.y += lv_font_get_height_scale(font); - pos.y += style->text.line_space; + pos.y += lv_font_get_height(font) >> LV_FONT_ANTIALIAS; + pos.y += style->text.line_space << LV_AA; } } @@ -358,6 +398,24 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, lv_draw_rect(coords, mask, &lv_style_plain); lv_draw_label(coords, mask, &lv_style_plain, "No data", LV_TXT_FLAG_NONE, NULL); } else { + lv_area_t coord_aa; + lv_area_t mask_aa; + +#if LV_ANTIALIAS == 0 + lv_area_copy(&coord_aa, coords); + lv_area_copy(&mask_aa, mask); +#else + coord_aa.x1 = coords->x1 << LV_AA; + coord_aa.y1 = coords->y1 << LV_AA; + coord_aa.x2 = (coords->x2 << LV_AA) + 1; + coord_aa.y2 = (coords->y2 << LV_AA) + 1; + + mask_aa.x1 = mask->x1 << LV_AA; + mask_aa.y1 = mask->y1 << LV_AA; + mask_aa.x2 = (mask->x2 << LV_AA) + 1; + mask_aa.y2 = (mask->y2 << LV_AA) + 1; +#endif + lv_fs_file_t file; lv_fs_res_t res = lv_fs_open(&file, fn, LV_FS_MODE_RD); if(res == LV_FS_RES_OK) { @@ -365,26 +423,25 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, uint32_t br; res = lv_fs_read(&file, &header, sizeof(lv_img_raw_header_t), &br); - /*If the width is greater then real img. width then it is upscaled */ - bool upscale = false; - if(lv_area_get_width(coords) > header.w) upscale = true; - lv_area_t mask_com; /*Common area of mask and cords*/ bool union_ok; - union_ok = lv_area_union(&mask_com, mask, coords); + union_ok = lv_area_union(&mask_com, &mask_aa, &coord_aa); if(union_ok == false) { lv_fs_close(&file); return; } - /*Round the coordinates with upscale*/ - if(upscale != false) { - if((mask_com.y1 & 0x1) != 0) mask_com.y1 -= 1; /*Can be only even*/ - if((mask_com.y2 & 0x1) == 0) mask_com.y2 -= 1; /*Can be only odd*/ - if((mask_com.x1 & 0x1) != 0) mask_com.x1 -= 1; /*Can be only even*/ - if((mask_com.x2 & 0x1) == 0) mask_com.x2 -= 1; /*Can be only odd*/ - } + /*If the width is greater then real img. width then it is upscaled */ + bool upscale = false; +#if LV_ANTIALIAS + if(lv_area_get_width(coords) < header.w) { + upscale = false; + lv_area_set_width(&coord_aa, header.w); + } + else upscale = true; + +#endif bool const_data = false; @@ -393,7 +450,7 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, const_data = true; uint8_t * f_data = ((lv_ufs_file_t*)file.file_d)->ent->data_d; f_data += sizeof(lv_img_raw_header_t); - map_fp(coords, &mask_com, (void*)f_data , style->image.opa, header.transp, upscale, style->image.color, style->image.intense); + map_fp(&coord_aa, &mask_com, (void*)f_data , style->image.opa, header.transp, upscale, style->image.color, style->image.intense); } /*Read the img. with the FS interface*/ @@ -408,13 +465,13 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, /* Move the file pointer to the start address according to mask * But take care, the upscaled maps look greater*/ uint32_t start_offset = sizeof(lv_img_raw_header_t); - start_offset += (lv_area_get_width(coords) >> us_shift) * - ((mask_com.y1 - coords->y1) >> us_shift) * sizeof(lv_color_t); /*First row*/ - start_offset += ((mask_com.x1 - coords->x1) >> us_shift) * sizeof(lv_color_t); /*First col*/ + start_offset += (lv_area_get_width(&coord_aa) >> us_shift) * + ((mask_com.y1 - coord_aa.y1) >> us_shift) * sizeof(lv_color_t); /*First row*/ + start_offset += ((mask_com.x1 - coord_aa.x1) >> us_shift) * sizeof(lv_color_t); /*First col*/ lv_fs_seek(&file, start_offset); uint32_t useful_data = (lv_area_get_width(&mask_com) >> us_shift) * sizeof(lv_color_t); - uint32_t next_row = (lv_area_get_width(coords) >> us_shift) * sizeof(lv_color_t) - useful_data; + uint32_t next_row = (lv_area_get_width(&coord_aa) >> us_shift) * sizeof(lv_color_t) - useful_data; lv_area_t line; lv_area_copy(&line, &mask_com); @@ -458,22 +515,44 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, void lv_draw_line(const lv_point_t * p1, const lv_point_t * p2, const lv_area_t * mask, const lv_style_t * style) { - if(style->line.width == 0) return; + if(style->line.width == 0) return; if(p1->x == p2->x && p1->y == p2->y) return; - lv_coord_t dx = LV_MATH_ABS(p2->x - p1->x); - lv_coord_t sx = p1->x < p2->x ? 1 : -1; - lv_coord_t dy = LV_MATH_ABS(p2->y - p1->y); - lv_coord_t sy = p1->y < p2->y ? 1 : -1; + + lv_point_t p1_aa; + lv_point_t p2_aa; + + p1_aa.x = p1->x << LV_AA; + p1_aa.y = p1->y << LV_AA; + + p2_aa.x = p2->x << LV_AA; + p2_aa.y = p2->y << LV_AA; + + + lv_area_t mask_aa; +#if LV_ANTIALIAS == 0 + lv_area_copy(&mask_aa, mask); +#else + mask_aa.x1 = mask->x1 << LV_AA; + mask_aa.y1 = mask->y1 << LV_AA; + mask_aa.x2 = (mask->x2 << LV_AA) + 1; + mask_aa.y2 = (mask->y2 << LV_AA) + 1; +#endif + + + lv_coord_t dx = LV_MATH_ABS(p2_aa.x - p1_aa.x); + lv_coord_t sx = p1_aa.x < p2_aa.x ? 1 : -1; + lv_coord_t dy = LV_MATH_ABS(p2_aa.y - p1_aa.y); + lv_coord_t sy = p1_aa.y < p2_aa.y ? 1 : -1; lv_coord_t err = (dx > dy ? dx : -dy) / 2; lv_coord_t e2; bool hor = dx > dy ? true : false; /*Rather horizontal or vertical*/ - lv_coord_t last_x = p1->x; - lv_coord_t last_y = p1->y; + lv_coord_t last_x = p1_aa.x; + lv_coord_t last_y = p1_aa.y; lv_point_t act_point; - act_point.x = p1->x; - act_point.y = p1->y; + act_point.x = p1_aa.x; + act_point.y = p1_aa.y; uint16_t width; @@ -513,7 +592,7 @@ void lv_draw_line(const lv_point_t * p1, const lv_point_t * p2, const lv_area_t draw_area.x2 = LV_MATH_MAX(act_area.x1, act_area.x2); draw_area.y1 = LV_MATH_MIN(act_area.y1, act_area.y2); draw_area.y2 = LV_MATH_MAX(act_area.y1, act_area.y2); - fill_fp(&draw_area, mask, style->line.color, style->line.opa); + fill_fp(&draw_area, &mask_aa, style->line.color, style->line.opa); } if (hor == false && last_x != act_point.x) { lv_area_t act_area; @@ -529,11 +608,11 @@ void lv_draw_line(const lv_point_t * p1, const lv_point_t * p2, const lv_area_t draw_area.x2 = LV_MATH_MAX(act_area.x1, act_area.x2); draw_area.y1 = LV_MATH_MIN(act_area.y1, act_area.y2); draw_area.y2 = LV_MATH_MAX(act_area.y1, act_area.y2); - fill_fp(&draw_area, mask, style->line.color, style->line.opa); + fill_fp(&draw_area, &mask_aa, style->line.color, style->line.opa); } /*Calc. the next point of the line*/ - if (act_point.x == p2->x && act_point.y == p2->y) break; + if (act_point.x == p2_aa.x && act_point.y == p2_aa.y) break; e2 = err; if (e2 >-dx) { err -= dy; @@ -557,7 +636,7 @@ void lv_draw_line(const lv_point_t * p1, const lv_point_t * p2, const lv_area_t draw_area.x2 = LV_MATH_MAX(act_area.x1, act_area.x2); draw_area.y1 = LV_MATH_MIN(act_area.y1, act_area.y2); draw_area.y2 = LV_MATH_MAX(act_area.y1, act_area.y2); - fill_fp(&draw_area, mask, style->line.color, style->line.opa); + fill_fp(&draw_area, &mask_aa, style->line.color, style->line.opa); } if (hor == false) { lv_area_t act_area; @@ -571,7 +650,7 @@ void lv_draw_line(const lv_point_t * p1, const lv_point_t * p2, const lv_area_t draw_area.x2 = LV_MATH_MAX(act_area.x1, act_area.x2); draw_area.y1 = LV_MATH_MIN(act_area.y1, act_area.y2); draw_area.y2 = LV_MATH_MAX(act_area.y1, act_area.y2); - fill_fp(&draw_area, mask, style->line.color, style->line.opa); + fill_fp(&draw_area, &mask_aa, style->line.color, style->line.opa); } } @@ -588,7 +667,7 @@ void lv_draw_line(const lv_point_t * p1, const lv_point_t * p2, const lv_area_t */ static void lv_draw_rect_main_mid(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style) { - uint16_t radius = style->body.radius; + uint16_t radius = style->body.radius << LV_AA; lv_color_t mcolor = style->body.main_color; lv_color_t gcolor = style->body.grad_color; @@ -638,7 +717,7 @@ static void lv_draw_rect_main_mid(const lv_area_t * coords, const lv_area_t * ma */ static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style) { - uint16_t radius = style->body.radius; + uint16_t radius = style->body.radius << LV_AA; lv_color_t mcolor = style->body.main_color; lv_color_t gcolor = style->body.grad_color; @@ -839,11 +918,11 @@ static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t * */ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style) { - uint16_t radius = style->body.radius; + uint16_t radius = style->body.radius << LV_AA; lv_coord_t width = lv_area_get_width(coords); lv_coord_t height = lv_area_get_height(coords); - uint16_t bwidth = style->body.border.width; + uint16_t bwidth = style->body.border.width << LV_AA; lv_opa_t opa = style->body.border.opa; lv_border_part_t part = style->body.border.part; lv_color_t color = style->body.border.color; @@ -995,8 +1074,8 @@ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area */ static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style) { - uint16_t radius = style->body.radius; - uint16_t bwidth = style->body.border.width; + uint16_t radius = style->body.radius << LV_AA; + uint16_t bwidth = style->body.border.width << LV_AA; lv_color_t color = style->body.border.color; lv_opa_t opa = style->body.border.opa; lv_border_part_t part = style->body.border.part; @@ -1130,7 +1209,7 @@ static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t } } -#if LV_NO_SHADOW == 0 +#if USE_LV_SHADOW /** * Draw a shadow @@ -1140,7 +1219,7 @@ static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t static void lv_draw_rect_shadow(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style) { /* If mask is in the middle of cords do not draw shadow*/ - lv_coord_t radius = style->body.radius; + lv_coord_t radius = style->body.radius << LV_AA; lv_coord_t width = lv_area_get_width(coords); lv_coord_t height = lv_area_get_height(coords); radius = lv_draw_cont_radius_corr(radius, width, height); @@ -1168,14 +1247,15 @@ static void lv_draw_rect_shadow(const lv_area_t * coords, const lv_area_t * mask static void lv_draw_cont_shadow_full(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style) { - lv_coord_t radius = style->body.radius; + lv_coord_t radius = style->body.radius << LV_AA; + lv_coord_t swidth = style->body.shadow.width << LV_AA; lv_coord_t width = lv_area_get_width(coords); lv_coord_t height = lv_area_get_height(coords); radius = lv_draw_cont_radius_corr(radius, width, height); - lv_coord_t cruve_x[radius + style->body.shadow.width]; /*Stores the 'x' coordinates of a quarter circle.*/ + lv_coord_t cruve_x[radius + swidth]; /*Stores the 'x' coordinates of a quarter circle.*/ memset(cruve_x, 0, sizeof(cruve_x)); lv_point_t circ; lv_coord_t circ_tmp; @@ -1187,7 +1267,7 @@ static void lv_draw_cont_shadow_full(const lv_area_t * coords, const lv_area_t * } int16_t row; - int16_t filter_size = 2 * style->body.shadow.width + 1; + int16_t filter_size = 2 * swidth + 1; uint16_t opa_h_result[filter_size]; for(row = 0; row < filter_size; row++) { @@ -1195,7 +1275,7 @@ static void lv_draw_cont_shadow_full(const lv_area_t * coords, const lv_area_t * } uint16_t p; - lv_opa_t opa_v_result[radius + style->body.shadow.width]; + lv_opa_t opa_v_result[radius + swidth]; lv_point_t point_rt; lv_point_t point_rb; @@ -1217,13 +1297,13 @@ static void lv_draw_cont_shadow_full(const lv_area_t * coords, const lv_area_t * ofs_lt.x = coords->x1 + radius; ofs_lt.y = coords->y1 + radius; - for(row = 0; row < radius + style->body.shadow.width; row++) { - for(p = 0; p < radius + style->body.shadow.width; p++) { + for(row = 0; row < radius + swidth; row++) { + for(p = 0; p < radius + swidth; p++) { int16_t v; uint32_t opa_tmp = 0; int16_t row_v; bool swidth_out = false; - for(v = -style->body.shadow.width; v < style->body.shadow.width; v++) { + for(v = -swidth; v < swidth; v++) { row_v = row + v; if(row_v < 0) row_v = 0; /*Rows above the corner*/ @@ -1234,19 +1314,19 @@ static void lv_draw_cont_shadow_full(const lv_area_t * coords, const lv_area_t * else { int16_t p_tmp = p - (cruve_x[row_v] - cruve_x[row]); - if(p_tmp < -style->body.shadow.width) { /*Cols before the filtered shadow (still not blurred)*/ + if(p_tmp < -swidth) { /*Cols before the filtered shadow (still not blurred)*/ opa_tmp += style->body.opa * 2; } /*Cols after the filtered shadow (already no effect) */ - else if (p_tmp > style->body.shadow.width) { + else if (p_tmp > swidth) { /* If on the current point the filter top point is already out of swidth then * the remaining part will not do not anything on this point*/ - if(v == -style->body.shadow.width) { /*Is the first point?*/ + if(v == -swidth) { /*Is the first point?*/ swidth_out = true; } break; } else { - opa_tmp += opa_h_result[p_tmp + style->body.shadow.width]; + opa_tmp += opa_h_result[p_tmp + swidth]; } } } @@ -1307,14 +1387,14 @@ static void lv_draw_cont_shadow_full(const lv_area_t * coords, const lv_area_t * static void lv_draw_cont_shadow_bottom(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style) { - lv_coord_t radius = style->body.radius; - + lv_coord_t radius = style->body.radius << LV_AA; + lv_coord_t swidth = style->body.shadow.width << LV_AA; lv_coord_t width = lv_area_get_width(coords); lv_coord_t height = lv_area_get_height(coords); radius = lv_draw_cont_radius_corr(radius, width, height); - lv_coord_t cruve_x[radius + style->body.shadow.width]; /*Stores the 'x' coordinates of a quarter circle.*/ + lv_coord_t cruve_x[radius + swidth]; /*Stores the 'x' coordinates of a quarter circle.*/ memset(cruve_x, 0, sizeof(cruve_x)); lv_point_t circ; lv_coord_t circ_tmp; @@ -1326,7 +1406,7 @@ static void lv_draw_cont_shadow_bottom(const lv_area_t * coords, const lv_area_t } int16_t row; - int16_t filter_size = 2 * style->body.shadow.width + 1; + int16_t filter_size = 2 * swidth + 1; lv_opa_t opa_h_result[filter_size]; for(row = 0; row < filter_size; row++) { @@ -1353,7 +1433,7 @@ static void lv_draw_cont_shadow_bottom(const lv_area_t * coords, const lv_area_t point_r.y = ofs2.y + cruve_x[row]; uint16_t d; - for(d= style->body.shadow.width; d < filter_size; d++) { + for(d = swidth; d < filter_size; d++) { px_fp(point_l.x, point_l.y, mask, style->body.shadow.color, opa_h_result[d]); point_l.y ++; @@ -1369,7 +1449,7 @@ static void lv_draw_cont_shadow_bottom(const lv_area_t * coords, const lv_area_t area_mid.y2 = area_mid.y1; uint16_t d; - for(d= style->body.shadow.width; d < filter_size; d++) { + for(d = swidth; d < filter_size; d++) { fill_fp(&area_mid, mask, style->body.shadow.color, opa_h_result[d]); area_mid.y1 ++; area_mid.y2 ++; @@ -1379,8 +1459,8 @@ static void lv_draw_cont_shadow_bottom(const lv_area_t * coords, const lv_area_t static void lv_draw_cont_shadow_full_straight(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, const lv_opa_t * map) { - lv_coord_t radius = style->body.radius; - + lv_coord_t radius = style->body.radius << LV_AA; + lv_coord_t swidth = style->body.shadow.width << LV_AA; lv_coord_t width = lv_area_get_width(coords); lv_coord_t height = lv_area_get_height(coords); @@ -1411,7 +1491,7 @@ static void lv_draw_cont_shadow_full_straight(const lv_area_t * coords, const lv sideb_area.y2 = sideb_area.y1; int16_t d; - for(d = 0; d < style->body.shadow.width; d++) { + for(d = 0; d < swidth; d++) { fill_fp(&sider_area, mask, style->body.shadow.color, map[d]); sider_area.x1++; sider_area.x2++; diff --git a/lv_draw/lv_draw_vbasic.c b/lv_draw/lv_draw_vbasic.c index 5cc29cc07..b2b017012 100644 --- a/lv_draw/lv_draw_vbasic.c +++ b/lv_draw/lv_draw_vbasic.c @@ -94,9 +94,6 @@ void lv_vpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t col void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p, lv_color_t color, lv_opa_t opa) { - static lv_color_t color_array_tmp[LV_VER_RES]; /*Used by 'sw_color_fill'*/ - static lv_coord_t last_width = -1; - lv_area_t res_a; bool union_ok; lv_vdb_t * vdb_p = lv_vdb_get(); @@ -120,8 +117,12 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p, /*Move the vdb_tmp to the first row*/ vdb_buf_tmp += vdb_width * vdb_rel_a.y1; - lv_coord_t w = lv_area_get_width(&vdb_rel_a); +#if USE_LV_GPU + static lv_color_t color_array_tmp[LV_HOR_RES << LV_ANTIALIAS]; /*Used by 'sw_color_fill'*/ + static lv_coord_t last_width = -1; + + lv_coord_t w = lv_area_get_width(&vdb_rel_a); /*Don't use hw. acc. for every small fill (because of the init overhead)*/ if(w < VFILL_HW_ACC_SIZE_LIMIT) { sw_color_fill(&vdb_p->area, vdb_buf_tmp, &vdb_rel_a, color, opa); @@ -158,6 +159,7 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p, else { sw_color_fill(&vdb_p->area, vdb_buf_tmp, &vdb_rel_a, color, opa); } + } /*Fill with opacity*/ else { @@ -182,7 +184,11 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p, else { sw_color_fill(&vdb_p->area, vdb_buf_tmp, &vdb_rel_a, color, opa); } + } +#else + sw_color_fill(&vdb_p->area, vdb_buf_tmp, &vdb_rel_a, color, opa); +#endif } /** @@ -268,7 +274,6 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p, map2_p ++; } - if(px_cnt != 0) { if(opa == LV_OPA_COVER) *vdb_buf_tmp = lv_color_mix(color, *vdb_buf_tmp, 63*px_cnt); else *vdb_buf_tmp = lv_color_mix(color, *vdb_buf_tmp, opa_tmp * px_cnt); @@ -368,11 +373,15 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p, lv_coord_t map_useful_w = lv_area_get_width(&masked_a); for(row = masked_a.y1; row <= masked_a.y2; row++) { +#if USE_LV_GPU if(lv_disp_is_mem_blend_supported() == false) { sw_mem_blend(&vdb_buf_tmp[masked_a.x1], &map_p[masked_a.x1], map_useful_w, opa); } else { lv_disp_mem_blend(&vdb_buf_tmp[masked_a.x1], &map_p[masked_a.x1], map_useful_w, opa); } +#else + sw_mem_blend(&vdb_buf_tmp[masked_a.x1], &map_p[masked_a.x1], map_useful_w, opa); +#endif map_p += map_width; /*Next row on the map*/ vdb_buf_tmp += vdb_width; /*Next row on the VDB*/ } @@ -468,6 +477,7 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p, vdb_buf_tmp[vdb_col2 + 1].full = map_p[map_col].full; } + map_p += map_width; vdb_buf_tmp += 2 * vdb_width ; /*+ 2 row on the VDB (2 rows are filled because of the upscale)*/ @@ -539,6 +549,7 @@ static void sw_mem_blend(lv_color_t * dest, const lv_color_t * src, uint32_t len */ static void sw_color_fill(lv_area_t * mem_area, lv_color_t * mem, const lv_area_t * fill_area, lv_color_t color, lv_opa_t opa) { + /*Set all row in vdb to the given color*/ lv_coord_t row; lv_coord_t col; diff --git a/lv_hal/lv_hal_disp.c b/lv_hal/lv_hal_disp.c index 649448220..05c8e03a8 100644 --- a/lv_hal/lv_hal_disp.c +++ b/lv_hal/lv_hal_disp.c @@ -51,8 +51,12 @@ void lv_disp_drv_init(lv_disp_drv_t *driver) { driver->disp_fill = NULL; driver->disp_map = NULL; + driver->disp_flush = NULL; + +#if USE_LV_GPU driver->mem_blend = NULL; driver->mem_fill = NULL; +#endif } /** @@ -160,6 +164,8 @@ void lv_disp_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_ if(active->driver.disp_map != NULL) active->driver.disp_map(x1, y1, x2, y2, color_map); } +#if USE_LV_GPU + /** * Blend pixels to a destination memory from a source memory * In 'lv_disp_drv_t' 'mem_blend' is optional. (NULL if not available) @@ -207,6 +213,7 @@ bool lv_disp_is_mem_fill_supported(void) if(active->driver.mem_fill) return true; else return false; } +#endif /********************** * STATIC FUNCTIONS diff --git a/lv_hal/lv_hal_disp.h b/lv_hal/lv_hal_disp.h index b35e5435b..ae225f140 100644 --- a/lv_hal/lv_hal_disp.h +++ b/lv_hal/lv_hal_disp.h @@ -41,11 +41,14 @@ typedef struct _disp_drv_t { /*Write pixel map (e.g. image) to the display*/ void (*disp_map)(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_p); +#if USE_LV_GPU /*Blend two memories using opacity (GPU only)*/ void (*mem_blend)(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa); /*Fill a memory with a color (GPU only)*/ void (*mem_fill)(lv_color_t * dest, uint32_t length, lv_color_t color); +#endif + } lv_disp_drv_t; typedef struct _disp_t { @@ -122,6 +125,7 @@ void lv_disp_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t col */ void lv_disp_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_map); +#if USE_LV_GPU /** * Blend pixels to a destination memory from a source memory * In 'lv_disp_drv_t' 'mem_blend' is optional. (NULL if not available) @@ -152,7 +156,7 @@ bool lv_disp_is_mem_blend_supported(void); * @return false: 'mem_fill' is not supported in the drover; true: 'mem_fill' is supported in the driver */ bool lv_disp_is_mem_fill_supported(void); - +#endif /********************** * MACROS **********************/ diff --git a/lv_misc/lv_anim.c b/lv_misc/lv_anim.c index d1cbfd6df..0187bfdcf 100644 --- a/lv_misc/lv_anim.c +++ b/lv_misc/lv_anim.c @@ -8,7 +8,7 @@ *********************/ #include "lv_anim.h" -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION #include #include #include "../lv_hal/lv_hal_tick.h" diff --git a/lv_misc/lv_anim.h b/lv_misc/lv_anim.h index dfd4984ba..5f0d1c451 100644 --- a/lv_misc/lv_anim.h +++ b/lv_misc/lv_anim.h @@ -15,7 +15,7 @@ extern "C" { * INCLUDES *********************/ #include "../../lv_conf.h" -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION #include #include diff --git a/lv_misc/lv_font.h b/lv_misc/lv_font.h index 364dcee2f..bde7565d2 100644 --- a/lv_misc/lv_font.h +++ b/lv_misc/lv_font.h @@ -81,7 +81,7 @@ static inline uint8_t lv_font_get_height(const lv_font_t * font_p) */ static inline uint8_t lv_font_get_height_scale(const lv_font_t * font_p) { - return font_p->height_row >> LV_FONT_ANTIALIAS; + return (font_p->height_row >> LV_FONT_ANTIALIAS) >> LV_ANTIALIAS; } @@ -101,7 +101,7 @@ uint8_t lv_font_get_width(const lv_font_t * font_p, uint32_t letter); */ static inline uint8_t lv_font_get_width_scale(const lv_font_t * font_p, uint32_t letter) { - return lv_font_get_width(font_p, letter) >> LV_FONT_ANTIALIAS; + return (lv_font_get_width(font_p, letter) >> LV_FONT_ANTIALIAS) >> LV_ANTIALIAS; } /********************** diff --git a/lv_misc/lv_fs.c b/lv_misc/lv_fs.c index 8d84d4269..f3dce2ed8 100644 --- a/lv_misc/lv_fs.c +++ b/lv_misc/lv_fs.c @@ -7,6 +7,8 @@ * INCLUDES *********************/ #include "lv_fs.h" +#if USE_LV_FILESYSTEM + #include "lv_ll.h" #include @@ -536,3 +538,5 @@ static lv_fs_drv_t* lv_fs_get_drv(char letter) return NULL; } + +#endif /*USE_LV_FILESYSTEM*/ diff --git a/lv_misc/lv_fs.h b/lv_misc/lv_fs.h index e47096bf2..f9a27f4bb 100644 --- a/lv_misc/lv_fs.h +++ b/lv_misc/lv_fs.h @@ -14,6 +14,10 @@ extern "C" { /********************* * INCLUDES *********************/ +#include "../../lv_conf.h" + +#if USE_LV_FILESYSTEM + #include #include #include "lv_mem.h" @@ -235,8 +239,10 @@ const char * lv_fs_get_last(const char * path); * MACROS **********************/ +#endif /*USE_LV_FILESYSTEM*/ + #ifdef __cplusplus } /* extern "C" */ #endif -#endif +#endif /*LV_FS_H*/ diff --git a/lv_misc/lv_txt.c b/lv_misc/lv_txt.c index d4cb09cb7..631c4d40a 100644 --- a/lv_misc/lv_txt.c +++ b/lv_misc/lv_txt.c @@ -49,6 +49,7 @@ static bool is_break_char(uint32_t letter); void lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t * font, lv_coord_t letter_space, lv_coord_t line_space, lv_coord_t max_width, lv_txt_flag_t flag) { + size_res->x = 0; size_res->y = 0; @@ -104,11 +105,11 @@ uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font, if(flag & LV_TXT_FLAG_EXPAND) max_width = LV_COORD_MAX; uint32_t i = 0; - lv_coord_t act_l = 0; + lv_coord_t cur_w = 0; uint32_t last_break = NO_BREAK_FOUND; lv_txt_cmd_state_t cmd_state = LV_TXT_CMD_STATE_WAIT; uint32_t letter = 0; - + while(txt[i] != '\0') { letter = lv_txt_utf8_next(txt, &i); @@ -128,10 +129,10 @@ uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font, return i; /*Return with the first letter of the next line*/ } else { /*Check the actual length*/ - act_l += lv_font_get_width_scale(font, letter); + cur_w += lv_font_get_width_scale(font, letter); /*If the txt is too long then finish, this is the line end*/ - if(act_l > max_width) { + if(cur_w > max_width) { /*If this a break char then break here.*/ if(is_break_char(letter)) { /* Now 'i' points to the next char because of txt_utf8_next() @@ -139,11 +140,11 @@ uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font, * Hence do nothing here*/ } /*If already a break character is found, then break there*/ - else if(last_break != NO_BREAK_FOUND ) { + if(last_break != NO_BREAK_FOUND ) { i = last_break; } else { - /* Now this character is out of the area but 'i' points to the next char because of txt_utf8_next() - * So step back one char*/ + /* Now this character is out of the area so it will be first character of the next line*/ + /* But 'i' already points to the next character (because of lv_txt_utf8_next) step beck one*/ lv_txt_utf8_prev(txt, &i); } @@ -160,7 +161,7 @@ uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font, } } - act_l += letter_space; + cur_w += letter_space; } return i; @@ -197,7 +198,7 @@ lv_coord_t lv_txt_get_width(const char * txt, uint16_t length, width += lv_font_get_width_scale(font, letter); width += letter_space; } - + /*Trim closing spaces. Important when the text is aligned to the middle */ for(i = length - 1; i > 0; i--) { if(txt[i] == ' ') { diff --git a/lv_objx/lv_bar.c b/lv_objx/lv_bar.c index 674f5c752..0bb68d6dd 100644 --- a/lv_objx/lv_bar.c +++ b/lv_objx/lv_bar.c @@ -115,7 +115,7 @@ void lv_bar_set_value(lv_obj_t * bar, int16_t value) lv_obj_invalidate(bar); } -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION /** * Set a new value with animation on the bar * @param bar pointer to a bar object diff --git a/lv_objx/lv_cb.c b/lv_objx/lv_cb.c index c01726878..ea93972ff 100644 --- a/lv_objx/lv_cb.c +++ b/lv_objx/lv_cb.c @@ -247,7 +247,7 @@ static bool lv_bullet_design(lv_obj_t * bullet, const lv_area_t * mask, lv_desig if(mode == LV_DESIGN_COVER_CHK) { return ancestor_bullet_design(bullet, mask, mode); } else if(mode == LV_DESIGN_DRAW_MAIN) { -#if LV_OBJ_GROUP +#if USE_LV_GROUP /* If the check box is the active in a group and * the background is not visible (transparent or empty) * then activate the style of the bullet*/ @@ -265,7 +265,7 @@ static bool lv_bullet_design(lv_obj_t * bullet, const lv_area_t * mask, lv_desig #endif ancestor_bullet_design(bullet, mask, mode); -#if LV_OBJ_GROUP +#if USE_LV_GROUP bullet->style_p = style_ori; /*Revert the style*/ #endif } else if(mode == LV_DESIGN_DRAW_POST) { diff --git a/lv_objx/lv_chart.c b/lv_objx/lv_chart.c index c2c42b1ef..b8bb801a6 100644 --- a/lv_objx/lv_chart.c +++ b/lv_objx/lv_chart.c @@ -75,7 +75,7 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy) ext->type = LV_CHART_TYPE_LINE; ext->series.opa = LV_OPA_COVER; ext->series.dark = LV_OPA_50; - ext->series.width = 2 << LV_ANTIALIAS; + ext->series.width = 2; if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_func(new_chart); if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_func(new_chart); diff --git a/lv_objx/lv_ddlist.c b/lv_objx/lv_ddlist.c index ffda29d25..87a42055e 100644 --- a/lv_objx/lv_ddlist.c +++ b/lv_objx/lv_ddlist.c @@ -22,7 +22,7 @@ * DEFINES *********************/ -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION # ifndef LV_DDLIST_DEF_ANIM_TIME # define LV_DDLIST_DEF_ANIM_TIME 200 /*ms*/ # endif @@ -607,7 +607,7 @@ static void lv_ddlist_refr_size(lv_obj_t * ddlist, uint16_t anim_time) lv_obj_set_height(ddlist, new_height); lv_ddlist_pos_current_option(ddlist); } else { -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION lv_anim_t a; a.var = ddlist; a.start = lv_obj_get_height(ddlist); diff --git a/lv_objx/lv_img.c b/lv_objx/lv_img.c index dd7cc03d2..ae45fb54d 100644 --- a/lv_objx/lv_img.c +++ b/lv_objx/lv_img.c @@ -146,11 +146,10 @@ void lv_img_set_file(lv_obj_t * img, const char * fn) ext->w = header.w; ext->h = header.h; ext->transp = header.transp; - -#if LV_ANTIALIAS != 0 - if(ext->upscale != 0) { - ext->w *= 2; - ext->h *= 2; +#if LV_ANTIALIAS + if(ext->upscale == false) { + ext->w = ext->w >> LV_AA; + ext->h = ext->h >> LV_AA; } #endif } diff --git a/lv_objx/lv_label.c b/lv_objx/lv_label.c index de4f7a53d..e83833c41 100644 --- a/lv_objx/lv_label.c +++ b/lv_objx/lv_label.c @@ -21,7 +21,7 @@ *********************/ /*Test configurations*/ #ifndef LV_LABEL_SCROLL_SPEED -#define LV_LABEL_SCROLL_SPEED (25 << LV_ANTIALIAS) /*Hor, or ver. scroll speed (px/sec) in 'LV_LABEL_LONG_SCROLL' mode*/ +#define LV_LABEL_SCROLL_SPEED (25) /*Hor, or ver. scroll speed (px/sec) in 'LV_LABEL_LONG_SCROLL/ROLL' mode*/ #endif #define ANIM_WAIT_CHAR_COUNT 3 @@ -40,7 +40,7 @@ static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_ static void lv_label_refr_text(lv_obj_t * label); static void lv_label_revert_dots(lv_obj_t *label); -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION static void lv_label_set_offset_x(lv_obj_t * label, lv_coord_t x); static void lv_label_set_offset_y(lv_obj_t * label, lv_coord_t y); #endif @@ -223,7 +223,7 @@ void lv_label_set_long_mode(lv_obj_t * label, lv_label_long_mode_t long_mode) { lv_label_ext_t * ext = lv_obj_get_ext_attr(label); -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION /*Delete the old animation (if exists)*/ lv_anim_del(label, (lv_anim_fp_t) lv_obj_set_x); lv_anim_del(label, (lv_anim_fp_t) lv_obj_set_y); @@ -629,7 +629,7 @@ static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_ lv_style_t * style = lv_obj_get_style(label); lv_obj_get_coords(label, &cords); -#if LV_OBJ_GROUP +#if USE_LV_GROUP lv_group_t * g = lv_obj_get_group(label); if(lv_group_get_focused(g) == label) { lv_draw_rect(&cords, mask, style); @@ -641,7 +641,7 @@ static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_ if(ext->body_draw) lv_draw_rect(&cords, mask, style); /*TEST: draw a background for the label*/ -// lv_vfill(&label->coords, mask, LV_COLOR_LIME, LV_OPA_COVER); +// lv_draw_rect(&label->coords, mask, &lv_style_plain_color); lv_txt_flag_t flag = LV_TXT_FLAG_NONE; if(ext->recolor != 0) flag |= LV_TXT_FLAG_RECOLOR; @@ -730,7 +730,7 @@ static void lv_label_refr_text(lv_obj_t * label) /*Start scrolling if the label is greater then its parent*/ if(ext->long_mode == LV_LABEL_LONG_SCROLL) { -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION lv_obj_t * parent = lv_obj_get_parent(label); /*Delete the potential previous scroller animations*/ @@ -766,7 +766,7 @@ static void lv_label_refr_text(lv_obj_t * label) } /*In roll mode keep the size but start offset animations*/ else if(ext->long_mode == LV_LABEL_LONG_ROLL) { -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION lv_anim_t anim; anim.var = label; anim.repeat = 1; @@ -887,7 +887,7 @@ static void lv_label_revert_dots(lv_obj_t *label) ext->dot_end = LV_LABEL_DOT_END_INV; } -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION static void lv_label_set_offset_x(lv_obj_t * label, lv_coord_t x) { lv_label_ext_t * ext = lv_obj_get_ext_attr(label); diff --git a/lv_objx/lv_line.c b/lv_objx/lv_line.c index 00178fddb..41996c19b 100644 --- a/lv_objx/lv_line.c +++ b/lv_objx/lv_line.c @@ -63,7 +63,6 @@ lv_obj_t * lv_line_create(lv_obj_t * par, lv_obj_t * copy) ext->point_array = NULL; ext->auto_size = 1; ext->y_inv = 0; - ext->upscale = 0; lv_obj_set_design_func(new_line, lv_line_design); lv_obj_set_signal_func(new_line, lv_line_signal); @@ -79,7 +78,6 @@ lv_obj_t * lv_line_create(lv_obj_t * par, lv_obj_t * copy) lv_line_set_auto_size(new_line,lv_line_get_auto_size(copy)); lv_line_set_y_invert(new_line,lv_line_get_y_inv(copy)); lv_line_set_auto_size(new_line,lv_line_get_auto_size(copy)); - lv_line_set_upscale(new_line,lv_line_get_upscale(copy)); lv_line_set_points(new_line, copy_ext->point_array, copy_ext->point_num); /*Refresh the style with new signal function*/ lv_obj_refresh_style(new_line); @@ -105,18 +103,13 @@ void lv_line_set_points(lv_obj_t * line, const lv_point_t * point_a, uint16_t po ext->point_array = point_a; ext->point_num = point_num; - uint8_t us = 1; - if(ext->upscale != 0) { - us = 1 << LV_ANTIALIAS; - } - if(point_num > 0 && ext->auto_size != 0) { uint16_t i; lv_coord_t xmax = LV_COORD_MIN; lv_coord_t ymax = LV_COORD_MIN; for(i = 0; i < point_num; i++) { - xmax = LV_MATH_MAX(point_a[i].x * us, xmax); - ymax = LV_MATH_MAX(point_a[i].y * us, ymax); + xmax = LV_MATH_MAX(point_a[i].x, xmax); + ymax = LV_MATH_MAX(point_a[i].y, ymax); } lv_style_t * lines = lv_obj_get_style(line); @@ -156,21 +149,6 @@ void lv_line_set_y_invert(lv_obj_t * line, bool yinv_en) lv_obj_invalidate(line); } -/** - * Enable (or disable) the points' coordinate upscaling (if LV_ANTIALIAS is enabled). - * @param line pointer to a line object - * @param unscale true: enable the point coordinate upscaling - */ -void lv_line_set_upscale(lv_obj_t * line, bool unscale_en) -{ - lv_line_ext_t * ext = lv_obj_get_ext_attr(line); - - ext->upscale = unscale_en == false ? 0 : 1; - - /*Refresh to point to handle upscale*/ - lv_line_set_points(line, ext->point_array, ext->point_num); -} - /*===================== * Getter functions *====================*/ @@ -199,18 +177,6 @@ bool lv_line_get_y_inv(lv_obj_t * line) return ext->y_inv == 0 ? false : true; } -/** - * Get the point upscale enable attribute - * @param obj pointer to a line object - * @return true: point coordinate upscale is enabled, false: disabled - */ -bool lv_line_get_upscale(lv_obj_t * line) -{ - lv_line_ext_t * ext = lv_obj_get_ext_attr(line); - - return ext->upscale == 0 ? false : true; -} - /********************** * STATIC FUNCTIONS **********************/ @@ -243,23 +209,19 @@ static bool lv_line_design(lv_obj_t * line, const lv_area_t * mask, lv_design_mo lv_point_t p2; lv_coord_t h = lv_obj_get_height(line); uint16_t i; - uint8_t us = 1; - if(ext->upscale != 0) { - us = 1 << LV_ANTIALIAS; - } /*Read all pints and draw the lines*/ for (i = 0; i < ext->point_num - 1; i++) { - p1.x = ext->point_array[i].x * us + x_ofs; - p2.x = ext->point_array[i + 1].x * us + x_ofs; + p1.x = ext->point_array[i].x + x_ofs; + p2.x = ext->point_array[i + 1].x + x_ofs; if(ext->y_inv == 0) { - p1.y = ext->point_array[i].y * us + y_ofs; - p2.y = ext->point_array[i + 1].y * us + y_ofs; + p1.y = ext->point_array[i].y + y_ofs; + p2.y = ext->point_array[i + 1].y + y_ofs; } else { - p1.y = h - ext->point_array[i].y * us + y_ofs; - p2.y = h - ext->point_array[i + 1].y * us + y_ofs; + p1.y = h - ext->point_array[i].y + y_ofs; + p2.y = h - ext->point_array[i + 1].y + y_ofs; } lv_draw_line(&p1, &p2, mask, style); } diff --git a/lv_objx/lv_line.h b/lv_objx/lv_line.h index 0923ed1cf..6be90c87c 100644 --- a/lv_objx/lv_line.h +++ b/lv_objx/lv_line.h @@ -34,7 +34,6 @@ typedef struct uint16_t point_num; /*Number of points in 'point_array' */ uint8_t auto_size :1; /*1: set obj. width to x max and obj. height to y max */ uint8_t y_inv :1; /*1: y == 0 will be on the bottom*/ - uint8_t upscale :1; /*1: upscale coordinates with LV_DOWNSCALE*/ }lv_line_ext_t; /********************** @@ -79,13 +78,6 @@ void lv_line_set_auto_size(lv_obj_t * line, bool autosize_en); */ void lv_line_set_y_invert(lv_obj_t * line, bool yinv_en); -/** - * Enable (or disable) the points' coordinate upscaling (if LV_ANTIALIAS is enabled). - * @param line pointer to a line object - * @param unscale_en true: enable the point coordinate upscaling - */ -void lv_line_set_upscale(lv_obj_t * line, bool unscale_en); - /** * Set the style of a line * @param line pointer to a line object @@ -114,13 +106,6 @@ bool lv_line_get_auto_size(lv_obj_t * line); */ bool lv_line_get_y_inv(lv_obj_t * line); -/** - * Get the point upscale enable attribute - * @param obj pointer to a line object - * @return true: point coordinate upscale is enabled, false: disabled - */ -bool lv_line_get_upscale(lv_obj_t * line); - /** * Get the style of an line object * @param line pointer to an line object diff --git a/lv_objx/lv_list.c b/lv_objx/lv_list.c index b21766bab..d1a226941 100644 --- a/lv_objx/lv_list.c +++ b/lv_objx/lv_list.c @@ -20,7 +20,7 @@ *********************/ #define LV_LIST_LAYOUT_DEF LV_LAYOUT_COL_M -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION # ifndef LV_LIST_FOCUS_TIME # define LV_LIST_FOCUS_TIME 100 /*Animation time of focusing to the a list element [ms] (0: no animation) */ # endif @@ -379,7 +379,7 @@ void lv_list_up(lv_obj_t * list) if(ext->anim_time == 0) { lv_obj_set_y(scrl, new_y); } else { -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION lv_anim_t a; a.var = scrl; a.start = lv_obj_get_y(scrl); @@ -422,7 +422,7 @@ void lv_list_down(lv_obj_t * list) if(ext->anim_time == 0) { lv_obj_set_y(scrl, new_y); } else { -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION lv_anim_t a; a.var = scrl; a.start = lv_obj_get_y(scrl); diff --git a/lv_objx/lv_lmeter.c b/lv_objx/lv_lmeter.c index 922fd73e2..10a726f05 100644 --- a/lv_objx/lv_lmeter.c +++ b/lv_objx/lv_lmeter.c @@ -242,10 +242,10 @@ static bool lv_lmeter_design(lv_obj_t * lmeter, const lv_area_t * mask, lv_desig memcpy(&style_tmp, style, sizeof(lv_style_t)); -#if LV_OBJ_GROUP +#if USE_LV_GROUP lv_group_t *g = lv_obj_get_group(lmeter); if(lv_group_get_focused(g) == lmeter) { - style_tmp.line.width += 1 << LV_ANTIALIAS; + style_tmp.line.width += 1; } #endif diff --git a/lv_objx/lv_mbox.c b/lv_objx/lv_mbox.c index 9825dd9f7..c1d485f49 100644 --- a/lv_objx/lv_mbox.c +++ b/lv_objx/lv_mbox.c @@ -20,7 +20,7 @@ * DEFINES *********************/ -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION # ifndef LV_MBOX_CLOSE_ANIM_TIME # define LV_MBOX_CLOSE_ANIM_TIME 200 /*List close animation time) */ # endif @@ -200,7 +200,7 @@ void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t delay) { lv_mbox_ext_t * ext = lv_obj_get_ext_attr(mbox); -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION if(ext->anim_time != 0) { /*Add shrinking animations*/ lv_obj_animate(mbox, LV_ANIM_GROW_H| LV_ANIM_OUT, ext->anim_time, delay, NULL); @@ -222,7 +222,7 @@ void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t delay) */ void lv_mbox_stop_auto_close(lv_obj_t * mbox) { -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION lv_anim_del(mbox, NULL); #endif } diff --git a/lv_objx/lv_page.c b/lv_objx/lv_page.c index 5f3298011..9b1f25ee4 100644 --- a/lv_objx/lv_page.c +++ b/lv_objx/lv_page.c @@ -313,7 +313,7 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, uint16_t anim_time) lv_obj_set_y(ext->scrl, scrlable_y); } else { -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION lv_anim_t a; a.act_time = 0; a.start = lv_obj_get_y(ext->scrl); @@ -412,7 +412,7 @@ static bool lv_scrl_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mo if(mode == LV_DESIGN_COVER_CHK) { return ancestor_design(scrl, mask, mode); } else if(mode == LV_DESIGN_DRAW_MAIN) { -#if LV_OBJ_GROUP +#if USE_LV_GROUP /* If the page is the active in a group and * the background (page) is not visible (transparent or empty) * then activate the style of the scrollable*/ @@ -430,7 +430,7 @@ static bool lv_scrl_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mo #endif ancestor_design(scrl, mask, mode); -#if LV_OBJ_GROUP +#if USE_LV_GROUP scrl->style_p = style_ori; /*Revert the style*/ #endif } else if(mode == LV_DESIGN_DRAW_POST) { diff --git a/lv_objx/lv_roller.c b/lv_objx/lv_roller.c index bae383436..3155bd196 100644 --- a/lv_objx/lv_roller.c +++ b/lv_objx/lv_roller.c @@ -429,7 +429,7 @@ static void refr_position(lv_obj_t *roller, bool anim_en) if(ext->ddlist.anim_time == 0 || anim_en == false) { lv_obj_set_y(roller_scrl, new_y); } else { -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION lv_anim_t a; a.var = roller_scrl; a.start = lv_obj_get_y(roller_scrl); diff --git a/lv_objx/lv_slider.c b/lv_objx/lv_slider.c index b4662e955..c76107303 100644 --- a/lv_objx/lv_slider.c +++ b/lv_objx/lv_slider.c @@ -18,7 +18,7 @@ /********************* * DEFINES *********************/ -#define LV_SLIDER_SIZE_MIN (4 << LV_ANTIALIAS) /*hpad and vpad cannot make the bar or indicator smaller then this [px]*/ +#define LV_SLIDER_SIZE_MIN 4 /*hor. pad and ver. pad cannot make the bar or indicator smaller then this [px]*/ #define LV_SLIDER_NOT_PRESSED INT16_MIN /********************** diff --git a/lv_objx/lv_ta.c b/lv_objx/lv_ta.c index 3b81b7844..3b1378378 100644 --- a/lv_objx/lv_ta.c +++ b/lv_objx/lv_ta.c @@ -139,7 +139,7 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy) lv_obj_refresh_style(new_ta); } -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION /*Create a cursor blinker animation*/ lv_anim_t a; a.var = new_ta; @@ -186,7 +186,7 @@ void lv_ta_add_char(lv_obj_t * ta, char c) lv_mem_assert(ext->pwd_tmp); lv_txt_ins(ext->pwd_tmp, ext->cursor.pos, letter_buf); -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION /*Auto hide characters*/ lv_anim_t a; a.var = ta; @@ -229,7 +229,7 @@ void lv_ta_add_text(lv_obj_t * ta, const char * txt) lv_txt_ins(ext->pwd_tmp, ext->cursor.pos, txt); -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION /*Auto hide characters*/ lv_anim_t a; a.var = ta; @@ -315,7 +315,7 @@ void lv_ta_set_text(lv_obj_t * ta, const char * txt) ext->pwd_tmp = lv_mem_realloc(ext->pwd_tmp, strlen(txt) + 1); strcpy(ext->pwd_tmp, txt); -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION /*Auto hide characters*/ lv_anim_t a; a.var = ta; @@ -388,7 +388,7 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos) ext->cursor.valid_x = cur_pos.x; -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION /*Reset cursor blink animation*/ lv_anim_t a; a.var = ta; @@ -774,13 +774,13 @@ static bool lv_ta_scrollable_design(lv_obj_t * scrl, const lv_area_t * mask, lv_ cur_style.body.grad_color = clv_color_tmp; cur_style.body.border.color = clv_color_tmp; cur_style.body.border.opa = LV_OPA_COVER; - cur_style.body.border.width = 1 << LV_ANTIALIAS; + cur_style.body.border.width = 1; cur_style.body.shadow.width = 0; cur_style.body.radius = 0; cur_style.body.empty = 0; cur_style.body.padding.hor = 0; cur_style.body.padding.ver = 0; - cur_style.line.width = 1 << LV_ANTIALIAS; + cur_style.line.width = 1; cur_style.body.opa = LV_OPA_COVER; } @@ -859,7 +859,7 @@ static bool lv_ta_scrollable_design(lv_obj_t * scrl, const lv_area_t * mask, lv_ cur_area.y2 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.ver+ letter_h; cur_style.body.empty = 1; - if(cur_style.body.border.width == 0) cur_style.body.border.width = 1 << LV_ANTIALIAS; /*Be sure the border will be drawn*/ + if(cur_style.body.border.width == 0) cur_style.body.border.width = 1; /*Be sure the border will be drawn*/ lv_draw_rect(&cur_area, mask, &cur_style); } else if(ta_ext->cursor.type == LV_CURSOR_UNDERLINE) { cur_area.x1 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.hor; diff --git a/lv_objx/lv_tabview.c b/lv_objx/lv_tabview.c index 808fdf3fa..0248bca9c 100644 --- a/lv_objx/lv_tabview.c +++ b/lv_objx/lv_tabview.c @@ -17,7 +17,7 @@ /********************* * DEFINES *********************/ -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION # ifndef LV_TABVIEW_ANIM_TIME # define LV_TABVIEW_ANIM_TIME 100 /*Animation time of focusing to the a list element [ms] (0: no animation) */ # endif @@ -249,7 +249,7 @@ void lv_tabview_set_current_tab(lv_obj_t * tabview, uint16_t id, bool anim_en) if(ext->anim_time == 0 || anim_en == false) { lv_obj_set_x(ext->content, cont_x); } else { -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION lv_anim_t a; a.var = ext->content; a.start = lv_obj_get_x(ext->content); @@ -275,7 +275,7 @@ void lv_tabview_set_current_tab(lv_obj_t * tabview, uint16_t id, bool anim_en) if(ext->anim_time == 0 || anim_en == false ) { lv_obj_set_x(ext->indic, indic_x); } else { -#if LV_NO_ANIM == 0 +#if USE_LV_ANIMATION lv_anim_t a; a.var = ext->indic; a.start = lv_obj_get_x(ext->indic); diff --git a/lv_objx/lv_win.c b/lv_objx/lv_win.c index 96c81ffc5..e7e2d4ad4 100644 --- a/lv_objx/lv_win.c +++ b/lv_objx/lv_win.c @@ -492,7 +492,7 @@ static void lv_win_realign(lv_obj_t * win) lv_obj_align(ext->title, NULL, LV_ALIGN_IN_LEFT_MID, ext->style_header->body.padding.hor, 0); - lv_obj_set_pos_scale(ext->header, 0, 0); + lv_obj_set_pos(ext->header, 0, 0); lv_obj_set_size( ext->page, lv_obj_get_width(win), lv_obj_get_height(win) - lv_obj_get_height(ext->header)); lv_obj_align( ext->page, ext->header, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0); diff --git a/lv_themes/lv_theme_alien.c b/lv_themes/lv_theme_alien.c index b1a7327dc..e8b02085a 100644 --- a/lv_themes/lv_theme_alien.c +++ b/lv_themes/lv_theme_alien.c @@ -82,7 +82,7 @@ static void basic_init(void) def.body.padding.ver = LV_DPI / 8; def.body.padding.inner = LV_DPI / 8; def.body.border.color = LV_COLOR_SILVER; - def.body.border.width = 1 << LV_ANTIALIAS; + def.body.border.width = 1; def.body.border.opa = LV_OPA_COVER; def.body.shadow.color = LV_COLOR_SILVER; def.body.shadow.width = 0; @@ -90,20 +90,20 @@ static void basic_init(void) def.text.color = LV_COLOR_HEX3(0xDDD); def.text.font = _font; - def.text.letter_space = 1 << LV_ANTIALIAS; - def.text.line_space = 2 << LV_ANTIALIAS; + def.text.letter_space = 1; + def.text.line_space = 2; def.image.color = LV_COLOR_HEX3(0xDDD); def.image.intense = LV_OPA_TRANSP; def.line.color = LV_COLOR_HEX3(0xDDD); - def.line.width = 1 << LV_ANTIALIAS; + def.line.width = 1; /*Background*/ lv_style_copy(&bg, &def); bg.body.main_color = LV_COLOR_HEX3(0x333); bg.body.grad_color = LV_COLOR_HEX3(0x333); - bg.body.border.width = 2 << LV_ANTIALIAS; + bg.body.border.width = 2; bg.body.border.color = LV_COLOR_HEX3(0x666); bg.body.shadow.color = LV_COLOR_SILVER; @@ -113,7 +113,7 @@ static void basic_init(void) panel.body.main_color = LV_COLOR_HEX3(0x666); panel.body.grad_color = LV_COLOR_HEX3(0x666); panel.body.border.color = LV_COLOR_HEX3(0xccc); - panel.body.border.width = 2 << LV_ANTIALIAS; + panel.body.border.width = 2; panel.body.border.opa = LV_OPA_60; panel.text.color = lv_color_hsv_to_rgb(_hue, 8, 96); panel.line.color = lv_color_hsv_to_rgb(_hue, 20, 70); @@ -124,11 +124,11 @@ static void basic_init(void) sb.body.radius = LV_RADIUS_CIRCLE; sb.body.border.color = LV_COLOR_SILVER; sb.body.border.opa = LV_OPA_40; - sb.body.border.width = 1 << LV_ANTIALIAS; + sb.body.border.width = 1; sb.body.main_color = lv_color_hsv_to_rgb(_hue, 33, 92); sb.body.grad_color = lv_color_hsv_to_rgb(_hue, 33, 92); - sb.body.padding.hor = 1 << LV_ANTIALIAS; - sb.body.padding.ver = 1 << LV_ANTIALIAS; + sb.body.padding.hor = 1; + sb.body.padding.ver = 1; sb.body.padding.inner = LV_DPI / 15; /*Scrollbar width*/ theme.bg = &bg; @@ -143,7 +143,7 @@ static void btn_init(void) btn_rel.glass = 0; btn_rel.body.empty = 1; btn_rel.body.radius = LV_RADIUS_CIRCLE; - btn_rel.body.border.width = 2 << LV_ANTIALIAS; + btn_rel.body.border.width = 2; btn_rel.body.border.color = lv_color_hsv_to_rgb(_hue, 70, 90); btn_rel.body.border.opa = LV_OPA_80; btn_rel.body.padding.hor = LV_DPI / 4; @@ -226,7 +226,7 @@ static void bar_init(void) bar_bg.body.radius = LV_RADIUS_CIRCLE; bar_bg.body.main_color = LV_COLOR_WHITE; bar_bg.body.grad_color = LV_COLOR_SILVER; - bar_bg.body.border.width = 2 << LV_ANTIALIAS; + bar_bg.body.border.width = 2; bar_bg.body.border.color = LV_COLOR_SILVER; bar_bg.body.border.opa = LV_OPA_20; bar_bg.body.padding.hor = 0; @@ -235,7 +235,7 @@ static void bar_init(void) lv_style_copy(&bar_indic, &def); bar_indic.body.radius = LV_RADIUS_CIRCLE; - bar_indic.body.border.width = 2 << LV_ANTIALIAS; + bar_indic.body.border.width = 2; bar_indic.body.border.color = LV_COLOR_SILVER; bar_indic.body.border.opa = LV_OPA_70; bar_indic.body.padding.hor = 0; @@ -272,7 +272,7 @@ static void line_init(void) static lv_style_t line_decor; lv_style_copy(&line_decor, &def); line_decor.line.color = lv_color_hsv_to_rgb(_hue, 50, 50); - line_decor.line.width = 1 << LV_ANTIALIAS; + line_decor.line.width = 1; theme.line.decor = &line_decor; #endif @@ -304,7 +304,7 @@ static void slider_init(void) slider_knob.body.radius = LV_RADIUS_CIRCLE; slider_knob.body.main_color = LV_COLOR_WHITE; slider_knob.body.grad_color = LV_COLOR_SILVER; - slider_knob.body.border.width = 1 << LV_ANTIALIAS; + slider_knob.body.border.width = 1; slider_knob.body.border.color = LV_COLOR_GRAY; slider_knob.body.border.opa = LV_OPA_50; @@ -320,11 +320,11 @@ static void sw_init(void) static lv_style_t sw_bg, sw_indic, sw_knob; lv_style_copy(&sw_bg, &bar_bg); sw_bg.body.opa = LV_OPA_COVER; - sw_bg.body.padding.ver = -2 << LV_ANTIALIAS; - sw_bg.body.padding.hor = -2 << LV_ANTIALIAS; + sw_bg.body.padding.ver = -2 ; + sw_bg.body.padding.hor = -2 ; sw_bg.body.main_color = LV_COLOR_HEX3(0x666); sw_bg.body.grad_color = LV_COLOR_HEX3(0x999); - sw_bg.body.border.width = 2 << LV_ANTIALIAS; + sw_bg.body.border.width = 2; sw_bg.body.border.opa = LV_OPA_50; lv_style_copy(&sw_indic, &bar_indic); @@ -351,7 +351,7 @@ static void lmeter_init(void) lmeter_bg.body.grad_color = lv_color_hsv_to_rgb(_hue, 80, 80); lmeter_bg.body.padding.hor = LV_DPI / 8; /*Scale line length*/ lmeter_bg.line.color = LV_COLOR_HEX3(0x222); - lmeter_bg.line.width = 2 << LV_ANTIALIAS; + lmeter_bg.line.width = 2; theme.lmeter = &lmeter_bg; @@ -370,7 +370,7 @@ static void gauge_init(void) gauge_bg.body.padding.inner = LV_DPI / 8; /*Label - scale distance*/ gauge_bg.body.border.color = LV_COLOR_HEX3(0x777); gauge_bg.line.color = LV_COLOR_HEX3(0x555); - gauge_bg.line.width = 2 << LV_ANTIALIAS; + gauge_bg.line.width = 2; gauge_bg.text.color = lv_color_hsv_to_rgb(_hue, 10, 90); gauge_bg.text.font = _font; @@ -391,7 +391,7 @@ static void cb_init(void) static lv_style_t cb_bg, cb_rel, cb_pr, cb_trel, cb_tpr, cb_ina; lv_style_copy(&cb_rel, &bg); cb_rel.body.radius = LV_DPI / 20; - cb_rel.body.border.width = 1 << LV_ANTIALIAS; + cb_rel.body.border.width = 1; cb_rel.body.border.color = LV_COLOR_GRAY; cb_rel.body.main_color = LV_COLOR_WHITE; cb_rel.body.grad_color = LV_COLOR_SILVER; @@ -409,7 +409,7 @@ static void cb_init(void) cb_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 82); lv_style_copy(&cb_trel, &cb_rel); - cb_trel.body.border.width = 4 << LV_ANTIALIAS; + cb_trel.body.border.width = 4; cb_trel.body.border.color = LV_COLOR_WHITE; cb_trel.body.border.opa = LV_OPA_60; cb_trel.body.main_color = lv_color_hsv_to_rgb(_hue, 50, 82); @@ -422,7 +422,7 @@ static void cb_init(void) cb_tpr.body.grad_color = lv_color_hsv_to_rgb(_hue, 50, 52); lv_style_copy(&cb_ina, &cb_trel); - cb_ina.body.border.width = 1 << LV_ANTIALIAS; + cb_ina.body.border.width = 1; cb_ina.body.border.color = LV_COLOR_GRAY; cb_ina.body.main_color = LV_COLOR_SILVER; cb_ina.body.grad_color = LV_COLOR_SILVER; @@ -441,7 +441,7 @@ static void btnm_init(void) { #if USE_LV_BTNM lv_style_copy(&btnm_bg, &lv_style_transp_tight); - btnm_bg.body.border.width = 1 << LV_ANTIALIAS; + btnm_bg.body.border.width = 1; btnm_bg.body.border.color = lv_color_hsv_to_rgb(_hue, 60, 80); btnm_bg.body.border.opa = LV_OPA_COVER; btnm_bg.body.radius = LV_DPI / 8; @@ -461,7 +461,7 @@ static void btnm_init(void) lv_style_copy(&btnm_trel, &btnm_rel); btnm_trel.body.border.color = lv_color_hsv_to_rgb(_hue, 80, 80); - btnm_trel.body.border.width = 3 << LV_ANTIALIAS; + btnm_trel.body.border.width = 3; lv_style_copy(&btnm_ina, &btnm_rel); btnm_ina.text.color = lv_color_hsv_to_rgb(_hue, 10, 60); @@ -527,7 +527,7 @@ static void list_init(void) static lv_style_t list_bg, list_rel, list_pr, list_trel, list_tpr, list_ina; lv_style_copy(&list_rel, &def); list_rel.body.empty = 1; - list_rel.body.border.width = 1 << LV_ANTIALIAS; + list_rel.body.border.width = 1; list_rel.body.border.color = lv_color_hsv_to_rgb(_hue, 50, 85); list_rel.body.border.opa = LV_OPA_COVER; list_rel.text.color = lv_color_hsv_to_rgb(_hue, 10, 94); @@ -612,7 +612,7 @@ static void tabview_init(void) tab_rel.body.padding.hor = 0; tab_rel.body.padding.ver = LV_DPI / 6; tab_rel.body.padding.inner = 0; - tab_rel.body.border.width = 1 << LV_ANTIALIAS; + tab_rel.body.border.width = 1; tab_rel.body.border.color = LV_COLOR_SILVER; tab_rel.body.border.opa = LV_OPA_40; tab_rel.text.color = LV_COLOR_HEX3(0xDDD); @@ -627,7 +627,7 @@ static void tabview_init(void) tab_trel.body.padding.hor = 0; tab_trel.body.padding.ver = LV_DPI / 6; tab_trel.body.padding.inner = 0; - tab_trel.body.border.width = 1 << LV_ANTIALIAS; + tab_trel.body.border.width = 1; tab_trel.body.border.color = LV_COLOR_SILVER; tab_trel.body.border.opa = LV_OPA_40; tab_trel.text.color = lv_color_hsv_to_rgb(_hue, 10, 94); @@ -639,7 +639,7 @@ static void tabview_init(void) tab_tpr.body.padding.hor = 0; tab_tpr.body.padding.ver = LV_DPI / 6; tab_tpr.body.padding.inner = 0; - tab_tpr.body.border.width = 1 << LV_ANTIALIAS; + tab_tpr.body.border.width = 1; tab_tpr.body.border.color = LV_COLOR_SILVER; tab_tpr.body.border.opa = LV_OPA_40; tab_tpr.text.color = lv_color_hsv_to_rgb(_hue, 10, 94); diff --git a/lv_themes/lv_theme_default.c b/lv_themes/lv_theme_default.c index 2c90838f0..4651ecdd7 100644 --- a/lv_themes/lv_theme_default.c +++ b/lv_themes/lv_theme_default.c @@ -60,7 +60,7 @@ static void basic_init(void) sb.body.padding.ver = sb.body.padding.ver / 2; lv_style_copy(&plain_bordered, &lv_style_plain); - plain_bordered.body.border.width = 2 << LV_ANTIALIAS; + plain_bordered.body.border.width = 2; plain_bordered.body.border.color= LV_COLOR_HEX3(0xbbb); theme.bg = &lv_style_plain; @@ -160,8 +160,8 @@ static void sw_init(void) { #if USE_LV_SW != 0 lv_style_copy(&sw_bg, &lv_style_pretty); - sw_bg.body.padding.hor = 3 << LV_ANTIALIAS; - sw_bg.body.padding.ver = 3 << LV_ANTIALIAS; + sw_bg.body.padding.hor = 3; + sw_bg.body.padding.ver = 3; theme.sw.bg = &sw_bg; theme.sw.indic = &lv_style_pretty_color; @@ -177,7 +177,7 @@ static void lmeter_init(void) lv_style_copy(&lmeter, &lv_style_pretty_color); lmeter.line.color = LV_COLOR_HEX3(0xddd); - lmeter.line.width = 2 << LV_ANTIALIAS; + lmeter.line.width = 2; lmeter.body.main_color = color_mix(lmeter.body.main_color , LV_COLOR_WHITE, LV_OPA_50); lmeter.body.grad_color = color_mix(lmeter.body.grad_color , LV_COLOR_BLACK, LV_OPA_50); diff --git a/lv_themes/lv_theme_mono.c b/lv_themes/lv_theme_mono.c index 182318f5e..ac363770b 100644 --- a/lv_themes/lv_theme_mono.c +++ b/lv_themes/lv_theme_mono.c @@ -58,18 +58,18 @@ static void basic_init(void) def.body.padding.ver = LV_DPI / 10; def.body.padding.inner = LV_DPI / 10; def.body.border.color = LV_COLOR_BLACK; - def.body.border.width = 1 << LV_AA; + def.body.border.width = 1; def.body.border.opa = LV_OPA_COVER; def.body.border.part = LV_BORDER_FULL; def.text.font = _font; def.text.color = LV_COLOR_BLACK; - def.text.letter_space = 1 << LV_AA; - def.text.line_space = 1 << LV_AA; + def.text.letter_space = 1; + def.text.line_space = 1; def.line.color = LV_COLOR_BLACK; def.line.opa = LV_OPA_COVER; - def.line.width = 1 << LV_AA; + def.line.width = 1; def.image.color = LV_COLOR_BLACK; def.image.intense = LV_OPA_TRANSP; diff --git a/lv_themes/lv_theme_night.c b/lv_themes/lv_theme_night.c index 8e286710f..017027f04 100644 --- a/lv_themes/lv_theme_night.c +++ b/lv_themes/lv_theme_night.c @@ -75,12 +75,12 @@ static void basic_init(void) panel.body.grad_color = lv_color_hsv_to_rgb(_hue, 11, 18); panel.body.radius = LV_DPI / 20; panel.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 25); - panel.body.border.width = 1 << LV_AA; + panel.body.border.width = 1; panel.body.border.opa = LV_OPA_COVER; panel.body.padding.ver = LV_DPI / 10; panel.body.padding.hor = LV_DPI / 10; panel.line.color = lv_color_hsv_to_rgb(_hue, 20, 40); - panel.line.width = 1 << LV_AA; + panel.line.width = 1; theme.bg = &bg; theme.panel = &def; } @@ -101,7 +101,7 @@ static void btn_init(void) btn_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 40); btn_rel.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 20); btn_rel.body.border.color = LV_COLOR_HEX3(0x111); - btn_rel.body.border.width = 1 << LV_AA; + btn_rel.body.border.width = 1; btn_rel.body.border.opa = LV_OPA_70; btn_rel.body.padding.hor = LV_DPI / 4; btn_rel.body.padding.ver = LV_DPI / 8; @@ -209,7 +209,7 @@ static void bar_init(void) bar_indic.body.main_color = lv_color_hsv_to_rgb(_hue, 80, 70); bar_indic.body.grad_color = lv_color_hsv_to_rgb(_hue, 80, 70); bar_indic.body.border.color = lv_color_hsv_to_rgb(_hue, 20, 15); - bar_indic.body.border.width = 1 << LV_AA; + bar_indic.body.border.width = 1; bar_indic.body.border.opa = LV_OPA_COVER; bar_indic.body.radius = LV_RADIUS_CIRCLE; bar_indic.body.padding.hor = 0; @@ -291,13 +291,13 @@ static void cb_init(void) rel.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 95); rel.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 95); rel.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 50); - rel.body.border.width = 2 << LV_AA;; + rel.body.border.width = 2;; lv_style_copy(&pr, &rel); pr.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 80); pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 80); pr.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 20); - pr.body.border.width = 1 << LV_AA;; + pr.body.border.width = 1;; lv_style_copy(&tgl_rel, &rel); tgl_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 80, 90); @@ -308,7 +308,7 @@ static void cb_init(void) tgl_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 80, 70); tgl_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 80, 70); tgl_pr.body.border.color = lv_color_hsv_to_rgb(_hue, 80, 30); - tgl_pr.body.border.width = 1 << LV_AA;; + tgl_pr.body.border.width = 1;; lv_style_copy(&ina, &rel); @@ -332,34 +332,34 @@ static void btnm_init(void) static lv_style_t btnm_bg, rel, pr, tgl_rel, tgl_pr, ina; lv_style_copy(&btnm_bg, &btn_rel); - btnm_bg.body.padding.hor = 2 << LV_AA; - btnm_bg.body.padding.ver = 2 << LV_AA; + btnm_bg.body.padding.hor = 2; + btnm_bg.body.padding.ver = 2; btnm_bg.body.padding.inner = 0; btnm_bg.body.border.width = 1<< LV_AA;//LV_BORDER_RIGHT; lv_style_copy(&rel, &btn_rel); rel.body.border.part = LV_BORDER_RIGHT; - rel.body.border.width = 2 << LV_AA; + rel.body.border.width = 2; rel.body.radius = 0; lv_style_copy(&pr, &btn_pr); pr.body.border.part = LV_BORDER_RIGHT; - pr.body.border.width = 2 << LV_AA; + pr.body.border.width = 2; pr.body.radius = 0; lv_style_copy(&tgl_rel, &btn_tgl_rel); tgl_rel.body.border.part = LV_BORDER_RIGHT; - tgl_rel.body.border.width = 2 << LV_AA; + tgl_rel.body.border.width = 2; tgl_rel.body.radius = 0; lv_style_copy(&tgl_pr, &btn_tgl_pr); tgl_pr.body.border.part = LV_BORDER_RIGHT; - tgl_pr.body.border.width = 2 << LV_AA; + tgl_pr.body.border.width = 2; tgl_pr.body.radius = 0; lv_style_copy(&ina, &btn_ina); ina.body.border.part = LV_BORDER_RIGHT; - ina.body.border.width = 2 << LV_AA; + ina.body.border.width = 2; ina.body.radius = 0; theme.btnm.bg = &btnm_bg; @@ -392,7 +392,7 @@ static void mbox_init(void) mbox_bg.body.main_color = lv_color_hsv_to_rgb(_hue, 30, 30); mbox_bg.body.grad_color = lv_color_hsv_to_rgb(_hue, 30, 30); mbox_bg.body.border.color = lv_color_hsv_to_rgb(_hue, 11, 20); - mbox_bg.body.border.width = 1 << LV_AA; + mbox_bg.body.border.width = 1; mbox_bg.body.shadow.width = LV_DPI / 10; mbox_bg.body.shadow.color = LV_COLOR_HEX3(0x222); mbox_bg.body.radius = LV_DPI / 20; @@ -412,7 +412,7 @@ static void page_init(void) page_scrl.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 40); page_scrl.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 40); page_scrl.body.border.color = LV_COLOR_HEX3(0x333); - page_scrl.body.border.width = 1 << LV_AA; + page_scrl.body.border.width = 1; page_scrl.body.radius = LV_DPI / 20; @@ -446,7 +446,7 @@ static void list_init(void) list_btn_rel.body.empty = 1; list_btn_rel.body.border.part = LV_BORDER_BOTTOM; list_btn_rel.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 5); - list_btn_rel.body.border.width = 1 << LV_AA; + list_btn_rel.body.border.width = 1; list_btn_rel.body.radius = LV_DPI / 10; list_btn_rel.text.color = lv_color_hsv_to_rgb(_hue, 5, 80); list_btn_rel.body.padding.ver = LV_DPI / 6; @@ -539,7 +539,7 @@ static void win_init(void) static lv_style_t win_bg; lv_style_copy(&win_bg, &bg); win_bg.body.border.color = LV_COLOR_HEX3(0x333); - win_bg.body.border.width = 1 << LV_AA; + win_bg.body.border.width = 1; static lv_style_t win_header; lv_style_copy(&win_header, &win_bg);