BigW Consortium Gitlab

Commit e98aa0f6 by Gabor

Draw speed optimalization

parent 615eceb9
......@@ -17,6 +17,7 @@
#include "misc/math/math_base.h"
#include "lv_draw_rbasic.h"
#include "lv_draw_vbasic.h"
#include "misc/fs/ufs/ufs.h"
/*********************
* DEFINES
......@@ -399,12 +400,31 @@ void lv_draw_img(const area_t * cords_p, const area_t * mask_p,
act_area.y1 &= ~(cord_t)(ds_num - 1) ;
act_area.y2 = act_area.y1 + ds_num - 1;
uint32_t act_pos;
color_t buf[LV_HOR_RES];
bool const_data = false;
if(fn[0] == UFS_LETTER) {
if(((ufs_file_t*)file.file_d)->ent->const_data != 0) {
const_data = true;
}
}
for(row = mask_sub.y1; row <= mask_sub.y2; row += ds_num) {
res = fs_read(&file, buf, useful_data, &br);
map_fp(&act_area, &mask_sub, buf, opa, header.transp, upscale,
imgs_p->objs.color, imgs_p->recolor_opa);
/*Get and use the pointer of const data in program memory*/
if(const_data != false) {
uint8_t * f_data = ((ufs_file_t*)file.file_d)->ent->data_d;
f_data += ((ufs_file_t*)file.file_d)->rwp;
((ufs_file_t*)file.file_d)->rwp += useful_data;
map_fp(&act_area, &mask_sub, (void*)f_data , opa, header.transp, upscale,
imgs_p->objs.color, imgs_p->recolor_opa);
}
/*Or read the NOT const files normally*/
else {
color_t buf[LV_HOR_RES];
res = fs_read(&file, buf, useful_data, &br);
map_fp(&act_area, &mask_sub, buf, opa, header.transp, upscale,
imgs_p->objs.color, imgs_p->recolor_opa);
}
fs_tell(&file, &act_pos);
fs_seek(&file, act_pos + next_row);
act_area.y1 += ds_num;
......
......@@ -74,11 +74,17 @@ void lv_vfill(const area_t * cords_p, const area_t * mask_p,
/*Run simpler function without opacity*/
if(opa == OPA_COVER) {
for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) {
for(col = vdb_rel_a.x1; col <= vdb_rel_a.x2; col++) {
vdb_buf_tmp[col] = color;
}
/*Fill the first row with 'color'*/
for(col = vdb_rel_a.x1; col <= vdb_rel_a.x2; col++) {
vdb_buf_tmp[col] = color;
}
/*Copy the first row to all other rows*/
color_t * vdb_buf_first = &vdb_buf_tmp[vdb_rel_a.x1];
cord_t copy_size = (vdb_rel_a.x2 - vdb_rel_a.x1 + 1) * sizeof(color_t);
vdb_buf_tmp += vdb_width;
for(row = vdb_rel_a.y1 + 1; row <= vdb_rel_a.y2; row++) {
memcpy(&vdb_buf_tmp[vdb_rel_a.x1], vdb_buf_first, copy_size);
vdb_buf_tmp += vdb_width;
}
}
......@@ -86,8 +92,7 @@ void lv_vfill(const area_t * cords_p, const area_t * mask_p,
else {
for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) {
for(col = vdb_rel_a.x1; col <= vdb_rel_a.x2; col++) {
color_t c = color_mix(color, vdb_buf_tmp[col], opa);
vdb_buf_tmp[col] = c;
vdb_buf_tmp[col] = color_mix(color, vdb_buf_tmp[col], opa);
}
vdb_buf_tmp += vdb_width;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment