1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

letter draw optimization: draw multiple lines at once

This commit is contained in:
Gabor Kiss-Vamosi 2019-08-26 07:18:08 +02:00
parent 68ded834bb
commit 50859a9660
2 changed files with 28 additions and 13 deletions

View File

@ -326,11 +326,16 @@ void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area, const
col_bit = bit_ofs & 0x7; /* "& 0x7" equals to "% 8" just faster */
lv_opa_t mask_buf[LV_HOR_RES_MAX];
lv_coord_t mask_p;
lv_coord_t mask_p = 0;
lv_area_t fill_area;
fill_area.x1 = col_start + pos_x;
fill_area.x2 = col_end + pos_x - 1;
fill_area.y1 = row_start + pos_y;
fill_area.y2 = fill_area.y1;
for(row = row_start ; row < row_end; row++) {
bitmask = bitmask_init >> col_bit;
mask_p = 0;
for(col = col_start; col < col_end; col++) {
letter_px = (*map_p & bitmask) >> (8 - col_bit - g.bpp);
if(letter_px != 0) {
@ -360,17 +365,17 @@ void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area, const
}
}
if(mask_p + (row_end - row_start) < sizeof(mask_buf)) {
fill_area.y2 ++;
} else {
lv_blend_fill(&vdb->area, clip_area, &fill_area,
vdb->buf_act, LV_IMG_CF_TRUE_COLOR, color,
mask_buf, LV_MASK_RES_CHANGED, opa, LV_BLIT_MODE_NORMAL);
lv_area_t fill_area;
fill_area.x1 = col_start + pos_x;
fill_area.x2 = col_end + pos_x - 1;
fill_area.y1 = row + pos_y;
fill_area.y2 = row + pos_y;
lv_blend_fill(&vdb->area, clip_area, &fill_area,
vdb->buf_act, LV_IMG_CF_TRUE_COLOR, color,
mask_buf, LV_MASK_RES_CHANGED, opa, LV_BLIT_MODE_NORMAL);
fill_area.y1 = fill_area.y2 + 1;
fill_area.y2 = fill_area.y1;
mask_p = 0;
}
col_bit += ((g.box_w - col_end) + col_start) * g.bpp;
@ -378,6 +383,16 @@ void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area, const
map_p += (col_bit >> 3);
col_bit = col_bit & 0x7;
}
/*Flush the last part*/
if(fill_area.y1 != fill_area.y2) {
fill_area.y2--;
lv_blend_fill(&vdb->area, clip_area, &fill_area,
vdb->buf_act, LV_IMG_CF_TRUE_COLOR, color,
mask_buf, LV_MASK_RES_CHANGED, opa, LV_BLIT_MODE_NORMAL);
mask_p = 0;
}
}
/**

View File

@ -209,7 +209,7 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
}
/*Draw the lowe corner area corner area*/
/*Draw the lower corner area corner area*/
lv_coord_t lower_corner_end = coords->y2 - disp_area->y1 - corner_size;
fill_area.y1 = disp_area->y1 + lower_corner_end;
fill_area.y2 = fill_area.y1;