Skip to content

Commit

Permalink
lv_canvas: disable anti alaising when drawing with transparent color …
Browse files Browse the repository at this point in the history
…to chroma keyed canvas
  • Loading branch information
kisvegabor committed Jul 25, 2019
1 parent bf2453c commit 6d2bbf2
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/lv_objx/lv_canvas.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,15 @@ void lv_canvas_draw_rect(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord
disp.driver.hor_res = dsc->header.w;
disp.driver.ver_res = dsc->header.h;

/*Disable anti-aliasing if drawing with transparent color to chroma keyed canvas*/
lv_color_t ctransp = LV_COLOR_TRANSP;
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED &&
style->body.main_color.full == ctransp.full &&
style->body.grad_color.full == ctransp.full)
{
disp.driver.antialiasing = 0;
}

lv_disp_t * refr_ori = lv_refr_get_disp_refreshing();
lv_refr_set_disp_refreshing(&disp);

Expand Down Expand Up @@ -633,6 +642,15 @@ void lv_canvas_draw_line(lv_obj_t * canvas, const lv_point_t * points, uint32_t
disp.driver.hor_res = dsc->header.w;
disp.driver.ver_res = dsc->header.h;

/*Disable anti-aliasing if drawing with transparent color to chroma keyed canvas*/
lv_color_t ctransp = LV_COLOR_TRANSP;
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED &&
style->body.main_color.full == ctransp.full &&
style->body.grad_color.full == ctransp.full)
{
disp.driver.antialiasing = 0;
}

lv_disp_t * refr_ori = lv_refr_get_disp_refreshing();
lv_refr_set_disp_refreshing(&disp);

Expand Down Expand Up @@ -676,6 +694,15 @@ void lv_canvas_draw_polygon(lv_obj_t * canvas, const lv_point_t * points, uint32
disp.driver.hor_res = dsc->header.w;
disp.driver.ver_res = dsc->header.h;

/*Disable anti-aliasing if drawing with transparent color to chroma keyed canvas*/
lv_color_t ctransp = LV_COLOR_TRANSP;
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED &&
style->body.main_color.full == ctransp.full &&
style->body.grad_color.full == ctransp.full)
{
disp.driver.antialiasing = 0;
}

lv_disp_t * refr_ori = lv_refr_get_disp_refreshing();
lv_refr_set_disp_refreshing(&disp);

Expand Down Expand Up @@ -720,6 +747,15 @@ void lv_canvas_draw_arc(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord_
disp.driver.hor_res = dsc->header.w;
disp.driver.ver_res = dsc->header.h;

/*Disable anti-aliasing if drawing with transparent color to chroma keyed canvas*/
lv_color_t ctransp = LV_COLOR_TRANSP;
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED &&
style->body.main_color.full == ctransp.full &&
style->body.grad_color.full == ctransp.full)
{
disp.driver.antialiasing = 0;
}

lv_disp_t * refr_ori = lv_refr_get_disp_refreshing();
lv_refr_set_disp_refreshing(&disp);

Expand Down

0 comments on commit 6d2bbf2

Please sign in to comment.