fix (draw_mask) fix << on negative value

Fixes https://github.com/lvgl/lvgl/issues/2144#issuecomment-811764356
This commit is contained in:
Gabor Kiss-Vamosi
2021-04-01 12:10:46 +02:00
parent bc081f6ef3
commit ffb875ed17

View File

@@ -490,6 +490,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_b
lv_coord_t len,
lv_draw_mask_line_param_t * p)
{
int32_t y_at_x;
y_at_x = (int32_t)((int32_t)p->yx_steep * abs_x) >> 10;
@@ -538,9 +539,12 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_b
}
}
if(abs_y < 0) {
printf("asd\n");
}
int32_t xe;
if(p->yx_steep > 0) xe = ((abs_y << 8) * p->xy_steep) >> 10;
else xe = (((abs_y + 1) << 8) * p->xy_steep) >> 10;
if(p->yx_steep > 0) xe = ((abs_y * 256) * p->xy_steep) >> 10;
else xe = (((abs_y + 1) * 256) * p->xy_steep) >> 10;
int32_t xei = xe >> 8;
int32_t xef = xe & 0xFF;
@@ -633,12 +637,12 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_
}
/*X start*/
int32_t xs = ((abs_y << 8) * p->xy_steep) >> 10;
int32_t xs = ((abs_y * 256) * p->xy_steep) >> 10;
int32_t xsi = xs >> 8;
int32_t xsf = xs & 0xFF;
/*X end*/
int32_t xe = (((abs_y + 1) << 8) * p->xy_steep) >> 10;
int32_t xe = (((abs_y + 1) * 256) * p->xy_steep) >> 10;
int32_t xei = xe >> 8;
int32_t xef = xe & 0xFF;