Hide anti aliasing. No x << LV_AA rewuired from now

This commit is contained in:
Gabor Kiss-Vamosi
2017-12-07 19:22:23 +01:00
parent 8bd9ab7b84
commit 893475ad89
41 changed files with 373 additions and 388 deletions

View File

@@ -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

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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);

View File

@@ -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
}

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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

View File

@@ -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);

View File

@@ -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

View File

@@ -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
}

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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
/**********************

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);