Shrinking the gap between outer ring and inner preview a little

This commit is contained in:
Paul Peavyhouse
2019-10-02 21:14:28 -07:00
parent b49edd91a2
commit c74e6a6207
3 changed files with 22 additions and 8 deletions

View File

@@ -192,6 +192,19 @@ bool lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p)
return is_in;
}
/**
* Increment or decrement an area's size by a single amount
* @param a_p pointer to an area to grow
* @param amount amount to increment the area, or negative to decrement
*/
void lv_area_increment(lv_area_t * a_p, const lv_coord_t amount)
{
a_p->x1 -= amount;
a_p->y1 -= amount;
a_p->x2 += amount;
a_p->y2 += amount;
}
/**********************
* STATIC FUNCTIONS
**********************/

View File

@@ -165,6 +165,13 @@ bool lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p);
*/
bool lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p);
/**
* Increment or decrement an area's size by a single amount
* @param a_p pointer to an area to grow
* @param amount amount to increment the area, or negative to decrement
*/
void lv_area_increment(lv_area_t * a_p, const lv_coord_t amount);
/**********************
* MACROS
**********************/

View File

@@ -653,10 +653,7 @@ static void draw_disc_grad(lv_obj_t * cpicker, const lv_area_t * mask, lv_opa_t
style.body.radius = LV_RADIUS_CIRCLE;
lv_area_t area_mid;
lv_area_copy(&area_mid, &cpicker->coords);
area_mid.x1 += style_main->line.width;
area_mid.y1 += style_main->line.width;
area_mid.x2 -= style_main->line.width;
area_mid.y2 -= style_main->line.width;
lv_area_increment(&area_mid, -style_main->line.width);
lv_draw_rect(&area_mid, mask, &style, opa_scale);
@@ -664,10 +661,7 @@ static void draw_disc_grad(lv_obj_t * cpicker, const lv_area_t * mask, lv_opa_t
lv_color_t color = lv_cpicker_get_color(cpicker);
style.body.main_color = color;
style.body.grad_color = color;
area_mid.x1 += style_main->line.width;
area_mid.y1 += style_main->line.width;
area_mid.x2 -= style_main->line.width;
area_mid.y2 -= style_main->line.width;
lv_area_increment(&area_mid, -style_main->line.width / 2);
lv_draw_rect(&area_mid, mask, &style, opa_scale);
}