From 7db7482ac58b6b11146816d244f4aac00dc81087 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 21 Jun 2018 22:15:19 +0200 Subject: [PATCH] fixes in lv_roller, lv_ddlist design to be pixel prefect --- lv_objx/lv_ddlist.c | 4 ++-- lv_objx/lv_roller.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lv_objx/lv_ddlist.c b/lv_objx/lv_ddlist.c index ce4985ea8..89e5e601d 100644 --- a/lv_objx/lv_ddlist.c +++ b/lv_objx/lv_ddlist.c @@ -448,7 +448,7 @@ static bool lv_ddlist_design(lv_obj_t * ddlist, const lv_area_t * mask, lv_desig rect_area.y1 += ext->sel_opt_id * (font_h + style->text.line_space); rect_area.y1 -= style->text.line_space / 2; - rect_area.y2 = rect_area.y1 + font_h + style->text.line_space; + rect_area.y2 = rect_area.y1 + font_h + style->text.line_space - 1; rect_area.x1 = ddlist->coords.x1; rect_area.x2 = ddlist->coords.x2; @@ -474,7 +474,7 @@ static bool lv_ddlist_design(lv_obj_t * ddlist, const lv_area_t * mask, lv_desig area_sel.y1 += ext->sel_opt_id * (font_h + style->text.line_space); area_sel.y1 -= style->text.line_space / 2; - area_sel.y2 = area_sel.y1 + font_h + style->text.line_space; + area_sel.y2 = area_sel.y1 + font_h + style->text.line_space - 1; area_sel.x1 = ddlist->coords.x1; area_sel.x2 = ddlist->coords.x2; lv_area_t mask_sel; diff --git a/lv_objx/lv_roller.c b/lv_objx/lv_roller.c index 3fed3e2bb..c23db3576 100644 --- a/lv_objx/lv_roller.c +++ b/lv_objx/lv_roller.c @@ -228,7 +228,8 @@ static bool lv_roller_design(lv_obj_t * roller, const lv_area_t * mask, lv_desig lv_coord_t font_h = lv_font_get_height(font); lv_area_t rect_area; rect_area.y1 = roller->coords.y1 + lv_obj_get_height(roller) / 2 - font_h / 2 - style->text.line_space / 2; - rect_area.y2 = rect_area.y1 + font_h + style->text.line_space; + if((font_h & 0x1) && (style->text.line_space & 0x1)) rect_area.y1 --; /*Compensate the two rounding error*/ + rect_area.y2 = rect_area.y1 + font_h + style->text.line_space - 1; rect_area.x1 = roller->coords.x1; rect_area.x2 = roller->coords.x2; @@ -244,7 +245,8 @@ static bool lv_roller_design(lv_obj_t * roller, const lv_area_t * mask, lv_desig /*Redraw the text on the selected area with a different color*/ lv_area_t rect_area; rect_area.y1 = roller->coords.y1 + lv_obj_get_height(roller) / 2 - font_h / 2 - style->text.line_space / 2; - rect_area.y2 = rect_area.y1 + font_h + style->text.line_space; + if((font_h & 0x1) && (style->text.line_space & 0x1)) rect_area.y1 --; /*Compensate the two rounding error*/ + rect_area.y2 = rect_area.y1 + font_h + style->text.line_space - 1; rect_area.x1 = roller->coords.x1; rect_area.x2 = roller->coords.x2; lv_area_t mask_sel;