Draw speed optimalization
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
#include "misc/math/math_base.h"
|
#include "misc/math/math_base.h"
|
||||||
#include "lv_draw_rbasic.h"
|
#include "lv_draw_rbasic.h"
|
||||||
#include "lv_draw_vbasic.h"
|
#include "lv_draw_vbasic.h"
|
||||||
|
#include "misc/fs/ufs/ufs.h"
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* 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.y1 &= ~(cord_t)(ds_num - 1) ;
|
||||||
act_area.y2 = act_area.y1 + ds_num - 1;
|
act_area.y2 = act_area.y1 + ds_num - 1;
|
||||||
uint32_t act_pos;
|
uint32_t act_pos;
|
||||||
|
bool const_data = false;
|
||||||
|
if(fn[0] == UFS_LETTER) {
|
||||||
|
if(((ufs_file_t*)file.file_d)->ent->const_data != 0) {
|
||||||
|
const_data = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
color_t buf[LV_HOR_RES];
|
|
||||||
for(row = mask_sub.y1; row <= mask_sub.y2; row += ds_num) {
|
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,
|
/*Get and use the pointer of const data in program memory*/
|
||||||
imgs_p->objs.color, imgs_p->recolor_opa);
|
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_tell(&file, &act_pos);
|
||||||
fs_seek(&file, act_pos + next_row);
|
fs_seek(&file, act_pos + next_row);
|
||||||
act_area.y1 += ds_num;
|
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*/
|
/*Run simpler function without opacity*/
|
||||||
if(opa == OPA_COVER) {
|
if(opa == OPA_COVER) {
|
||||||
for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) {
|
/*Fill the first row with 'color'*/
|
||||||
for(col = vdb_rel_a.x1; col <= vdb_rel_a.x2; col++) {
|
for(col = vdb_rel_a.x1; col <= vdb_rel_a.x2; col++) {
|
||||||
vdb_buf_tmp[col] = color;
|
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;
|
vdb_buf_tmp += vdb_width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,8 +92,7 @@ void lv_vfill(const area_t * cords_p, const area_t * mask_p,
|
|||||||
else {
|
else {
|
||||||
for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) {
|
for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) {
|
||||||
for(col = vdb_rel_a.x1; col <= vdb_rel_a.x2; col++) {
|
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] = color_mix(color, vdb_buf_tmp[col], opa);
|
||||||
vdb_buf_tmp[col] = c;
|
|
||||||
}
|
}
|
||||||
vdb_buf_tmp += vdb_width;
|
vdb_buf_tmp += vdb_width;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user