multi-disp: unique VDB to displays

This commit is contained in:
Gabor Kiss-Vamosi
2019-02-13 01:40:22 +01:00
parent cfa7d22d33
commit 673892cd80
24 changed files with 381 additions and 1147 deletions

View File

@@ -100,7 +100,7 @@
* Setting it to 0 will disable VDB and `disp_drv.disp_fill` and `disp_drv.disp_map` functions
* will be called to draw to the frame buffer directly*/
#ifndef LV_VDB_SIZE
#define LV_VDB_SIZE ((LV_VER_RES * LV_HOR_RES) / 10)
//#define LV_VDB_SIZE ((LV_VER_RES * LV_HOR_RES) / 10)
#endif
/* Bit-per-pixel of VDB. Useful for monochrome or non-standard color format displays.
@@ -113,7 +113,7 @@
* 0: allocate automatically into RAM
* LV_VDB_ADR_INV: to replace it later with `lv_vdb_set_adr()`*/
#ifndef LV_VDB_ADR
#define LV_VDB_ADR 0
//#define LV_VDB_ADR 0
#endif
/* Use two Virtual Display buffers (VDB) to parallelize rendering and flushing

View File

@@ -15,7 +15,6 @@
#include "../lv_core/lv_refr.h"
#include "../lv_misc/lv_task.h"
#include "../lv_misc/lv_math.h"
#include "../lv_draw/lv_draw_rbasic.h"
/*********************
* DEFINES
@@ -367,14 +366,6 @@ static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data)
i->proc.act_point.y = data->point.y;
if(i->proc.state == LV_INDEV_STATE_PR) {
#if LV_INDEV_POINT_MARKER != 0
lv_area_t area;
area.x1 = i->proc.act_point.x - (LV_INDEV_POINT_MARKER >> 1);
area.y1 = i->proc.act_point.y - (LV_INDEV_POINT_MARKER >> 1);
area.x2 = i->proc.act_point.x + ((LV_INDEV_POINT_MARKER >> 1) | 0x1);
area.y2 = i->proc.act_point.y + ((LV_INDEV_POINT_MARKER >> 1) | 0x1);
lv_rfill(&area, NULL, LV_COLOR_MAKE(0xFF, 0, 0), LV_OPA_COVER);
#endif
indev_proc_press(&i->proc);
} else {
indev_proc_release(&i->proc);

View File

@@ -12,7 +12,6 @@
#include "lv_group.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_draw/lv_draw_rbasic.h"
#include "../lv_misc/lv_anim.h"
#include "../lv_misc/lv_task.h"
#include "../lv_misc/lv_fs.h"

View File

@@ -42,19 +42,6 @@ extern "C" {
#error "LittlevGL: LV_ANTIALIAS can be only 0 or 1"
#endif
#if LV_VDB_SIZE == 0 && LV_ANTIALIAS != 0
#error "LittlevGL: If LV_VDB_SIZE == 0 the anti-aliasing must be disabled"
#endif
#if LV_VDB_SIZE > 0 && LV_VDB_SIZE < LV_HOR_RES
#error "LittlevGL: Small Virtual Display Buffer (lv_conf.h: LV_VDB_SIZE >= LV_HOR_RES)"
#endif
#if LV_VDB_SIZE == 0 && USE_LV_REAL_DRAW == 0
#error "LittlevGL: If LV_VDB_SIZE = 0 Real drawing function are required (lv_conf.h: USE_LV_REAL_DRAW 1)"
#endif
#define LV_ANIM_IN 0x00 /*Animation to show an object. 'OR' it with lv_anim_builtin_t*/
#define LV_ANIM_OUT 0x80 /*Animation to hide an object. 'OR' it with lv_anim_builtin_t*/
#define LV_ANIM_DIR_MASK 0x80 /*ANIM_IN/ANIM_OUT mask*/

View File

@@ -8,7 +8,6 @@
*********************/
#include <stddef.h>
#include "lv_refr.h"
#include "lv_vdb.h"
#include "lv_disp.h"
#include "../lv_hal/lv_hal_tick.h"
#include "../lv_hal/lv_hal_disp.h"
@@ -30,15 +29,12 @@
static void lv_refr_task(void * param);
static void lv_refr_join_area(void);
static void lv_refr_areas(void);
#if LV_VDB_SIZE == 0
static void lv_refr_area_no_vdb(const lv_area_t * area_p);
#else
static void lv_refr_area_with_vdb(const lv_area_t * area_p);
static void lv_refr_area_part_vdb(const lv_area_t * area_p);
#endif
static void lv_refr_area(const lv_area_t * area_p);
static void lv_refr_area_part(const lv_area_t * area_p);
static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj);
static void lv_refr_obj_and_children(lv_obj_t * top_p, const lv_area_t * mask_p);
static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p);
static void lv_refr_vdb_flush(void);
/**********************
* STATIC VARIABLES
@@ -66,6 +62,19 @@ void lv_refr_init(void)
lv_task_ready(task); /*Be sure the screen will be refreshed immediately on start up*/
}
/**
* Call in the display driver's 'disp_flush' function when the flushing is finished
*/
LV_ATTRIBUTE_FLUSH_READY void lv_flush_ready(lv_disp_t * disp)
{
disp->driver.buffer->internal.flushing = 0;
/*If the screen is transparent initialize it when the flushing is ready*/
#if LV_VDB_DOUBLE == 0 && LV_COLOR_SCREEN_TRANSP
memset(vdb_buf, 0x00, LV_VDB_SIZE_IN_BYTES);
#endif
}
/**
* Redraw the invalidated areas now.
* Normally the redrawing is periodically executed in `lv_task_handler` but a long blocking process can
@@ -126,6 +135,7 @@ void lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p)
}
}
/**
* Set a function to call after every refresh to announce the refresh time and the number of refreshed pixels
* @param cb pointer to a callback function (void my_refr_cb(uint32_t time_ms, uint32_t px_num))
@@ -182,42 +192,35 @@ static void lv_refr_task(void * param)
/*If refresh happened ...*/
if(disp_refr->inv_p != 0) {
/*In true double buffered mode copy the refreshed areas to the new VDB to keep it up to date*/
#if LV_VDB_TRUE_DOUBLE_BUFFERED
lv_vdb_t * vdb_p = lv_vdb_get();
vdb_p->area.x1 = 0;
vdb_p->area.x2 = LV_HOR_RES-1;
vdb_p->area.y1 = 0;
vdb_p->area.y2 = LV_VER_RES - 1;
if(lv_disp_is_true_double_buffered(disp_refr)) {
lv_vdb_t * vdb = lv_disp_get_vdb(disp_refr);
/*Flush the content of the VDB*/
lv_vdb_flush();
/*Flush the content of the VDB*/
lv_refr_vdb_flush();
/* With true double buffering the flushing should be only the address change of the current frame buffer
* Wait until the address change is ready and copy the active content to the other frame buffer (new active VDB)
* The changes will be written to the new VDB.*/
lv_vdb_t * vdb_act = lv_vdb_get_active();
lv_vdb_t * vdb_ina = lv_vdb_get_inactive();
/* With true double buffering the flushing should be only the address change of the current frame buffer.
* Wait until the address change is ready and copy the changed content to the other frame buffer (new active VDB)
* to keep the buffers synchronized*/
while(vdb->internal.flushing);
uint8_t * buf_act = (uint8_t *) vdb_act->buf;
uint8_t * buf_ina = (uint8_t *) vdb_ina->buf;
uint8_t * buf_act = (uint8_t *) vdb->buf_act;
uint8_t * buf_ina = (uint8_t *) vdb->buf_act == vdb->buf1 ? vdb->buf2 : vdb->buf1;
uint16_t a;
for(a = 0; a < inv_buf_p; a++) {
if(inv_buf[a].joined == 0) {
lv_coord_t y;
uint32_t start_offs = ((LV_HOR_RES * inv_buf[a].area.y1 + inv_buf[a].area.x1) * LV_VDB_PX_BPP) >> 3;
uint32_t line_length = (lv_area_get_width(&inv_buf[a].area) * LV_VDB_PX_BPP) >> 3;
uint16_t a;
for(a = 0; a < disp_refr->inv_p; a++) {
if(disp_refr->inv_area_joined[a] == 0) {
lv_coord_t y;
uint32_t start_offs = ((disp_refr->driver.hor_res * disp_refr->inv_areas[a].y1 + disp_refr->inv_areas[a].x1) * LV_VDB_PX_BPP) >> 3;
uint32_t line_length = (lv_area_get_width(&disp_refr->inv_areas[a]) * LV_VDB_PX_BPP) >> 3;
for(y = inv_buf[a].area.y1; y <= inv_buf[a].area.y2; y++) {
memcpy(buf_act + start_offs, buf_ina + start_offs, line_length);
start_offs += (LV_HOR_RES * LV_VDB_PX_BPP) >> 3;
for(y = disp_refr->inv_areas[a].y1; y <= disp_refr->inv_areas[a].y2; y++) {
memcpy(buf_act + start_offs, buf_ina + start_offs, line_length);
start_offs += (LV_HOR_RES * LV_VDB_PX_BPP) >> 3;
}
}
}
}
#endif
} /*End of true double buffer handling*/
/*Clean up*/
memset(disp_refr->inv_areas, 0, sizeof(disp_refr->inv_areas));
@@ -285,146 +288,112 @@ static void lv_refr_areas(void)
for(i = 0; i < disp_refr->inv_p; i++) {
/*Refresh the unjoined areas*/
if(disp_refr->inv_area_joined[i] == 0) {
/*If there is no VDB do simple drawing*/
#if LV_VDB_SIZE == 0
lv_refr_area_no_vdb(&inv_buf[i].area);
#else
/*If VDB is used...*/
lv_refr_area_with_vdb(&disp_refr->inv_areas[i]);
#endif
lv_refr_area(&disp_refr->inv_areas[i]);
if(monitor_cb != NULL) px_num += lv_area_get_size(&disp_refr->inv_areas[i]);
}
}
}
#if LV_VDB_SIZE == 0
/**
* Refresh an area if there is no Virtual Display Buffer
* @param area_p pointer to an area to refresh
*/
static void lv_refr_area_no_vdb(const lv_area_t * area_p)
{
lv_obj_t * top_p;
/*Get top object which is not covered by others*/
top_p = lv_refr_get_top_obj(area_p, lv_scr_act());
/*Do the refreshing*/
lv_refr_obj_and_children(top_p, area_p);
/*Also refresh top and sys layer unconditionally*/
lv_refr_obj_and_children(lv_layer_top(), area_p);
lv_refr_obj_and_children(lv_layer_sys(), area_p);
}
#else
/**
* Refresh an area if there is Virtual Display Buffer
* @param area_p pointer to an area to refresh
*/
static void lv_refr_area_with_vdb(const lv_area_t * area_p)
static void lv_refr_area(const lv_area_t * area_p)
{
#if LV_VDB_TRUE_DOUBLE_BUFFERED == 0
/*Calculate the max row num*/
lv_coord_t w = lv_area_get_width(area_p);
lv_coord_t h = lv_area_get_height(area_p);
lv_coord_t y2 = area_p->y2 >= lv_disp_get_ver_res(NULL) ? y2 = lv_disp_get_ver_res(NULL) - 1 : area_p->y2;
int32_t max_row = (uint32_t) LV_VDB_SIZE / w;
if(max_row > h) max_row = h;
/*Round down the lines of VDB if rounding is added*/
if(round_cb) {
lv_area_t tmp;
tmp.x1 = 0;
tmp.x2 = 0;
tmp.y1 = 0;
tmp.y2 = max_row;
lv_coord_t y_tmp = max_row;
do {
tmp.y2 = y_tmp;
round_cb(&tmp);
y_tmp --; /*Decrement the number of line until it is rounded to a smaller (or equal) value then the original. */
} while(lv_area_get_height(&tmp) > max_row && y_tmp != 0);
if(y_tmp == 0) {
LV_LOG_WARN("Can't set VDB height using the round function. (Wrong round_cb or to small VDB)");
return;
} else {
max_row = tmp.y2 + 1;
}
/*True double buffering: there are two screen sized buffers. Just redraw directly into a buffer*/
if(lv_disp_is_true_double_buffered(disp_refr)) {
lv_vdb_t * vdb = lv_disp_get_vdb(disp_refr);
vdb->area.x1 = 0;
vdb->area.x2 = LV_HOR_RES-1;
vdb->area.y1 = 0;
vdb->area.y2 = LV_VER_RES - 1;
lv_refr_area_part(area_p);
}
/*The buffer is smaller: refresh the area in parts*/
else {
lv_vdb_t * vdb = lv_disp_get_vdb(disp_refr);
/*Calculate the max row num*/
lv_coord_t w = lv_area_get_width(area_p);
lv_coord_t h = lv_area_get_height(area_p);
lv_coord_t y2 = area_p->y2 >= lv_disp_get_ver_res(NULL) ? y2 = lv_disp_get_ver_res(NULL) - 1 : area_p->y2;
/*Always use the full row*/
lv_coord_t row;
lv_coord_t row_last = 0;
for(row = area_p->y1; row + max_row - 1 <= y2; row += max_row) {
lv_vdb_t * vdb_p = lv_vdb_get();
if(!vdb_p) {
LV_LOG_WARN("Invalid VDB pointer");
return;
int32_t max_row = (uint32_t) vdb->size / w;
if(max_row > h) max_row = h;
/*Round down the lines of VDB if rounding is added*/
if(round_cb) {
lv_area_t tmp;
tmp.x1 = 0;
tmp.x2 = 0;
tmp.y1 = 0;
tmp.y2 = max_row;
lv_coord_t y_tmp = max_row;
do {
tmp.y2 = y_tmp;
round_cb(&tmp);
y_tmp --; /*Decrement the number of line until it is rounded to a smaller (or equal) value then the original. */
} while(lv_area_get_height(&tmp) > max_row && y_tmp != 0);
if(y_tmp == 0) {
LV_LOG_WARN("Can't set VDB height using the round function. (Wrong round_cb or to small VDB)");
return;
} else {
max_row = tmp.y2 + 1;
}
}
/*Calc. the next y coordinates of VDB*/
vdb_p->area.x1 = area_p->x1;
vdb_p->area.x2 = area_p->x2;
vdb_p->area.y1 = row;
vdb_p->area.y2 = row + max_row - 1;
if(vdb_p->area.y2 > y2) vdb_p->area.y2 = y2;
row_last = vdb_p->area.y2;
lv_refr_area_part_vdb(area_p);
}
/*If the last y coordinates are not handled yet ...*/
if(y2 != row_last) {
lv_vdb_t * vdb_p = lv_vdb_get();
if(!vdb_p) {
LV_LOG_WARN("Invalid VDB pointer");
return;
/*Always use the full row*/
lv_coord_t row;
lv_coord_t row_last = 0;
for(row = area_p->y1; row + max_row - 1 <= y2; row += max_row) {
/*Calc. the next y coordinates of VDB*/
vdb->area.x1 = area_p->x1;
vdb->area.x2 = area_p->x2;
vdb->area.y1 = row;
vdb->area.y2 = row + max_row - 1;
if(vdb->area.y2 > y2) vdb->area.y2 = y2;
row_last = vdb->area.y2;
lv_refr_area_part(area_p);
}
/*Calc. the next y coordinates of VDB*/
vdb_p->area.x1 = area_p->x1;
vdb_p->area.x2 = area_p->x2;
vdb_p->area.y1 = row;
vdb_p->area.y2 = y2;
/*If the last y coordinates are not handled yet ...*/
if(y2 != row_last) {
/*Calc. the next y coordinates of VDB*/
vdb->area.x1 = area_p->x1;
vdb->area.x2 = area_p->x2;
vdb->area.y1 = row;
vdb->area.y2 = y2;
/*Refresh this part too*/
lv_refr_area_part_vdb(area_p);
/*Refresh this part too*/
lv_refr_area_part(area_p);
}
}
#else
lv_vdb_t * vdb_p = lv_vdb_get();
vdb_p->area.x1 = 0;
vdb_p->area.x2 = LV_HOR_RES-1;
vdb_p->area.y1 = 0;
vdb_p->area.y2 = LV_VER_RES - 1;
lv_refr_area_part_vdb(area_p);
#endif
}
/**
* Refresh a part of an area which is on the actual Virtual Display Buffer
* @param area_p pointer to an area to refresh
*/
static void lv_refr_area_part_vdb(const lv_area_t * area_p)
static void lv_refr_area_part(const lv_area_t * area_p)
{
lv_vdb_t * vdb_p = lv_vdb_get();
if(!vdb_p) {
LV_LOG_WARN("Invalid VDB pointer");
return;
lv_vdb_t * vdb = lv_disp_get_vdb(disp_refr);
/*In non double buffered mode, before rendering the next part wait until the previous image is flushed*/
if(lv_disp_is_double_vdb(disp_refr) == false) {
while(vdb->internal.flushing);
}
lv_obj_t * top_p;
/*Get the new mask from the original area and the act. VDB
It will be a part of 'area_p'*/
lv_area_t start_mask;
lv_area_intersect(&start_mask, area_p, &vdb_p->area);
lv_area_intersect(&start_mask, area_p, &vdb->area);
/*Get the most top object which is not covered by others*/
top_p = lv_refr_get_top_obj(&start_mask, lv_scr_act(disp_refr));
@@ -438,14 +407,11 @@ static void lv_refr_area_part_vdb(const lv_area_t * area_p)
/* In true double buffered mode flush only once when all areas were rendered.
* In normal mode flush after every area */
#if LV_VDB_TRUE_DOUBLE_BUFFERED == 0
/*Flush the content of the VDB*/
lv_vdb_flush();
#endif
if(lv_disp_is_true_double_buffered(disp_refr) == false) {
lv_refr_vdb_flush();
}
}
#endif /*LV_VDB_SIZE == 0*/
/**
* Search the most top object which fully covers an area
* @param area_p pointer to an area
@@ -593,3 +559,33 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
}
}
/**
* Flush the content of the VDB
*/
static void lv_refr_vdb_flush(void)
{
lv_vdb_t * vdb = lv_disp_get_vdb(lv_refr_get_disp_refreshing());
/*In double buffered mode wait until the other buffer is flushed before flushing the current one*/
if(vdb->buf1 && vdb->buf2) {
while(vdb->internal.flushing);
}
vdb->internal.flushing = 1;
/*Flush the rendered content to the display*/
lv_disp_t * disp = lv_refr_get_disp_refreshing();
if(disp->driver.disp_flush) disp->driver.disp_flush(disp, &vdb->area, vdb->buf_act);
if(vdb->buf1 && vdb->buf2) {
if(vdb->buf_act == vdb->buf1) vdb->buf_act = vdb->buf2;
else vdb->buf_act = vdb->buf1;
/*If the screen is transparent initialize it when the new VDB is selected*/
# if LV_COLOR_SCREEN_TRANSP
memset(vdb[vdb_active].buf, 0x00, LV_VDB_SIZE_IN_BYTES);
# endif /*LV_COLOR_SCREEN_TRANSP*/
}
}

View File

@@ -19,6 +19,9 @@ extern "C" {
/*********************
* DEFINES
*********************/
#ifndef LV_ATTRIBUTE_FLUSH_READY
# define LV_ATTRIBUTE_FLUSH_READY
#endif
/**********************
* TYPEDEFS
@@ -45,6 +48,11 @@ extern "C" {
*/
void lv_refr_init(void);
/**
* Call in the display driver's 'disp_flush' function when the flushing is finished
*/
LV_ATTRIBUTE_FLUSH_READY void lv_flush_ready(lv_disp_t * disp);
/**
* Redraw the invalidated areas now.
* Normally the redrawing is periodically executed in `lv_task_handler` but a long blocking process can
@@ -60,6 +68,7 @@ void lv_refr_now(void);
*/
void lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p);
/**
* Set a function to call after every refresh to announce the refresh time and the number of refreshed pixels
* @param cb pointer to a callback function (void my_refr_cb(uint32_t time_ms, uint32_t px_num))

View File

@@ -1,212 +0,0 @@
/**
* @file lv_vdb.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_vdb.h"
#if LV_VDB_SIZE != 0
#include "../lv_hal/lv_hal_disp.h"
#include "../lv_misc/lv_log.h"
#include "../lv_core/lv_refr.h"
#include <stddef.h>
/*********************
* DEFINES
*********************/
#ifndef LV_ATTRIBUTE_FLUSH_READY
#define LV_ATTRIBUTE_FLUSH_READY
#endif
#ifndef LV_ATTRIBUTE_MEM_ALIGN
#define LV_ATTRIBUTE_MEM_ALIGN
#endif
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
/**********************
* STATIC VARIABLES
**********************/
/*Simple VDB*/
#if LV_VDB_DOUBLE == 0
# if LV_VDB_ADR == 0
/*If the buffer address is not specified simply allocate it*/
static LV_ATTRIBUTE_MEM_ALIGN uint8_t vdb_buf[LV_VDB_SIZE_IN_BYTES];
static lv_vdb_t vdb = {.buf = (lv_color_t *)vdb_buf};
# else /*LV_VDB_ADR != 0*/
/*If the buffer address is specified use that address*/
static lv_vdb_t vdb = {.buf = (lv_color_t *)LV_VDB_ADR};
# endif
/*LV_VDB_DOUBLE != 0*/
#else
/*Double VDB*/
static uint8_t vdb_active = 0;
# if LV_VDB_ADR == 0
/*If the buffer address is not specified simply allocate it*/
static LV_ATTRIBUTE_MEM_ALIGN uint8_t vdb_buf1[LV_VDB_SIZE_IN_BYTES];
static LV_ATTRIBUTE_MEM_ALIGN uint8_t vdb_buf2[LV_VDB_SIZE_IN_BYTES];
static lv_vdb_t vdb[2] = {{.buf = (lv_color_t *) vdb_buf1}, {.buf = (lv_color_t *) vdb_buf2}};
# else /*LV_VDB_ADR != 0*/
/*If the buffer address is specified use that address*/
static lv_vdb_t vdb[2] = {{.buf = (lv_color_t *)LV_VDB_ADR}, {.buf = (lv_color_t *)LV_VDB2_ADR}};
# endif
#endif
static volatile bool vdb_flushing = false;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Get the 'vdb' variable or allocate one in LV_VDB_DOUBLE mode
* @return pointer to a 'vdb' variable
*/
lv_vdb_t * lv_vdb_get(void)
{
lv_disp_t * disp = lv_refr_get_disp_refreshing();
#if LV_VDB_DOUBLE == 0
/* Wait until VDB is flushing.
* (Until this user calls of 'lv_flush_ready()' in the display drivers's flush function*/
while(vdb_flushing);
return &vdb;
#else
/*If already there is an active do nothing*/
return &vdb[vdb_active];
#endif
}
/**
* Flush the content of the VDB
*/
void lv_vdb_flush(void)
{
lv_vdb_t * vdb_act = lv_vdb_get();
if(!vdb_act) {
LV_LOG_WARN("Invalid VDB pointer");
return;
}
/*Don't start a new flush while the previous is not finished*/
#if LV_VDB_DOUBLE
while(vdb_flushing);
#endif /*LV_VDB_DOUBLE*/
vdb_flushing = true;
/*Flush the rendered content to the display*/
lv_disp_t * disp = lv_refr_get_disp_refreshing();
if(disp->driver.disp_flush) disp->driver.disp_flush(disp, &vdb_act->area, vdb_act->buf);
#if LV_VDB_DOUBLE
/*Make the other VDB active. The content of the current will be kept until the next flush*/
vdb_active++;
vdb_active &= 0x1;
/*If the screen is transparent initialize it when the new VDB is selected*/
# if LV_COLOR_SCREEN_TRANSP
memset(vdb[vdb_active].buf, 0x00, LV_VDB_SIZE_IN_BYTES);
# endif /*LV_COLOR_SCREEN_TRANSP*/
#endif /*#if LV_VDB_DOUBLE*/
}
/**
* Set the address of VDB buffer(s) manually. To use this set `LV_VDB_ADR` (and `LV_VDB2_ADR`) to `LV_VDB_ADR_INV` in `lv_conf.h`.
* It should be called before `lv_init()`. The size of the buffer should be: `LV_VDB_SIZE_IN_BYTES`
* @param buf1 address of the VDB.
* @param buf2 address of the second buffer. `NULL` if `LV_VDB_DOUBLE 0`
*/
void lv_vdb_set_adr(void * buf1, void * buf2)
{
#if LV_VDB_DOUBLE == 0
(void) buf2; /*unused*/
vdb.buf = buf1;
#else
vdb[0].buf = buf1;
vdb[1].buf = buf2;
#endif
}
/**
* Call in the display driver's 'disp_flush' function when the flushing is finished
*/
LV_ATTRIBUTE_FLUSH_READY void lv_flush_ready(void)
{
vdb_flushing = false;
/*If the screen is transparent initialize it when the flushing is ready*/
#if LV_VDB_DOUBLE == 0 && LV_COLOR_SCREEN_TRANSP
memset(vdb_buf, 0x00, LV_VDB_SIZE_IN_BYTES);
#endif
}
/**
* Get currently active VDB, where the drawing happens. Used with `LV_VDB_DOUBLE 1`
* @return pointer to the active VDB. If `LV_VDB_DOUBLE 0` give the single VDB
*/
lv_vdb_t * lv_vdb_get_active(void)
{
#if LV_VDB_DOUBLE == 0
return &vdb;
#else
return &vdb[vdb_active];
#endif
}
/**
* Get currently inactive VDB, which is being displayed or being flushed. Used with `LV_VDB_DOUBLE 1`
* @return pointer to the inactive VDB. If `LV_VDB_DOUBLE 0` give the single VDB
*/
lv_vdb_t * lv_vdb_get_inactive(void)
{
#if LV_VDB_DOUBLE == 0
return &vdb;
#else
return &vdb[(vdb_active + 1) & 0x1];
#endif
}
/**
* Whether the flushing is in progress or not
* @return true: flushing is in progress; false: flushing ready
*/
bool lv_vdb_is_flushing(void)
{
return vdb_flushing;
}
/**********************
* STATIC FUNCTIONS
**********************/
#else
/**
* Just for compatibility
*/
void lv_flush_ready(void)
{
/*Do nothing. It is used only for VDB*/
}
#endif

View File

@@ -1,119 +0,0 @@
/**
* @file lv_vdb.h
*
*/
#ifndef LV_VDB_H
#define LV_VDB_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h"
#else
#include "../../lv_conf.h"
#endif
#if LV_VDB_SIZE != 0
#include "../lv_misc/lv_color.h"
#include "../lv_misc/lv_area.h"
/*********************
* DEFINES
*********************/
/*Can be used in `lv_conf.h` the set an invalid address for the VDB. It should be replaced later by a valid address using `lv_vdb_set_adr()`*/
#define LV_VDB_ADR_INV 8 /*8 is still too small to be valid but it's aligned on 64 bit machines as well*/
#ifndef LV_VDB_PX_BPP
#define LV_VDB_PX_BPP LV_COLOR_SIZE /* Default is LV_COLOR_SIZE */
#endif
#if LV_VDB_TRUE_DOUBLE_BUFFERED && (LV_VDB_SIZE != LV_HOR_RES * LV_VER_RES || LV_VDB_DOUBLE == 0)
#error "With LV_VDB_TRUE_DOUBLE_BUFFERED: (LV_VDB_SIZE = LV_HOR_RES * LV_VER_RES and LV_VDB_DOUBLE = 1 is required"
#endif
/* The size of VDB in bytes.
* (LV_VDB_SIZE * LV_VDB_PX_BPP) >> 3): just divide by 8 to convert bits to bytes
* (((LV_VDB_SIZE * LV_VDB_PX_BPP) & 0x7) ? 1 : 0): add an extra byte to round up.
* E.g. if LV_VDB_SIZE = 10 and LV_VDB_PX_BPP = 1 -> 10 bits -> 2 bytes*/
#define LV_VDB_SIZE_IN_BYTES ((LV_VDB_SIZE * LV_VDB_PX_BPP) >> 3) + (((LV_VDB_SIZE * LV_VDB_PX_BPP) & 0x7) ? 1 : 0)
/**********************
* TYPEDEFS
**********************/
typedef struct
{
lv_area_t area;
lv_color_t *buf;
} lv_vdb_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Get the 'vdb' variable or allocate one in LV_VDB_DOUBLE mode
* @return pointer to a 'vdb' variable
*/
lv_vdb_t * lv_vdb_get(void);
/**
* Flush the content of the vdb
*/
void lv_vdb_flush(void);
/**
* Set the address of VDB buffer(s) manually. To use this set `LV_VDB_ADR` (and `LV_VDB2_ADR`) to `LV_VDB_ADR_INV` in `lv_conf.h`.
* It should be called before `lv_init()`. The size of the buffer should be: `LV_VDB_SIZE_IN_BYTES`
* @param buf1 address of the VDB.
* @param buf2 address of the second buffer. `NULL` if `LV_VDB_DOUBLE 0`
*/
void lv_vdb_set_adr(void * buf1, void * buf2);
/**
* Call in the display driver's 'disp_flush' function when the flushing is finished
*/
void lv_flush_ready(void);
/**
* Get currently active VDB, where the drawing happens. Used with `LV_VDB_DOUBLE 1`
* @return pointer to the active VDB. If `LV_VDB_DOUBLE 0` give the single VDB
*/
lv_vdb_t * lv_vdb_get_active(void);
/**
* Get currently inactive VDB, which is being displayed or being flushed. Used with `LV_VDB_DOUBLE 1`
* @return pointer to the inactive VDB. If `LV_VDB_DOUBLE 0` give the single VDB
*/
lv_vdb_t * lv_vdb_get_inactive(void);
/**
* Whether the flushing is in progress or not
* @return true: flushing is in progress; false: flushing ready
*/
bool lv_vdb_is_flushing(void);
/**********************
* MACROS
**********************/
#else /*LV_VDB_SIZE != 0*/
/*Just for compatibility*/
void lv_flush_ready(void);
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_VDB_H*/

View File

@@ -10,12 +10,7 @@
#include <stdio.h>
#include <stdbool.h>
#include "lv_draw.h"
#include "lv_draw_rbasic.h"
#include "lv_draw_vbasic.h"
#include "../lv_misc/lv_fs.h"
#include "../lv_misc/lv_math.h"
#include "../lv_misc/lv_ufs.h"
#include "../lv_objx/lv_img.h"
/*********************
* DEFINES
@@ -33,22 +28,6 @@
* STATIC VARIABLES
**********************/
#if LV_VDB_SIZE != 0
void (*const px_fp)(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = lv_vpx;
void (*const fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = lv_vfill;
void (*const letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa) = lv_vletter;
void (*const map_fp)(const lv_area_t * cords_p, const lv_area_t * mask_p,
const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
lv_color_t recolor, lv_opa_t recolor_opa) = lv_vmap;
#else
void (*const px_fp)(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = lv_rpx;
void (*const fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = lv_rfill;
void (*const letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa) = lv_rletter;
void (*const map_fp)(const lv_area_t * cords_p, const lv_area_t * mask_p,
const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
lv_color_t recolor, lv_opa_t recolor_opa) = lv_rmap;
#endif
/**********************
* MACROS
**********************/
@@ -132,7 +111,7 @@ void lv_draw_aa_ver_seg(lv_coord_t x, lv_coord_t y, lv_coord_t length, const lv_
for(i = 0; i < length; i++) {
lv_opa_t px_opa = lv_draw_aa_get_opa(length, i, opa);
if(aa_inv) px_opa = opa - px_opa;
px_fp(x, y + i, mask, color, px_opa);
lv_draw_px(x, y + i, mask, color, px_opa);
}
}
@@ -157,7 +136,7 @@ void lv_draw_aa_hor_seg(lv_coord_t x, lv_coord_t y, lv_coord_t length, const lv_
for(i = 0; i < length; i++) {
lv_opa_t px_opa = lv_draw_aa_get_opa(length, i, opa);
if(aa_inv) px_opa = opa - px_opa;
px_fp(x + i, y, mask, color, px_opa);
lv_draw_px(x + i, y, mask, color, px_opa);
}
}

View File

@@ -88,12 +88,6 @@ void lv_draw_aa_hor_seg(lv_coord_t x, lv_coord_t y, lv_coord_t length, const lv_
/**********************
* GLOBAL VARIABLES
**********************/
extern void (*const px_fp)(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_color_t color, lv_opa_t opa);
extern void (*const fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa);
extern void (*const letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa);
extern void (*const map_fp)(const lv_area_t * cords_p, const lv_area_t * mask_p,
const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
lv_color_t recolor, lv_opa_t recolor_opa);
/**********************
* MACROS
@@ -102,6 +96,7 @@ extern void (*const map_fp)(const lv_area_t * cords_p, const lv_area_t * mask_p,
/**********************
* POST INCLUDES
*********************/
#include "lv_draw_basic.h"
#include "lv_draw_rect.h"
#include "lv_draw_label.h"
#include "lv_draw_img.h"

View File

@@ -239,7 +239,7 @@ static void ver_line(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_coor
lv_area_t area;
lv_area_set(&area, x, y, x, y + len);
fill_fp(&area, mask, color, opa);
lv_draw_fill(&area, mask, color, opa);
}
static void hor_line(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_coord_t len, lv_color_t color, lv_opa_t opa)
@@ -247,7 +247,7 @@ static void hor_line(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_coor
lv_area_t area;
lv_area_set(&area, x, y, x + len, y);
fill_fp(&area, mask, color, opa);
lv_draw_fill(&area, mask, color, opa);
}
static bool deg_test_norm(uint16_t deg, uint16_t start, uint16_t end)

View File

@@ -1,9 +1,9 @@
/**
* @file lv_vdraw.c
* @file lv_draw_basic.c
*
*/
#include "lv_draw_vbasic.h"
#include "lv_draw_basic.h"
#include <stdbool.h>
#include <stdint.h>
@@ -16,10 +16,7 @@
#include "../lv_misc/lv_color.h"
#include "../lv_misc/lv_log.h"
#if LV_VDB_SIZE != 0
#include <stddef.h>
#include "../lv_core/lv_vdb.h"
#include "lv_draw.h"
/*********************
@@ -69,16 +66,11 @@ static inline lv_color_t color_mix_2_alpha(lv_color_t bg_color, lv_opa_t bg_opa,
* @param color pixel color
* @param opa opacity of the area (0..255)
*/
void lv_vpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t color, lv_opa_t opa)
void lv_draw_px(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t color, lv_opa_t opa)
{
if(opa < LV_OPA_MIN) return;
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
lv_vdb_t * vdb_p = lv_vdb_get();
if(!vdb_p) {
LV_LOG_WARN("Invalid VDB pointer");
return;
}
/*Pixel out of the mask*/
if(x < mask_p->x1 || x > mask_p->x2 ||
@@ -86,17 +78,19 @@ void lv_vpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t col
return;
}
uint32_t vdb_width = lv_area_get_width(&vdb_p->area);
lv_disp_t * disp = lv_refr_get_disp_refreshing();
lv_vdb_t * vdb = lv_disp_get_vdb(disp);
uint32_t vdb_width = lv_area_get_width(&vdb->area);
/*Make the coordinates relative to VDB*/
x -= vdb_p->area.x1;
y -= vdb_p->area.y1;
x -= vdb->area.x1;
y -= vdb->area.y1;
lv_disp_t * disp = lv_refr_get_disp_refreshing();
if(disp->driver.vdb_wr) {
disp->driver.vdb_wr((uint8_t *)vdb_p->buf, vdb_width, x, y, color, opa);
disp->driver.vdb_wr((uint8_t *)vdb->buf_act, vdb_width, x, y, color, opa);
} else {
lv_color_t * vdb_px_p = vdb_p->buf + y * vdb_width + x;
lv_color_t * vdb_px_p = vdb->buf_act;
vdb_px_p += y * vdb_width + x;
#if LV_COLOR_SCREEN_TRANSP == 0
if(opa == LV_OPA_COVER) {
*vdb_px_p = color;
@@ -117,7 +111,7 @@ void lv_vpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t col
* @param color fill color
* @param opa opacity of the area (0..255)
*/
void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
void lv_draw_fill(const lv_area_t * cords_p, const lv_area_t * mask_p,
lv_color_t color, lv_opa_t opa)
{
if(opa < LV_OPA_MIN) return;
@@ -125,11 +119,6 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
lv_area_t res_a;
bool union_ok;
lv_vdb_t * vdb_p = lv_vdb_get();
if(!vdb_p) {
LV_LOG_WARN("Invalid VDB pointer");
return;
}
/*Get the union of cord and mask*/
/* The mask is already truncated to the vdb size
@@ -140,15 +129,16 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
if(union_ok == false) return;
lv_disp_t * disp = lv_refr_get_disp_refreshing();
lv_vdb_t * vdb = lv_disp_get_vdb(disp);
lv_area_t vdb_rel_a; /*Stores relative coordinates on vdb*/
vdb_rel_a.x1 = res_a.x1 - vdb_p->area.x1;
vdb_rel_a.y1 = res_a.y1 - vdb_p->area.y1;
vdb_rel_a.x2 = res_a.x2 - vdb_p->area.x1;
vdb_rel_a.y2 = res_a.y2 - vdb_p->area.y1;
vdb_rel_a.x1 = res_a.x1 - vdb->area.x1;
vdb_rel_a.y1 = res_a.y1 - vdb->area.y1;
vdb_rel_a.x2 = res_a.x2 - vdb->area.x1;
vdb_rel_a.y2 = res_a.y2 - vdb->area.y1;
lv_color_t * vdb_buf_tmp = vdb_p->buf;
uint32_t vdb_width = lv_area_get_width(&vdb_p->area);
lv_color_t * vdb_buf_tmp = vdb->buf_act;
uint32_t vdb_width = lv_area_get_width(&vdb->area);
/*Move the vdb_tmp to the first row*/
vdb_buf_tmp += vdb_width * vdb_rel_a.y1;
@@ -160,7 +150,7 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
lv_coord_t w = lv_area_get_width(&vdb_rel_a);
/*Don't use hw. acc. for every small fill (because of the init overhead)*/
if(w < VFILL_HW_ACC_SIZE_LIMIT) {
sw_color_fill(&vdb_p->area, vdb_p->buf, &vdb_rel_a, color, opa);
sw_color_fill(&vdb->area, vdb->buf_act, &vdb_rel_a, color, opa);
}
/*Not opaque fill*/
else if(opa == LV_OPA_COVER) {
@@ -194,7 +184,7 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
}
/*Else use sw fill if no better option*/
else {
sw_color_fill(&vdb_p->area, vdb_p->buf, &vdb_rel_a, color, opa);
sw_color_fill(&vdb->area, vdb->buf_act, &vdb_rel_a, color, opa);
}
}
@@ -219,12 +209,12 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
}
/*Use sw fill with opa if no better option*/
else {
sw_color_fill(&vdb_p->area, vdb_p->buf, &vdb_rel_a, color, opa);
sw_color_fill(&vdb->area, vdb->buf_act, &vdb_rel_a, color, opa);
}
}
#else
sw_color_fill(&vdb_p->area, vdb_p->buf, &vdb_rel_a, color, opa);
sw_color_fill(&vdb->area, vdb->buf_act, &vdb_rel_a, color, opa);
#endif
}
@@ -237,7 +227,7 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
* @param color color of letter
* @param opa opacity of letter (0..255)
*/
void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * mask_p,
const lv_font_t * font_p, uint32_t letter,
lv_color_t color, lv_opa_t opa)
{
@@ -299,14 +289,11 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
if(pos_x + letter_w < mask_p->x1 || pos_x > mask_p->x2 ||
pos_y + letter_h < mask_p->y1 || pos_y > mask_p->y2) return;
lv_vdb_t * vdb_p = lv_vdb_get();
if(!vdb_p) {
LV_LOG_WARN("Invalid VDB pointer");
return;
}
lv_disp_t * disp = lv_refr_get_disp_refreshing();
lv_vdb_t * vdb = lv_disp_get_vdb(disp);
lv_coord_t vdb_width = lv_area_get_width(&vdb_p->area);
lv_color_t * vdb_buf_tmp = vdb_p->buf;
lv_coord_t vdb_width = lv_area_get_width(&vdb->area);
lv_color_t * vdb_buf_tmp = vdb->buf_act;
lv_coord_t col, row;
uint8_t col_bit;
uint8_t col_byte_cnt;
@@ -322,8 +309,8 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
lv_coord_t row_end = pos_y + letter_h <= mask_p->y2 ? letter_h : mask_p->y2 - pos_y + 1;
/*Set a pointer on VDB to the first pixel of the letter*/
vdb_buf_tmp += ((pos_y - vdb_p->area.y1) * vdb_width)
+ pos_x - vdb_p->area.x1;
vdb_buf_tmp += ((pos_y - vdb->area.y1) * vdb_width)
+ pos_x - vdb->area.x1;
/*If the letter is partially out of mask the move there on VDB*/
vdb_buf_tmp += (row_start * vdb_width) + col_start;
@@ -331,8 +318,6 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
/*Move on the map too*/
map_p += (row_start * width_byte_bpp) + ((col_start * bpp) >> 3);
lv_disp_t * disp = lv_refr_get_disp_refreshing();
uint8_t letter_px;
lv_opa_t px_opa;
for(row = row_start; row < row_end; row ++) {
@@ -351,8 +336,8 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
}
if(disp->driver.vdb_wr) {
disp->driver.vdb_wr((uint8_t *)vdb_p->buf, vdb_width,
(col + pos_x) - vdb_p->area.x1, (row + pos_y) - vdb_p->area.y1,
disp->driver.vdb_wr((uint8_t *)vdb->buf_act, vdb_width,
(col + pos_x) - vdb->area.x1, (row + pos_y) - vdb->area.y1,
color, px_opa);
} else {
#if LV_COLOR_SCREEN_TRANSP == 0
@@ -392,7 +377,7 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
* @param recolor mix the pixels with this color
* @param recolor_opa the intense of recoloring
*/
void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
void lv_draw_map(const lv_area_t * cords_p, const lv_area_t * mask_p,
const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
lv_color_t recolor, lv_opa_t recolor_opa)
{
@@ -402,11 +387,6 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
lv_area_t masked_a;
bool union_ok;
lv_vdb_t * vdb_p = lv_vdb_get();
if(!vdb_p) {
LV_LOG_WARN("Invalid VDB pointer");
return;
}
/*Get the union of map size and mask*/
/* The mask is already truncated to the vdb size
@@ -428,22 +408,23 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
map_p += (masked_a.x1 - cords_p->x1) * px_size_byte;
}
/*Stores coordinates relative to the current VDB*/
masked_a.x1 = masked_a.x1 - vdb_p->area.x1;
masked_a.y1 = masked_a.y1 - vdb_p->area.y1;
masked_a.x2 = masked_a.x2 - vdb_p->area.x1;
masked_a.y2 = masked_a.y2 - vdb_p->area.y1;
lv_disp_t * disp = lv_refr_get_disp_refreshing();
lv_vdb_t * vdb = lv_disp_get_vdb(disp);
lv_coord_t vdb_width = lv_area_get_width(&vdb_p->area);
lv_color_t * vdb_buf_tmp = vdb_p->buf;
/*Stores coordinates relative to the current VDB*/
masked_a.x1 = masked_a.x1 - vdb->area.x1;
masked_a.y1 = masked_a.y1 - vdb->area.y1;
masked_a.x2 = masked_a.x2 - vdb->area.x1;
masked_a.y2 = masked_a.y2 - vdb->area.y1;
lv_coord_t vdb_width = lv_area_get_width(&vdb->area);
lv_color_t * vdb_buf_tmp = vdb->buf_act;
vdb_buf_tmp += (uint32_t) vdb_width * masked_a.y1; /*Move to the first row*/
vdb_buf_tmp += (uint32_t) masked_a.x1; /*Move to the first col*/
lv_coord_t row;
lv_coord_t map_useful_w = lv_area_get_width(&masked_a);
lv_disp_t * disp = lv_refr_get_disp_refreshing();
/*The simplest case just copy the pixels into the VDB*/
if(chroma_key == false && alpha_byte == false && opa == LV_OPA_COVER && recolor_opa == LV_OPA_TRANSP) {
@@ -453,7 +434,7 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
for(row = masked_a.y1; row <= masked_a.y2; row++) {
for(col = 0; col < map_useful_w; col++) {
lv_color_t px_color = *((lv_color_t *)&map_p[(uint32_t)col * px_size_byte]);
disp->driver.vdb_wr((uint8_t *)vdb_p->buf, vdb_width, col + masked_a.x1, row, px_color, opa);
disp->driver.vdb_wr((uint8_t *)vdb->buf_act, vdb_width, col + masked_a.x1, row, px_color, opa);
}
map_p += map_width * px_size_byte; /*Next row on the map*/
}
@@ -516,7 +497,7 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
}
/*Handle custom VDB write is present*/
if(disp->driver.vdb_wr) {
disp->driver.vdb_wr((uint8_t *)vdb_p->buf, vdb_width, col + masked_a.x1, row, recolored_px, opa_result);
disp->driver.vdb_wr((uint8_t *)vdb->buf_act, vdb_width, col + masked_a.x1, row, recolored_px, opa_result);
}
/*Normal native VDB write*/
else {
@@ -526,7 +507,7 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
} else {
/*Handle custom VDB write is present*/
if(disp->driver.vdb_wr) {
disp->driver.vdb_wr((uint8_t *)vdb_p->buf, vdb_width, col + masked_a.x1, row, px_color, opa_result);
disp->driver.vdb_wr((uint8_t *)vdb->buf_act, vdb_width, col + masked_a.x1, row, px_color, opa_result);
}
/*Normal native VDB write*/
else {
@@ -692,4 +673,3 @@ static inline lv_color_t color_mix_2_alpha(lv_color_t bg_color, lv_opa_t bg_opa,
}
#endif /*LV_COLOR_SCREEN_TRANSP*/
#endif

View File

@@ -1,10 +1,10 @@
/**
* @file lv_draw_vbasic.h
* @file lv_draw_basic.h
*
*/
#ifndef LV_DRAW_VBASIC_H
#define LV_DRAW_VBASIC_H
#ifndef LV_DRAW_BASIC_H
#define LV_DRAW_BASIC_H
#ifdef __cplusplus
extern "C" {
@@ -19,8 +19,6 @@ extern "C" {
#include "../../lv_conf.h"
#endif
#if LV_VDB_SIZE != 0
#include "../lv_misc/lv_color.h"
#include "../lv_misc/lv_area.h"
#include "../lv_misc/lv_font.h"
@@ -37,7 +35,7 @@ extern "C" {
* GLOBAL PROTOTYPES
**********************/
void lv_vpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t color, lv_opa_t opa);
void lv_draw_px(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t color, lv_opa_t opa);
/**
* Fill an area in the Virtual Display Buffer
* @param cords_p coordinates of the area to fill
@@ -45,7 +43,7 @@ void lv_vpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t col
* @param color fill color
* @param opa opacity of the area (0..255)
*/
void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
void lv_draw_fill(const lv_area_t * cords_p, const lv_area_t * mask_p,
lv_color_t color, lv_opa_t opa);
/**
@@ -57,7 +55,7 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
* @param color color of letter
* @param opa opacity of letter (0..255)
*/
void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * mask_p,
const lv_font_t * font_p, uint32_t letter,
lv_color_t color, lv_opa_t opa);
@@ -72,7 +70,7 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
* @param recolor mix the pixels with this color
* @param recolor_opa the intense of recoloring
*/
void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
void lv_draw_map(const lv_area_t * cords_p, const lv_area_t * mask_p,
const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
lv_color_t recolor, lv_opa_t recolor_opa);
@@ -80,10 +78,8 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
* MACROS
**********************/
#endif /*LV_VDB_SIZE != 0*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_DRAW_RBASIC_H*/
#endif /*LV_DRAW_BASIC_H*/

View File

@@ -316,7 +316,7 @@ static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * mas
/* The decoder open could open the image and gave the entire uncompressed image.
* Just draw it!*/
if(img_data) {
map_fp(coords, mask, img_data, opa, chroma_keyed, alpha_byte, style->image.color, style->image.intense);
lv_draw_map(coords, mask, img_data, opa, chroma_keyed, alpha_byte, style->image.color, style->image.intense);
}
/* The whole uncompressed image is not available. Try to read it line-by-line*/
else {
@@ -341,7 +341,7 @@ static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * mas
LV_LOG_WARN("Image draw can't read the line");
return LV_RES_INV;
}
map_fp(&line, mask, buf, opa, chroma_keyed, alpha_byte, style->image.color, style->image.intense);
lv_draw_map(&line, mask, buf, opa, chroma_keyed, alpha_byte, style->image.color, style->image.intense);
line.y1++;
line.y2++;
y++;

View File

@@ -7,7 +7,6 @@
* INCLUDES
*********************/
#include "lv_draw_label.h"
#include "lv_draw_rbasic.h"
#include "../lv_misc/lv_math.h"
/*********************
@@ -123,12 +122,6 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_st
pos.y += y_ofs;
}
/*Real draw need a background color for higher bpp letter*/
#if LV_VDB_SIZE == 0
lv_rletter_set_background(style->body.main_color);
#endif
/*Write out all lines*/
while(txt[line_start] != '\0') {
if(offset != NULL) {
@@ -182,7 +175,7 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_st
if(cmd_state == CMD_STATE_IN) color = recolor;
letter_fp(&pos, mask, font, letter, color, opa);
lv_draw_letter(&pos, mask, font, letter, color, opa);
letter_w = lv_font_get_width(font, letter);
if(letter_w > 0){

View File

@@ -192,7 +192,7 @@ static void line_draw_hor(line_draw_t * main_line, const lv_area_t * mask, const
draw_area.x2 = LV_MATH_MAX(act_area.x1, act_area.x2);
draw_area.y1 = LV_MATH_MIN(act_area.y1, act_area.y2);
draw_area.y2 = LV_MATH_MAX(act_area.y1, act_area.y2);
fill_fp(&draw_area, mask, style->line.color, opa);
lv_draw_fill(&draw_area, mask, style->line.color, opa);
}
static void line_draw_ver(line_draw_t * main_line, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale)
@@ -214,7 +214,7 @@ static void line_draw_ver(line_draw_t * main_line, const lv_area_t * mask, const
draw_area.x2 = LV_MATH_MAX(act_area.x1, act_area.x2);
draw_area.y1 = LV_MATH_MIN(act_area.y1, act_area.y2);
draw_area.y2 = LV_MATH_MAX(act_area.y1, act_area.y2);
fill_fp(&draw_area, mask, style->line.color, opa);
lv_draw_fill(&draw_area, mask, style->line.color, opa);
}
static void line_draw_skew(line_draw_t * main_line, bool dir_ori, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale)
@@ -436,12 +436,12 @@ static void line_draw_skew(line_draw_t * main_line, bool dir_ori, const lv_area_
draw_area.y1 = prev_p.y + pattern[i].y;
draw_area.x2 = draw_area.x1 + main_line->p_act.x - prev_p.x - 1;
draw_area.y2 = draw_area.y1;
fill_fp(&draw_area, mask, style->line.color, opa);
lv_draw_fill(&draw_area, mask, style->line.color, opa);
/* Fill the gaps
* When stepping in y one pixel remains empty on every corner (don't do this on the first segment ) */
if(i != 0 && pattern[i].x != pattern[i - 1].x && !first_run) {
px_fp(draw_area.x1, draw_area.y1 - main_line->sy, mask, style->line.color, opa);
lv_draw_px(draw_area.x1, draw_area.y1 - main_line->sy, mask, style->line.color, opa);
}
}
@@ -463,12 +463,12 @@ static void line_draw_skew(line_draw_t * main_line, bool dir_ori, const lv_area_
draw_area.y1 = prev_p.y + pattern[i].y;
draw_area.x2 = draw_area.x1 + main_line->p_act.x - prev_p.x;
draw_area.y2 = draw_area.y1;
fill_fp(&draw_area, mask, style->line.color, opa);
lv_draw_fill(&draw_area, mask, style->line.color, opa);
/* Fill the gaps
* When stepping in y one pixel remains empty on every corner */
if(i != 0 && pattern[i].x != pattern[i - 1].x && !first_run) {
px_fp(draw_area.x1, draw_area.y1 - main_line->sy, mask, style->line.color, opa);
lv_draw_px(draw_area.x1, draw_area.y1 - main_line->sy, mask, style->line.color, opa);
}
}
@@ -489,12 +489,12 @@ static void line_draw_skew(line_draw_t * main_line, bool dir_ori, const lv_area_
draw_area.x2 = draw_area.x1;
draw_area.y2 = draw_area.y1 + main_line->p_act.y - prev_p.y - 1;
fill_fp(&draw_area, mask, style->line.color, opa);
lv_draw_fill(&draw_area, mask, style->line.color, opa);
/* Fill the gaps
* When stepping in x one pixel remains empty on every corner (don't do this on the first segment ) */
if(i != 0 && pattern[i].y != pattern[i - 1].y && !first_run) {
px_fp(draw_area.x1 - main_line->sx, draw_area.y1, mask, style->line.color, opa);
lv_draw_px(draw_area.x1 - main_line->sx, draw_area.y1, mask, style->line.color, opa);
}
}
@@ -519,12 +519,12 @@ static void line_draw_skew(line_draw_t * main_line, bool dir_ori, const lv_area_
draw_area.x2 = draw_area.x1;
draw_area.y2 = draw_area.y1 + main_line->p_act.y - prev_p.y;
fill_fp(&draw_area, mask, style->line.color, opa);
lv_draw_fill(&draw_area, mask, style->line.color, opa);
/* Fill the gaps
* When stepping in x one pixel remains empty on every corner */
if(i != 0 && pattern[i].y != pattern[i - 1].y && !first_run) {
px_fp(draw_area.x1 - main_line->sx, draw_area.y1, mask, style->line.color, opa);
lv_draw_px(draw_area.x1 - main_line->sx, draw_area.y1, mask, style->line.color, opa);
}
}

View File

@@ -1,277 +0,0 @@
/**
* @file lv_draw_rbasic.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_draw_rbasic.h"
#if USE_LV_REAL_DRAW != 0
#include "../lv_hal/lv_hal.h"
#include "../lv_misc/lv_font.h"
#include "../lv_core/lv_refr.h"
#include "lv_draw.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
/**********************
* STATIC VARIABLES
**********************/
static lv_color_t letter_bg_color;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Put a pixel to the display
* @param x x coordinate of the pixel
* @param y y coordinate of the pixel
* @param mask_p the pixel will be drawn on this area
* @param color color of the pixel
* @param opa opacity (ignored, only for compatibility with lv_vpx)
*/
void lv_rpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t color, lv_opa_t opa)
{
(void)opa; /*Opa is used only for compatibility with lv_vpx*/
lv_area_t area;
area.x1 = x;
area.y1 = y;
area.x2 = x;
area.y2 = y;
lv_rfill(&area, mask_p, color, LV_OPA_COVER);
}
/**
* Fill an area on the display
* @param cords_p coordinates of the area to fill
* @param mask_p fill only o this mask
* @param color fill color
* @param opa opacity (ignored, only for compatibility with lv_vfill)
*/
void lv_rfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
lv_color_t color, lv_opa_t opa)
{
(void)opa; /*Opa is used only for compatibility with lv_vfill*/
lv_area_t masked_area;
bool union_ok = true;
if(mask_p != NULL) {
union_ok = lv_area_intersect(&masked_area, cords_p, mask_p);
} else {
lv_area_t scr_area;
lv_area_set(&scr_area, 0, 0, lv_disp_get_hor_res(NULL) - 1, lv_disp_get_ver_res(NULL) - 1);
union_ok = lv_area_intersect(&masked_area, cords_p, &scr_area);
}
if(union_ok != false) {
lv_disp_t * disp = lv_refr_get_disp_refreshing();
if(disp->driver.disp_fill) {
disp->driver.disp_fill(masked_area.x1, masked_area.y1, masked_area.x2, masked_area.y2, color);
}
}
}
/**
* Draw a letter to the display
* @param pos_p left-top coordinate of the latter
* @param mask_p the letter will be drawn only on this area
* @param font_p pointer to font
* @param letter a letter to draw
* @param color color of letter
* @param opa opacity of letter (ignored, only for compatibility with lv_vletter)
*/
void lv_rletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
const lv_font_t * font_p, uint32_t letter,
lv_color_t color, lv_opa_t opa)
{
(void)opa; /*Opa is used only for compatibility with lv_vletter*/
static uint8_t bpp1_opa_table[2] = {0, 255}; /*Opacity mapping with bpp = 1 (Just for compatibility)*/
static uint8_t bpp2_opa_table[4] = {0, 85, 170, 255}; /*Opacity mapping with bpp = 2*/
static uint8_t bpp4_opa_table[16] = {0, 17, 34, 51, /*Opacity mapping with bpp = 4*/
68, 85, 102, 119,
136, 153, 170, 187,
204, 221, 238, 255
};
if(font_p == NULL) return;
uint8_t letter_w = lv_font_get_width(font_p, letter);
uint8_t letter_h = lv_font_get_height(font_p);
uint8_t bpp = lv_font_get_bpp(font_p, letter); /*Bit per pixel (1,2, 4 or 8)*/
uint8_t * bpp_opa_table;
uint8_t mask_init;
uint8_t mask;
switch(bpp) {
case 1:
bpp_opa_table = bpp1_opa_table;
mask_init = 0x80;
break;
case 2:
bpp_opa_table = bpp2_opa_table;
mask_init = 0xC0;
break;
case 4:
bpp_opa_table = bpp4_opa_table;
mask_init = 0xF0;
break;
case 8:
bpp_opa_table = NULL;
mask_init = 0xFF;
break; /*No opa table, pixel value will be used directly*/
default:
return; /*Invalid bpp. Can't render the letter*/
}
const uint8_t * map_p = lv_font_get_bitmap(font_p, letter);
if(map_p == NULL) return;
/*If the letter is completely out of mask don't draw it */
if(pos_p->x + letter_w < mask_p->x1 || pos_p->x > mask_p->x2 ||
pos_p->y + letter_h < mask_p->y1 || pos_p->y > mask_p->y2) return;
lv_coord_t col, row;
uint8_t col_bit;
uint8_t col_byte_cnt;
uint8_t width_byte_scr = letter_w >> 3; /*Width in bytes (on the screen finally) (e.g. w = 11 -> 2 bytes wide)*/
if(letter_w & 0x7) width_byte_scr++;
uint8_t width_byte_bpp = (letter_w * bpp) >> 3; /*Letter width in byte. Real width in the font*/
if((letter_w * bpp) & 0x7) width_byte_bpp++;
/* Calculate the col/row start/end on the map*/
lv_coord_t col_start = pos_p->x >= mask_p->x1 ? 0 : mask_p->x1 - pos_p->x;
lv_coord_t col_end = pos_p->x + letter_w <= mask_p->x2 ? letter_w : mask_p->x2 - pos_p->x + 1;
lv_coord_t row_start = pos_p->y >= mask_p->y1 ? 0 : mask_p->y1 - pos_p->y;
lv_coord_t row_end = pos_p->y + letter_h <= mask_p->y2 ? letter_h : mask_p->y2 - pos_p->y + 1;
/*Move on the map too*/
map_p += (row_start * width_byte_bpp) + ((col_start * bpp) >> 3);
uint8_t letter_px;
for(row = row_start; row < row_end; row ++) {
col_byte_cnt = 0;
col_bit = (col_start * bpp) % 8;
mask = mask_init >> col_bit;
for(col = col_start; col < col_end; col ++) {
letter_px = (*map_p & mask) >> (8 - col_bit - bpp);
if(letter_px != 0) {
lv_rpx(pos_p->x + col, pos_p->y + row, mask_p, lv_color_mix(color, letter_bg_color, bpp == 8 ? letter_px : bpp_opa_table[letter_px]), LV_OPA_COVER);
}
if(col_bit < 8 - bpp) {
col_bit += bpp;
mask = mask >> bpp;
} else {
col_bit = 0;
col_byte_cnt ++;
mask = mask_init;
map_p ++;
}
}
map_p += (width_byte_bpp) - col_byte_cnt;
}
}
/**
* When the letter is ant-aliased it needs to know the background color
* @param bg_color the background color of the currently drawn letter
*/
void lv_rletter_set_background(lv_color_t color)
{
letter_bg_color = color;
}
/**
* Draw a color map to the display (image)
* @param cords_p coordinates the color map
* @param mask_p the map will drawn only on this area
* @param map_p pointer to a lv_color_t array
* @param opa opacity of the map (ignored, only for compatibility with 'lv_vmap')
* @param chroma_keyed true: enable transparency of LV_IMG_LV_COLOR_TRANSP color pixels
* @param alpha_byte true: extra alpha byte is inserted for every pixel (not supported, only l'v_vmap' can draw it)
* @param recolor mix the pixels with this color
* @param recolor_opa the intense of recoloring
*/
void lv_rmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
lv_color_t recolor, lv_opa_t recolor_opa)
{
if(alpha_byte) return; /*Pixel level opacity i not supported in real map drawing*/
(void)opa; /*opa is used only for compatibility with lv_vmap*/
lv_area_t masked_a;
bool union_ok;
union_ok = lv_area_intersect(&masked_a, cords_p, mask_p);
/*If there are common part of the mask and map then draw the map*/
if(union_ok == false) return;
lv_disp_t * disp = lv_refr_get_disp_refreshing();
if(disp->driver.disp_map == NULL) return;
/*Go to the first pixel*/
lv_coord_t map_width = lv_area_get_width(cords_p);
map_p += (masked_a.y1 - cords_p->y1) * map_width * sizeof(lv_color_t);
map_p += (masked_a.x1 - cords_p->x1) * sizeof(lv_color_t);
lv_coord_t row;
if(recolor_opa == LV_OPA_TRANSP && chroma_key == false) {
lv_coord_t mask_w = lv_area_get_width(&masked_a) - 1;
for(row = masked_a.y1; row <= masked_a.y2; row++) {
disp->driver.disp_map(masked_a.x1, row, masked_a.x1 + mask_w, row, (lv_color_t *)map_p);
map_p += map_width * sizeof(lv_color_t); /*Next row on the map*/
}
} else {
lv_color_t chroma_key_color = LV_COLOR_TRANSP;
lv_coord_t col;
for(row = masked_a.y1; row <= masked_a.y2; row++) {
for(col = masked_a.x1; col <= masked_a.x2; col++) {
lv_color_t * px_color = (lv_color_t *) &map_p[(uint32_t)(col - masked_a.x1) * sizeof(lv_color_t)];
if(chroma_key && chroma_key_color.full == px_color->full) continue;
if(recolor_opa != LV_OPA_TRANSP) {
lv_color_t recolored_px = lv_color_mix(recolor, *px_color, recolor_opa);
lv_rpx(col, row, mask_p, recolored_px, LV_OPA_COVER);
} else {
lv_rpx(col, row, mask_p, *px_color, LV_OPA_COVER);
}
}
map_p += map_width * sizeof(lv_color_t); /*Next row on the map*/
}
}
}
/**********************
* STATIC FUNCTIONS
**********************/
#endif /*USE_LV_REAL_DRAW*/

View File

@@ -1,96 +0,0 @@
/**
* @file lv_draw_rbasic..h
*
*/
#ifndef LV_DRAW_RBASIC_H
#define LV_DRAW_RBASIC_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#ifdef LV_CONF_INCLUDE_SIMPLE
#include "lv_conf.h"
#else
#include "../../lv_conf.h"
#endif
#if USE_LV_REAL_DRAW != 0
#include "../lv_misc/lv_color.h"
#include "../lv_misc/lv_area.h"
#include "../lv_misc/lv_font.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
void lv_rpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t color, lv_opa_t opa);
/**
* Fill an area on the display
* @param cords_p coordinates of the area to fill
* @param mask_p fill only o this mask
* @param color fill color
* @param opa opacity (ignored, only for compatibility with lv_vfill)
*/
void lv_rfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
lv_color_t color, lv_opa_t opa);
/**
* Draw a letter to the display
* @param pos_p left-top coordinate of the latter
* @param mask_p the letter will be drawn only on this area
* @param font_p pointer to font
* @param letter a letter to draw
* @param color color of letter
* @param opa opacity of letter (ignored, only for compatibility with lv_vletter)
*/
void lv_rletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
const lv_font_t * font_p, uint32_t letter,
lv_color_t color, lv_opa_t opa);
/**
* When the letter is ant-aliased it needs to know the background color
* @param bg_color the background color of the currently drawn letter
*/
void lv_rletter_set_background(lv_color_t color);
/**
* Draw a color map to the display (image)
* @param cords_p coordinates the color map
* @param mask_p the map will drawn only on this area
* @param map_p pointer to a lv_color_t array
* @param opa opacity of the map (ignored, only for compatibility with 'lv_vmap')
* @param chroma_keyed true: enable transparency of LV_IMG_LV_COLOR_TRANSP color pixels
* @param alpha_byte true: extra alpha byte is inserted for every pixel (not supported, only l'v_vmap' can draw it)
* @param recolor mix the pixels with this color
* @param recolor_opa the intense of recoloring
*/
void lv_rmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
lv_color_t recolor, lv_opa_t recolor_opa);
/**********************
* MACROS
**********************/
#endif /*USE_LV_REAL_DRAW*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_DRAW_RBASIC_H*/

View File

@@ -30,7 +30,7 @@ static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t *
static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale);
static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale);
#if USE_LV_SHADOW && LV_VDB_SIZE
#if USE_LV_SHADOW
static void lv_draw_shadow(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale);
static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale);
static void lv_draw_shadow_bottom(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale);
@@ -66,7 +66,7 @@ void lv_draw_rect(const lv_area_t * coords, const lv_area_t * mask, const lv_sty
{
if(lv_area_get_height(coords) < 1 || lv_area_get_width(coords) < 1) return;
#if USE_LV_SHADOW && LV_VDB_SIZE
#if USE_LV_SHADOW
if(style->body.shadow.width != 0) {
lv_draw_shadow(coords, mask, style, opa_scale);
}
@@ -133,7 +133,7 @@ static void lv_draw_rect_main_mid(const lv_area_t * coords, const lv_area_t * ma
#endif
}
fill_fp(&work_area, mask, mcolor, opa);
lv_draw_fill(&work_area, mask, mcolor, opa);
} else {
lv_coord_t row;
lv_coord_t row_start = coords->y1 + radius;
@@ -157,7 +157,7 @@ static void lv_draw_rect_main_mid(const lv_area_t * coords, const lv_area_t * ma
mix = (uint32_t)((uint32_t)(coords->y2 - work_area.y1) * 255) / height;
act_color = lv_color_mix(mcolor, gcolor, mix);
fill_fp(&work_area, mask, act_color, opa);
lv_draw_fill(&work_area, mask, act_color, opa);
}
}
}
@@ -263,19 +263,19 @@ static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t *
aa_opa = opa - lv_draw_aa_get_opa(seg_size, i, opa);
}
px_fp(rb_origo.x + LV_CIRC_OCT2_X(aa_p) + i, rb_origo.y + LV_CIRC_OCT2_Y(aa_p) + 1, mask, aa_color_hor_bottom, aa_opa);
px_fp(lb_origo.x + LV_CIRC_OCT3_X(aa_p) - i, lb_origo.y + LV_CIRC_OCT3_Y(aa_p) + 1, mask, aa_color_hor_bottom, aa_opa);
px_fp(lt_origo.x + LV_CIRC_OCT6_X(aa_p) - i, lt_origo.y + LV_CIRC_OCT6_Y(aa_p) - 1, mask, aa_color_hor_top, aa_opa);
px_fp(rt_origo.x + LV_CIRC_OCT7_X(aa_p) + i, rt_origo.y + LV_CIRC_OCT7_Y(aa_p) - 1, mask, aa_color_hor_top, aa_opa);
lv_draw_px(rb_origo.x + LV_CIRC_OCT2_X(aa_p) + i, rb_origo.y + LV_CIRC_OCT2_Y(aa_p) + 1, mask, aa_color_hor_bottom, aa_opa);
lv_draw_px(lb_origo.x + LV_CIRC_OCT3_X(aa_p) - i, lb_origo.y + LV_CIRC_OCT3_Y(aa_p) + 1, mask, aa_color_hor_bottom, aa_opa);
lv_draw_px(lt_origo.x + LV_CIRC_OCT6_X(aa_p) - i, lt_origo.y + LV_CIRC_OCT6_Y(aa_p) - 1, mask, aa_color_hor_top, aa_opa);
lv_draw_px(rt_origo.x + LV_CIRC_OCT7_X(aa_p) + i, rt_origo.y + LV_CIRC_OCT7_Y(aa_p) - 1, mask, aa_color_hor_top, aa_opa);
mix = (uint32_t)((uint32_t)(radius - out_y_seg_start + i) * 255) / height;
aa_color_ver = lv_color_mix(mcolor, gcolor, mix);
px_fp(rb_origo.x + LV_CIRC_OCT1_X(aa_p) + 1, rb_origo.y + LV_CIRC_OCT1_Y(aa_p) + i, mask, aa_color_ver, aa_opa);
px_fp(lb_origo.x + LV_CIRC_OCT4_X(aa_p) - 1, lb_origo.y + LV_CIRC_OCT4_Y(aa_p) + i, mask, aa_color_ver, aa_opa);
lv_draw_px(rb_origo.x + LV_CIRC_OCT1_X(aa_p) + 1, rb_origo.y + LV_CIRC_OCT1_Y(aa_p) + i, mask, aa_color_ver, aa_opa);
lv_draw_px(lb_origo.x + LV_CIRC_OCT4_X(aa_p) - 1, lb_origo.y + LV_CIRC_OCT4_Y(aa_p) + i, mask, aa_color_ver, aa_opa);
aa_color_ver = lv_color_mix(gcolor, mcolor, mix);
px_fp(lt_origo.x + LV_CIRC_OCT5_X(aa_p) - 1, lt_origo.y + LV_CIRC_OCT5_Y(aa_p) - i, mask, aa_color_ver, aa_opa);
px_fp(rt_origo.x + LV_CIRC_OCT8_X(aa_p) + 1, rt_origo.y + LV_CIRC_OCT8_Y(aa_p) - i, mask, aa_color_ver, aa_opa);
lv_draw_px(lt_origo.x + LV_CIRC_OCT5_X(aa_p) - 1, lt_origo.y + LV_CIRC_OCT5_Y(aa_p) - i, mask, aa_color_ver, aa_opa);
lv_draw_px(rt_origo.x + LV_CIRC_OCT8_X(aa_p) + 1, rt_origo.y + LV_CIRC_OCT8_Y(aa_p) - i, mask, aa_color_ver, aa_opa);
}
out_x_last = cir.x;
@@ -304,7 +304,7 @@ static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t *
mix = (uint32_t)((uint32_t)(coords->y2 - edge_top_area.y1) * 255) / height;
act_color = lv_color_mix(mcolor, gcolor, mix);
}
fill_fp(&edge_top_area, mask, act_color, opa);
lv_draw_fill(&edge_top_area, mask, act_color, opa);
}
if(mid_top_refr != 0) {
@@ -313,7 +313,7 @@ static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t *
mix = (uint32_t)((uint32_t)(coords->y2 - mid_top_area.y1) * 255) / height;
act_color = lv_color_mix(mcolor, gcolor, mix);
}
fill_fp(&mid_top_area, mask, act_color, opa);
lv_draw_fill(&mid_top_area, mask, act_color, opa);
}
if(mid_bot_refr != 0) {
@@ -322,7 +322,7 @@ static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t *
mix = (uint32_t)((uint32_t)(coords->y2 - mid_bot_area.y1) * 255) / height;
act_color = lv_color_mix(mcolor, gcolor, mix);
}
fill_fp(&mid_bot_area, mask, act_color, opa);
lv_draw_fill(&mid_bot_area, mask, act_color, opa);
}
if(edge_bot_refr != 0) {
@@ -332,7 +332,7 @@ static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t *
mix = (uint32_t)((uint32_t)(coords->y2 - edge_bot_area.y1) * 255) / height;
act_color = lv_color_mix(mcolor, gcolor, mix);
}
fill_fp(&edge_bot_area, mask, act_color, opa);
lv_draw_fill(&edge_bot_area, mask, act_color, opa);
}
/*Save the current coordinates*/
@@ -364,7 +364,7 @@ static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t *
mix = (uint32_t)((uint32_t)(coords->y2 - edge_top_area.y1) * 255) / height;
act_color = lv_color_mix(mcolor, gcolor, mix);
}
fill_fp(&edge_top_area, mask, act_color, opa);
lv_draw_fill(&edge_top_area, mask, act_color, opa);
if(edge_top_area.y1 != mid_top_area.y1) {
@@ -373,7 +373,7 @@ static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t *
mix = (uint32_t)((uint32_t)(coords->y2 - mid_top_area.y1) * 255) / height;
act_color = lv_color_mix(mcolor, gcolor, mix);
}
fill_fp(&mid_top_area, mask, act_color, opa);
lv_draw_fill(&mid_top_area, mask, act_color, opa);
}
if(mcolor.full == gcolor.full) act_color = mcolor;
@@ -381,7 +381,7 @@ static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t *
mix = (uint32_t)((uint32_t)(coords->y2 - mid_bot_area.y1) * 255) / height;
act_color = lv_color_mix(mcolor, gcolor, mix);
}
fill_fp(&mid_bot_area, mask, act_color, opa);
lv_draw_fill(&mid_bot_area, mask, act_color, opa);
if(edge_bot_area.y1 != mid_bot_area.y1) {
@@ -390,7 +390,7 @@ static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t *
mix = (uint32_t)((uint32_t)(coords->y2 - edge_bot_area.y1) * 255) / height;
act_color = lv_color_mix(mcolor, gcolor, mix);
}
fill_fp(&edge_bot_area, mask, act_color, opa);
lv_draw_fill(&edge_bot_area, mask, act_color, opa);
}
@@ -400,11 +400,11 @@ static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t *
edge_top_area.x2 = coords->x2 - radius - 2;
edge_top_area.y1 = coords->y1;
edge_top_area.y2 = coords->y1;
fill_fp(&edge_top_area, mask, style->body.main_color, opa);
lv_draw_fill(&edge_top_area, mask, style->body.main_color, opa);
edge_top_area.y1 = coords->y2;
edge_top_area.y2 = coords->y2;
fill_fp(&edge_top_area, mask, style->body.grad_color, opa);
lv_draw_fill(&edge_top_area, mask, style->body.grad_color, opa);
/*Last parts of the anti-alias*/
out_y_seg_end = cir.y;
@@ -421,19 +421,19 @@ static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t *
lv_coord_t i;
for(i = 0; i < seg_size; i++) {
lv_opa_t aa_opa = opa - lv_draw_aa_get_opa(seg_size, i, opa);
px_fp(rb_origo.x + LV_CIRC_OCT2_X(aa_p) + i, rb_origo.y + LV_CIRC_OCT2_Y(aa_p) + 1, mask, aa_color_hor_top, aa_opa);
px_fp(lb_origo.x + LV_CIRC_OCT3_X(aa_p) - i, lb_origo.y + LV_CIRC_OCT3_Y(aa_p) + 1, mask, aa_color_hor_top, aa_opa);
px_fp(lt_origo.x + LV_CIRC_OCT6_X(aa_p) - i, lt_origo.y + LV_CIRC_OCT6_Y(aa_p) - 1, mask, aa_color_hor_bottom, aa_opa);
px_fp(rt_origo.x + LV_CIRC_OCT7_X(aa_p) + i, rt_origo.y + LV_CIRC_OCT7_Y(aa_p) - 1, mask, aa_color_hor_bottom, aa_opa);
lv_draw_px(rb_origo.x + LV_CIRC_OCT2_X(aa_p) + i, rb_origo.y + LV_CIRC_OCT2_Y(aa_p) + 1, mask, aa_color_hor_top, aa_opa);
lv_draw_px(lb_origo.x + LV_CIRC_OCT3_X(aa_p) - i, lb_origo.y + LV_CIRC_OCT3_Y(aa_p) + 1, mask, aa_color_hor_top, aa_opa);
lv_draw_px(lt_origo.x + LV_CIRC_OCT6_X(aa_p) - i, lt_origo.y + LV_CIRC_OCT6_Y(aa_p) - 1, mask, aa_color_hor_bottom, aa_opa);
lv_draw_px(rt_origo.x + LV_CIRC_OCT7_X(aa_p) + i, rt_origo.y + LV_CIRC_OCT7_Y(aa_p) - 1, mask, aa_color_hor_bottom, aa_opa);
mix = (uint32_t)((uint32_t)(radius - out_y_seg_start + i) * 255) / height;
aa_color_ver = lv_color_mix(mcolor, gcolor, mix);
px_fp(rb_origo.x + LV_CIRC_OCT1_X(aa_p) + 1, rb_origo.y + LV_CIRC_OCT1_Y(aa_p) + i, mask, aa_color_ver, aa_opa);
px_fp(lb_origo.x + LV_CIRC_OCT4_X(aa_p) - 1, lb_origo.y + LV_CIRC_OCT4_Y(aa_p) + i, mask, aa_color_ver, aa_opa);
lv_draw_px(rb_origo.x + LV_CIRC_OCT1_X(aa_p) + 1, rb_origo.y + LV_CIRC_OCT1_Y(aa_p) + i, mask, aa_color_ver, aa_opa);
lv_draw_px(lb_origo.x + LV_CIRC_OCT4_X(aa_p) - 1, lb_origo.y + LV_CIRC_OCT4_Y(aa_p) + i, mask, aa_color_ver, aa_opa);
aa_color_ver = lv_color_mix(gcolor, mcolor, mix);
px_fp(lt_origo.x + LV_CIRC_OCT5_X(aa_p) - 1, lt_origo.y + LV_CIRC_OCT5_Y(aa_p) - i, mask, aa_color_ver, aa_opa);
px_fp(rt_origo.x + LV_CIRC_OCT8_X(aa_p) + 1, rt_origo.y + LV_CIRC_OCT8_Y(aa_p) - i, mask, aa_color_ver, aa_opa);
lv_draw_px(lt_origo.x + LV_CIRC_OCT5_X(aa_p) - 1, lt_origo.y + LV_CIRC_OCT5_Y(aa_p) - i, mask, aa_color_ver, aa_opa);
lv_draw_px(rt_origo.x + LV_CIRC_OCT8_X(aa_p) + 1, rt_origo.y + LV_CIRC_OCT8_Y(aa_p) - i, mask, aa_color_ver, aa_opa);
}
/*In some cases the last pixel is not drawn*/
@@ -446,10 +446,10 @@ static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t *
aa_color_hor_bottom = lv_color_mix(mcolor, gcolor, mix);
lv_opa_t aa_opa = opa >> 1;
px_fp(rb_origo.x + LV_CIRC_OCT2_X(aa_p), rb_origo.y + LV_CIRC_OCT2_Y(aa_p), mask, aa_color_hor_bottom, aa_opa);
px_fp(lb_origo.x + LV_CIRC_OCT4_X(aa_p), lb_origo.y + LV_CIRC_OCT4_Y(aa_p), mask, aa_color_hor_bottom, aa_opa);
px_fp(lt_origo.x + LV_CIRC_OCT6_X(aa_p), lt_origo.y + LV_CIRC_OCT6_Y(aa_p), mask, aa_color_hor_top, aa_opa);
px_fp(rt_origo.x + LV_CIRC_OCT8_X(aa_p), rt_origo.y + LV_CIRC_OCT8_Y(aa_p), mask, aa_color_hor_top, aa_opa);
lv_draw_px(rb_origo.x + LV_CIRC_OCT2_X(aa_p), rb_origo.y + LV_CIRC_OCT2_Y(aa_p), mask, aa_color_hor_bottom, aa_opa);
lv_draw_px(lb_origo.x + LV_CIRC_OCT4_X(aa_p), lb_origo.y + LV_CIRC_OCT4_Y(aa_p), mask, aa_color_hor_bottom, aa_opa);
lv_draw_px(lt_origo.x + LV_CIRC_OCT6_X(aa_p), lt_origo.y + LV_CIRC_OCT6_Y(aa_p), mask, aa_color_hor_top, aa_opa);
lv_draw_px(rt_origo.x + LV_CIRC_OCT8_X(aa_p), rt_origo.y + LV_CIRC_OCT8_Y(aa_p), mask, aa_color_hor_top, aa_opa);
}
#endif
@@ -498,7 +498,7 @@ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area
work_area.x2 = coords->x2;
work_area.y1 = coords->y1;
work_area.y2 = coords->y1 + bwidth;
fill_fp(&work_area, mask, color, opa);
lv_draw_fill(&work_area, mask, color, opa);
}
/*Right top corner*/
@@ -507,7 +507,7 @@ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area
work_area.x2 = coords->x2;
work_area.y1 = coords->y1 + (part & LV_BORDER_TOP ? bwidth + 1 : 0);
work_area.y2 = coords->y2 - (part & LV_BORDER_BOTTOM ? bwidth + 1 : 0);
fill_fp(&work_area, mask, color, opa);
lv_draw_fill(&work_area, mask, color, opa);
}
/*Left bottom corner*/
@@ -516,7 +516,7 @@ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area
work_area.x2 = coords->x1 + bwidth;
work_area.y1 = coords->y1 + (part & LV_BORDER_TOP ? bwidth + 1 : 0);
work_area.y2 = coords->y2 - (part & LV_BORDER_BOTTOM ? bwidth + 1 : 0);
fill_fp(&work_area, mask, color, opa);
lv_draw_fill(&work_area, mask, color, opa);
}
/*Right bottom corner*/
@@ -525,7 +525,7 @@ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area
work_area.x2 = coords->x2;
work_area.y1 = coords->y2 - bwidth;
work_area.y2 = coords->y2;
fill_fp(&work_area, mask, color, opa);
lv_draw_fill(&work_area, mask, color, opa);
}
return;
}
@@ -544,14 +544,14 @@ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area
if(part & LV_BORDER_LEFT) {
work_area.x1 = coords->x1;
work_area.x2 = work_area.x1 + bwidth;
fill_fp(&work_area, mask, color, opa);
lv_draw_fill(&work_area, mask, color, opa);
}
/*Right border*/
if(part & LV_BORDER_RIGHT) {
work_area.x2 = coords->x2;
work_area.x1 = work_area.x2 - bwidth;
fill_fp(&work_area, mask, color, opa);
lv_draw_fill(&work_area, mask, color, opa);
}
work_area.x1 = coords->x1 + corner_size - length_corr;
@@ -561,14 +561,14 @@ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area
if(part & LV_BORDER_TOP) {
work_area.y1 = coords->y1;
work_area.y2 = coords->y1 + bwidth;
fill_fp(&work_area, mask, color, opa);
lv_draw_fill(&work_area, mask, color, opa);
}
/*Lower border*/
if(part & LV_BORDER_BOTTOM) {
work_area.y2 = coords->y2;
work_area.y1 = work_area.y2 - bwidth;
fill_fp(&work_area, mask, color, opa);
lv_draw_fill(&work_area, mask, color, opa);
}
/*Draw the a remaining rectangles if the radius is smaller then bwidth */
@@ -579,7 +579,7 @@ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area
work_area.x2 = coords->x1 + radius + LV_ANTIALIAS;
work_area.y1 = coords->y1 + radius + 1 + LV_ANTIALIAS;
work_area.y2 = coords->y1 + bwidth;
fill_fp(&work_area, mask, color, opa);
lv_draw_fill(&work_area, mask, color, opa);
}
/*Right top correction*/
@@ -588,7 +588,7 @@ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area
work_area.x2 = coords->x2;
work_area.y1 = coords->y1 + radius + 1 + LV_ANTIALIAS;
work_area.y2 = coords->y1 + bwidth;
fill_fp(&work_area, mask, color, opa);
lv_draw_fill(&work_area, mask, color, opa);
}
/*Left bottom correction*/
@@ -597,7 +597,7 @@ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area
work_area.x2 = coords->x1 + radius + LV_ANTIALIAS;
work_area.y1 = coords->y2 - bwidth;
work_area.y2 = coords->y2 - radius - 1 - LV_ANTIALIAS;
fill_fp(&work_area, mask, color, opa);
lv_draw_fill(&work_area, mask, color, opa);
}
/*Right bottom correction*/
@@ -606,7 +606,7 @@ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area
work_area.x2 = coords->x2;
work_area.y1 = coords->y2 - bwidth;
work_area.y2 = coords->y2 - radius - 1 - LV_ANTIALIAS;
fill_fp(&work_area, mask, color, opa);
lv_draw_fill(&work_area, mask, color, opa);
}
}
@@ -618,7 +618,7 @@ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area
work_area.x2 = coords->x1 + LV_ANTIALIAS;
work_area.y1 = coords->y1;
work_area.y2 = coords->y1 + LV_ANTIALIAS;
fill_fp(&work_area, mask, color, opa);
lv_draw_fill(&work_area, mask, color, opa);
}
/*Right top corner*/
@@ -627,7 +627,7 @@ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area
work_area.x2 = coords->x2;
work_area.y1 = coords->y1;
work_area.y2 = coords->y1 + LV_ANTIALIAS;
fill_fp(&work_area, mask, color, opa);
lv_draw_fill(&work_area, mask, color, opa);
}
/*Left bottom corner*/
@@ -636,7 +636,7 @@ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area
work_area.x2 = coords->x1 + LV_ANTIALIAS;
work_area.y1 = coords->y2 - LV_ANTIALIAS;
work_area.y2 = coords->y2;
fill_fp(&work_area, mask, color, opa);
lv_draw_fill(&work_area, mask, color, opa);
}
/*Right bottom corner*/
@@ -645,7 +645,7 @@ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area
work_area.x2 = coords->x2;
work_area.y1 = coords->y2 - LV_ANTIALIAS;
work_area.y2 = coords->y2;
fill_fp(&work_area, mask, color, opa);
lv_draw_fill(&work_area, mask, color, opa);
}
}
}
@@ -756,24 +756,24 @@ static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t
}
if((part & LV_BORDER_BOTTOM) && (part & LV_BORDER_RIGHT)) {
px_fp(rb_origo.x + LV_CIRC_OCT1_X(aa_p) + 1, rb_origo.y + LV_CIRC_OCT1_Y(aa_p) + i, mask, style->body.border.color, aa_opa);
px_fp(rb_origo.x + LV_CIRC_OCT2_X(aa_p) + i, rb_origo.y + LV_CIRC_OCT2_Y(aa_p) + 1, mask, style->body.border.color, aa_opa);
lv_draw_px(rb_origo.x + LV_CIRC_OCT1_X(aa_p) + 1, rb_origo.y + LV_CIRC_OCT1_Y(aa_p) + i, mask, style->body.border.color, aa_opa);
lv_draw_px(rb_origo.x + LV_CIRC_OCT2_X(aa_p) + i, rb_origo.y + LV_CIRC_OCT2_Y(aa_p) + 1, mask, style->body.border.color, aa_opa);
}
if((part & LV_BORDER_BOTTOM) && (part & LV_BORDER_LEFT)) {
px_fp(lb_origo.x + LV_CIRC_OCT3_X(aa_p) - i, lb_origo.y + LV_CIRC_OCT3_Y(aa_p) + 1, mask, style->body.border.color, aa_opa);
px_fp(lb_origo.x + LV_CIRC_OCT4_X(aa_p) - 1, lb_origo.y + LV_CIRC_OCT4_Y(aa_p) + i, mask, style->body.border.color, aa_opa);
lv_draw_px(lb_origo.x + LV_CIRC_OCT3_X(aa_p) - i, lb_origo.y + LV_CIRC_OCT3_Y(aa_p) + 1, mask, style->body.border.color, aa_opa);
lv_draw_px(lb_origo.x + LV_CIRC_OCT4_X(aa_p) - 1, lb_origo.y + LV_CIRC_OCT4_Y(aa_p) + i, mask, style->body.border.color, aa_opa);
}
if((part & LV_BORDER_TOP) && (part & LV_BORDER_LEFT)) {
px_fp(lt_origo.x + LV_CIRC_OCT5_X(aa_p) - 1, lt_origo.y + LV_CIRC_OCT5_Y(aa_p) - i, mask, style->body.border.color, aa_opa);
px_fp(lt_origo.x + LV_CIRC_OCT6_X(aa_p) - i, lt_origo.y + LV_CIRC_OCT6_Y(aa_p) - 1, mask, style->body.border.color, aa_opa);
lv_draw_px(lt_origo.x + LV_CIRC_OCT5_X(aa_p) - 1, lt_origo.y + LV_CIRC_OCT5_Y(aa_p) - i, mask, style->body.border.color, aa_opa);
lv_draw_px(lt_origo.x + LV_CIRC_OCT6_X(aa_p) - i, lt_origo.y + LV_CIRC_OCT6_Y(aa_p) - 1, mask, style->body.border.color, aa_opa);
}
if((part & LV_BORDER_TOP) && (part & LV_BORDER_RIGHT)) {
px_fp(rt_origo.x + LV_CIRC_OCT7_X(aa_p) + i, rt_origo.y + LV_CIRC_OCT7_Y(aa_p) - 1, mask, style->body.border.color, aa_opa);
px_fp(rt_origo.x + LV_CIRC_OCT8_X(aa_p) + 1, rt_origo.y + LV_CIRC_OCT8_Y(aa_p) - i, mask, style->body.border.color, aa_opa);
lv_draw_px(rt_origo.x + LV_CIRC_OCT7_X(aa_p) + i, rt_origo.y + LV_CIRC_OCT7_Y(aa_p) - 1, mask, style->body.border.color, aa_opa);
lv_draw_px(rt_origo.x + LV_CIRC_OCT8_X(aa_p) + 1, rt_origo.y + LV_CIRC_OCT8_Y(aa_p) - i, mask, style->body.border.color, aa_opa);
}
}
@@ -801,37 +801,37 @@ static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t
}
if((part & LV_BORDER_BOTTOM) && (part & LV_BORDER_RIGHT)) {
px_fp(rb_origo.x + LV_CIRC_OCT1_X(aa_p) - 1, rb_origo.y + LV_CIRC_OCT1_Y(aa_p) + i, mask, style->body.border.color, aa_opa);
lv_draw_px(rb_origo.x + LV_CIRC_OCT1_X(aa_p) - 1, rb_origo.y + LV_CIRC_OCT1_Y(aa_p) + i, mask, style->body.border.color, aa_opa);
}
if((part & LV_BORDER_BOTTOM) && (part & LV_BORDER_LEFT)) {
px_fp(lb_origo.x + LV_CIRC_OCT3_X(aa_p) - i, lb_origo.y + LV_CIRC_OCT3_Y(aa_p) - 1, mask, style->body.border.color, aa_opa);
lv_draw_px(lb_origo.x + LV_CIRC_OCT3_X(aa_p) - i, lb_origo.y + LV_CIRC_OCT3_Y(aa_p) - 1, mask, style->body.border.color, aa_opa);
}
if((part & LV_BORDER_TOP) && (part & LV_BORDER_LEFT)) {
px_fp(lt_origo.x + LV_CIRC_OCT5_X(aa_p) + 1, lt_origo.y + LV_CIRC_OCT5_Y(aa_p) - i, mask, style->body.border.color, aa_opa);
lv_draw_px(lt_origo.x + LV_CIRC_OCT5_X(aa_p) + 1, lt_origo.y + LV_CIRC_OCT5_Y(aa_p) - i, mask, style->body.border.color, aa_opa);
}
if((part & LV_BORDER_TOP) && (part & LV_BORDER_RIGHT)) {
px_fp(rt_origo.x + LV_CIRC_OCT7_X(aa_p) + i, rt_origo.y + LV_CIRC_OCT7_Y(aa_p) + 1, mask, style->body.border.color, aa_opa);
lv_draw_px(rt_origo.x + LV_CIRC_OCT7_X(aa_p) + i, rt_origo.y + LV_CIRC_OCT7_Y(aa_p) + 1, mask, style->body.border.color, aa_opa);
}
/*Be sure the pixels on the middle are not drawn twice*/
if(LV_CIRC_OCT1_X(aa_p) - 1 != LV_CIRC_OCT2_X(aa_p) + i) {
if((part & LV_BORDER_BOTTOM) && (part & LV_BORDER_RIGHT)) {
px_fp(rb_origo.x + LV_CIRC_OCT2_X(aa_p) + i, rb_origo.y + LV_CIRC_OCT2_Y(aa_p) - 1, mask, style->body.border.color, aa_opa);
lv_draw_px(rb_origo.x + LV_CIRC_OCT2_X(aa_p) + i, rb_origo.y + LV_CIRC_OCT2_Y(aa_p) - 1, mask, style->body.border.color, aa_opa);
}
if((part & LV_BORDER_BOTTOM) && (part & LV_BORDER_LEFT)) {
px_fp(lb_origo.x + LV_CIRC_OCT4_X(aa_p) + 1, lb_origo.y + LV_CIRC_OCT4_Y(aa_p) + i, mask, style->body.border.color, aa_opa);
lv_draw_px(lb_origo.x + LV_CIRC_OCT4_X(aa_p) + 1, lb_origo.y + LV_CIRC_OCT4_Y(aa_p) + i, mask, style->body.border.color, aa_opa);
}
if((part & LV_BORDER_TOP) && (part & LV_BORDER_LEFT)) {
px_fp(lt_origo.x + LV_CIRC_OCT6_X(aa_p) - i, lt_origo.y + LV_CIRC_OCT6_Y(aa_p) + 1, mask, style->body.border.color, aa_opa);
lv_draw_px(lt_origo.x + LV_CIRC_OCT6_X(aa_p) - i, lt_origo.y + LV_CIRC_OCT6_Y(aa_p) + 1, mask, style->body.border.color, aa_opa);
}
if((part & LV_BORDER_TOP) && (part & LV_BORDER_RIGHT)) {
px_fp(rt_origo.x + LV_CIRC_OCT8_X(aa_p) - 1, rt_origo.y + LV_CIRC_OCT8_Y(aa_p) - i, mask, style->body.border.color, aa_opa);
lv_draw_px(rt_origo.x + LV_CIRC_OCT8_X(aa_p) - 1, rt_origo.y + LV_CIRC_OCT8_Y(aa_p) - i, mask, style->body.border.color, aa_opa);
}
}
@@ -851,13 +851,13 @@ static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t
circ_area.x2 = rb_origo.x + LV_CIRC_OCT1_X(cir_out);
circ_area.y1 = rb_origo.y + LV_CIRC_OCT1_Y(cir_out);
circ_area.y2 = rb_origo.y + LV_CIRC_OCT1_Y(cir_out);
fill_fp(&circ_area, mask, color, opa);
lv_draw_fill(&circ_area, mask, color, opa);
circ_area.x1 = rb_origo.x + LV_CIRC_OCT2_X(cir_out);
circ_area.x2 = rb_origo.x + LV_CIRC_OCT2_X(cir_out);
circ_area.y1 = rb_origo.y + LV_CIRC_OCT2_Y(cir_out) - act_w1;
circ_area.y2 = rb_origo.y + LV_CIRC_OCT2_Y(cir_out);
fill_fp(&circ_area, mask, color, opa);
lv_draw_fill(&circ_area, mask, color, opa);
}
/*Draw the octets to the left bottom corner*/
@@ -866,13 +866,13 @@ static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t
circ_area.x2 = lb_origo.x + LV_CIRC_OCT3_X(cir_out);
circ_area.y1 = lb_origo.y + LV_CIRC_OCT3_Y(cir_out) - act_w2;
circ_area.y2 = lb_origo.y + LV_CIRC_OCT3_Y(cir_out);
fill_fp(&circ_area, mask, color, opa);
lv_draw_fill(&circ_area, mask, color, opa);
circ_area.x1 = lb_origo.x + LV_CIRC_OCT4_X(cir_out);
circ_area.x2 = lb_origo.x + LV_CIRC_OCT4_X(cir_out) + act_w1;
circ_area.y1 = lb_origo.y + LV_CIRC_OCT4_Y(cir_out);
circ_area.y2 = lb_origo.y + LV_CIRC_OCT4_Y(cir_out);
fill_fp(&circ_area, mask, color, opa);
lv_draw_fill(&circ_area, mask, color, opa);
}
/*Draw the octets to the left top corner*/
@@ -883,14 +883,14 @@ static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t
circ_area.x2 = lt_origo.x + LV_CIRC_OCT5_X(cir_out) + act_w2;
circ_area.y1 = lt_origo.y + LV_CIRC_OCT5_Y(cir_out);
circ_area.y2 = lt_origo.y + LV_CIRC_OCT5_Y(cir_out);
fill_fp(&circ_area, mask, color, opa);
lv_draw_fill(&circ_area, mask, color, opa);
}
circ_area.x1 = lt_origo.x + LV_CIRC_OCT6_X(cir_out);
circ_area.x2 = lt_origo.x + LV_CIRC_OCT6_X(cir_out);
circ_area.y1 = lt_origo.y + LV_CIRC_OCT6_Y(cir_out);
circ_area.y2 = lt_origo.y + LV_CIRC_OCT6_Y(cir_out) + act_w1;
fill_fp(&circ_area, mask, color, opa);
lv_draw_fill(&circ_area, mask, color, opa);
}
/*Draw the octets to the right top corner*/
@@ -899,7 +899,7 @@ static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t
circ_area.x2 = rt_origo.x + LV_CIRC_OCT7_X(cir_out);
circ_area.y1 = rt_origo.y + LV_CIRC_OCT7_Y(cir_out);
circ_area.y2 = rt_origo.y + LV_CIRC_OCT7_Y(cir_out) + act_w2;
fill_fp(&circ_area, mask, color, opa);
lv_draw_fill(&circ_area, mask, color, opa);
/*Don't draw if the lines are common in the middle*/
if(rb_origo.y + LV_CIRC_OCT1_Y(cir_out) > rt_origo.y + LV_CIRC_OCT8_Y(cir_out)) {
@@ -907,7 +907,7 @@ static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t
circ_area.x2 = rt_origo.x + LV_CIRC_OCT8_X(cir_out);
circ_area.y1 = rt_origo.y + LV_CIRC_OCT8_Y(cir_out);
circ_area.y2 = rt_origo.y + LV_CIRC_OCT8_Y(cir_out);
fill_fp(&circ_area, mask, color, opa);
lv_draw_fill(&circ_area, mask, color, opa);
}
}
lv_circ_next(&cir_out, &tmp_out);
@@ -934,23 +934,23 @@ static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t
for(i = 0; i < seg_size; i++) {
lv_opa_t aa_opa = opa - lv_draw_aa_get_opa(seg_size, i, opa);
if((part & LV_BORDER_BOTTOM) && (part & LV_BORDER_RIGHT)) {
px_fp(rb_origo.x + LV_CIRC_OCT1_X(aa_p) + 1, rb_origo.y + LV_CIRC_OCT1_Y(aa_p) + i, mask, style->body.border.color, aa_opa);
px_fp(rb_origo.x + LV_CIRC_OCT2_X(aa_p) + i, rb_origo.y + LV_CIRC_OCT2_Y(aa_p) + 1, mask, style->body.border.color, aa_opa);
lv_draw_px(rb_origo.x + LV_CIRC_OCT1_X(aa_p) + 1, rb_origo.y + LV_CIRC_OCT1_Y(aa_p) + i, mask, style->body.border.color, aa_opa);
lv_draw_px(rb_origo.x + LV_CIRC_OCT2_X(aa_p) + i, rb_origo.y + LV_CIRC_OCT2_Y(aa_p) + 1, mask, style->body.border.color, aa_opa);
}
if((part & LV_BORDER_BOTTOM) && (part & LV_BORDER_LEFT)) {
px_fp(lb_origo.x + LV_CIRC_OCT3_X(aa_p) - i, lb_origo.y + LV_CIRC_OCT3_Y(aa_p) + 1, mask, style->body.border.color, aa_opa);
px_fp(lb_origo.x + LV_CIRC_OCT4_X(aa_p) - 1, lb_origo.y + LV_CIRC_OCT4_Y(aa_p) + i, mask, style->body.border.color, aa_opa);
lv_draw_px(lb_origo.x + LV_CIRC_OCT3_X(aa_p) - i, lb_origo.y + LV_CIRC_OCT3_Y(aa_p) + 1, mask, style->body.border.color, aa_opa);
lv_draw_px(lb_origo.x + LV_CIRC_OCT4_X(aa_p) - 1, lb_origo.y + LV_CIRC_OCT4_Y(aa_p) + i, mask, style->body.border.color, aa_opa);
}
if((part & LV_BORDER_TOP) && (part & LV_BORDER_LEFT)) {
px_fp(lt_origo.x + LV_CIRC_OCT5_X(aa_p) - 1, lt_origo.y + LV_CIRC_OCT5_Y(aa_p) - i, mask, style->body.border.color, aa_opa);
px_fp(lt_origo.x + LV_CIRC_OCT6_X(aa_p) - i, lt_origo.y + LV_CIRC_OCT6_Y(aa_p) - 1, mask, style->body.border.color, aa_opa);
lv_draw_px(lt_origo.x + LV_CIRC_OCT5_X(aa_p) - 1, lt_origo.y + LV_CIRC_OCT5_Y(aa_p) - i, mask, style->body.border.color, aa_opa);
lv_draw_px(lt_origo.x + LV_CIRC_OCT6_X(aa_p) - i, lt_origo.y + LV_CIRC_OCT6_Y(aa_p) - 1, mask, style->body.border.color, aa_opa);
}
if((part & LV_BORDER_TOP) && (part & LV_BORDER_RIGHT)) {
px_fp(rt_origo.x + LV_CIRC_OCT7_X(aa_p) + i, rt_origo.y + LV_CIRC_OCT7_Y(aa_p) - 1, mask, style->body.border.color, aa_opa);
px_fp(rt_origo.x + LV_CIRC_OCT8_X(aa_p) + 1, rt_origo.y + LV_CIRC_OCT8_Y(aa_p) - i, mask, style->body.border.color, aa_opa);
lv_draw_px(rt_origo.x + LV_CIRC_OCT7_X(aa_p) + i, rt_origo.y + LV_CIRC_OCT7_Y(aa_p) - 1, mask, style->body.border.color, aa_opa);
lv_draw_px(rt_origo.x + LV_CIRC_OCT8_X(aa_p) + 1, rt_origo.y + LV_CIRC_OCT8_Y(aa_p) - i, mask, style->body.border.color, aa_opa);
}
}
@@ -962,19 +962,19 @@ static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t
lv_opa_t aa_opa = opa >> 1;
if((part & LV_BORDER_BOTTOM) && (part & LV_BORDER_RIGHT)) {
px_fp(rb_origo.x + LV_CIRC_OCT2_X(aa_p), rb_origo.y + LV_CIRC_OCT2_Y(aa_p), mask, style->body.border.color, aa_opa);
lv_draw_px(rb_origo.x + LV_CIRC_OCT2_X(aa_p), rb_origo.y + LV_CIRC_OCT2_Y(aa_p), mask, style->body.border.color, aa_opa);
}
if((part & LV_BORDER_BOTTOM) && (part & LV_BORDER_LEFT)) {
px_fp(lb_origo.x + LV_CIRC_OCT4_X(aa_p), lb_origo.y + LV_CIRC_OCT4_Y(aa_p), mask, style->body.border.color, aa_opa);
lv_draw_px(lb_origo.x + LV_CIRC_OCT4_X(aa_p), lb_origo.y + LV_CIRC_OCT4_Y(aa_p), mask, style->body.border.color, aa_opa);
}
if((part & LV_BORDER_TOP) && (part & LV_BORDER_LEFT)) {
px_fp(lt_origo.x + LV_CIRC_OCT6_X(aa_p), lt_origo.y + LV_CIRC_OCT6_Y(aa_p), mask, style->body.border.color, aa_opa);
lv_draw_px(lt_origo.x + LV_CIRC_OCT6_X(aa_p), lt_origo.y + LV_CIRC_OCT6_Y(aa_p), mask, style->body.border.color, aa_opa);
}
if((part & LV_BORDER_TOP) && (part & LV_BORDER_RIGHT)) {
px_fp(rt_origo.x + LV_CIRC_OCT8_X(aa_p), rt_origo.y + LV_CIRC_OCT8_Y(aa_p), mask, style->body.border.color, aa_opa);
lv_draw_px(rt_origo.x + LV_CIRC_OCT8_X(aa_p), rt_origo.y + LV_CIRC_OCT8_Y(aa_p), mask, style->body.border.color, aa_opa);
}
}
@@ -987,36 +987,36 @@ static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t
for(i = 0; i < seg_size; i++) {
lv_opa_t aa_opa = lv_draw_aa_get_opa(seg_size, i, opa);
if((part & LV_BORDER_BOTTOM) && (part & LV_BORDER_RIGHT)) {
px_fp(rb_origo.x + LV_CIRC_OCT1_X(aa_p) - 1, rb_origo.y + LV_CIRC_OCT1_Y(aa_p) + i, mask, style->body.border.color, aa_opa);
lv_draw_px(rb_origo.x + LV_CIRC_OCT1_X(aa_p) - 1, rb_origo.y + LV_CIRC_OCT1_Y(aa_p) + i, mask, style->body.border.color, aa_opa);
}
if((part & LV_BORDER_BOTTOM) && (part & LV_BORDER_LEFT)) {
px_fp(lb_origo.x + LV_CIRC_OCT3_X(aa_p) - i, lb_origo.y + LV_CIRC_OCT3_Y(aa_p) - 1, mask, style->body.border.color, aa_opa);
lv_draw_px(lb_origo.x + LV_CIRC_OCT3_X(aa_p) - i, lb_origo.y + LV_CIRC_OCT3_Y(aa_p) - 1, mask, style->body.border.color, aa_opa);
}
if((part & LV_BORDER_TOP) && (part & LV_BORDER_LEFT)) {
px_fp(lt_origo.x + LV_CIRC_OCT5_X(aa_p) + 1, lt_origo.y + LV_CIRC_OCT5_Y(aa_p) - i, mask, style->body.border.color, aa_opa);
lv_draw_px(lt_origo.x + LV_CIRC_OCT5_X(aa_p) + 1, lt_origo.y + LV_CIRC_OCT5_Y(aa_p) - i, mask, style->body.border.color, aa_opa);
}
if((part & LV_BORDER_TOP) && (part & LV_BORDER_RIGHT)) {
px_fp(rt_origo.x + LV_CIRC_OCT7_X(aa_p) + i, rt_origo.y + LV_CIRC_OCT7_Y(aa_p) + 1, mask, style->body.border.color, aa_opa);
lv_draw_px(rt_origo.x + LV_CIRC_OCT7_X(aa_p) + i, rt_origo.y + LV_CIRC_OCT7_Y(aa_p) + 1, mask, style->body.border.color, aa_opa);
}
if(LV_CIRC_OCT1_X(aa_p) - 1 != LV_CIRC_OCT2_X(aa_p) + i) {
if((part & LV_BORDER_BOTTOM) && (part & LV_BORDER_RIGHT)) {
px_fp(rb_origo.x + LV_CIRC_OCT2_X(aa_p) + i, rb_origo.y + LV_CIRC_OCT2_Y(aa_p) - 1, mask, style->body.border.color, aa_opa);
lv_draw_px(rb_origo.x + LV_CIRC_OCT2_X(aa_p) + i, rb_origo.y + LV_CIRC_OCT2_Y(aa_p) - 1, mask, style->body.border.color, aa_opa);
}
if((part & LV_BORDER_BOTTOM) && (part & LV_BORDER_LEFT)) {
px_fp(lb_origo.x + LV_CIRC_OCT4_X(aa_p) + 1, lb_origo.y + LV_CIRC_OCT4_Y(aa_p) + i, mask, style->body.border.color, aa_opa);
lv_draw_px(lb_origo.x + LV_CIRC_OCT4_X(aa_p) + 1, lb_origo.y + LV_CIRC_OCT4_Y(aa_p) + i, mask, style->body.border.color, aa_opa);
}
if((part & LV_BORDER_TOP) && (part & LV_BORDER_LEFT)) {
px_fp(lt_origo.x + LV_CIRC_OCT6_X(aa_p) - i, lt_origo.y + LV_CIRC_OCT6_Y(aa_p) + 1, mask, style->body.border.color, aa_opa);
lv_draw_px(lt_origo.x + LV_CIRC_OCT6_X(aa_p) - i, lt_origo.y + LV_CIRC_OCT6_Y(aa_p) + 1, mask, style->body.border.color, aa_opa);
}
if((part & LV_BORDER_TOP) && (part & LV_BORDER_RIGHT)) {
px_fp(rt_origo.x + LV_CIRC_OCT8_X(aa_p) - 1, rt_origo.y + LV_CIRC_OCT8_Y(aa_p) - i, mask, style->body.border.color, aa_opa);
lv_draw_px(rt_origo.x + LV_CIRC_OCT8_X(aa_p) - 1, rt_origo.y + LV_CIRC_OCT8_Y(aa_p) - i, mask, style->body.border.color, aa_opa);
}
}
}
@@ -1025,7 +1025,7 @@ static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t
}
#if USE_LV_SHADOW && LV_VDB_SIZE
#if USE_LV_SHADOW
/**
* Draw a shadow
@@ -1203,19 +1203,19 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
for(d = 1; d < col; d++) {
if(point_lt.x < ofs_lt.x && point_lt.y < ofs_lt.y) {
px_fp(point_lt.x, point_lt.y, mask, style->body.shadow.color, line_2d_blur[d]);
lv_draw_px(point_lt.x, point_lt.y, mask, style->body.shadow.color, line_2d_blur[d]);
}
if(point_lb.x < ofs_lb.x && point_lb.y > ofs_lb.y) {
px_fp(point_lb.x, point_lb.y, mask, style->body.shadow.color, line_2d_blur[d]);
lv_draw_px(point_lb.x, point_lb.y, mask, style->body.shadow.color, line_2d_blur[d]);
}
if(point_rt.x > ofs_rt.x && point_rt.y < ofs_rt.y) {
px_fp(point_rt.x, point_rt.y, mask, style->body.shadow.color, line_2d_blur[d]);
lv_draw_px(point_rt.x, point_rt.y, mask, style->body.shadow.color, line_2d_blur[d]);
}
if(point_rb.x > ofs_rb.x && point_rb.y > ofs_rb.y) {
px_fp(point_rb.x, point_rb.y, mask, style->body.shadow.color, line_2d_blur[d]);
lv_draw_px(point_rb.x, point_rb.y, mask, style->body.shadow.color, line_2d_blur[d]);
}
point_rb.x++;
@@ -1306,12 +1306,12 @@ static void lv_draw_shadow_bottom(const lv_area_t * coords, const lv_area_t * ma
} else {
px_opa = (uint16_t)((uint16_t)line_1d_blur[d] + line_1d_blur[d - diff]) >> 1;
}
px_fp(point_l.x, point_l.y, mask, style->body.shadow.color, px_opa);
lv_draw_px(point_l.x, point_l.y, mask, style->body.shadow.color, px_opa);
point_l.y ++;
/*Don't overdraw the pixel on the middle*/
if(point_r.x > ofs_l.x) {
px_fp(point_r.x, point_r.y, mask, style->body.shadow.color, px_opa);
lv_draw_px(point_r.x, point_r.y, mask, style->body.shadow.color, px_opa);
}
point_r.y ++;
}
@@ -1325,7 +1325,7 @@ static void lv_draw_shadow_bottom(const lv_area_t * coords, const lv_area_t * ma
uint16_t d;
for(d = 0; d < swidth; d++) {
fill_fp(&area_mid, mask, style->body.shadow.color, line_1d_blur[d]);
lv_draw_fill(&area_mid, mask, style->body.shadow.color, line_1d_blur[d]);
area_mid.y1 ++;
area_mid.y2 ++;
}
@@ -1370,19 +1370,19 @@ static void lv_draw_shadow_full_straight(const lv_area_t * coords, const lv_area
for(d = 1 /*+ LV_ANTIALIAS*/; d <= swidth/* - LV_ANTIALIAS*/; d++) {
opa_act = map[d];
fill_fp(&right_area, mask, style->body.shadow.color, opa_act);
lv_draw_fill(&right_area, mask, style->body.shadow.color, opa_act);
right_area.x1++;
right_area.x2++;
fill_fp(&left_area, mask, style->body.shadow.color, opa_act);
lv_draw_fill(&left_area, mask, style->body.shadow.color, opa_act);
left_area.x1--;
left_area.x2--;
fill_fp(&top_area, mask, style->body.shadow.color, opa_act);
lv_draw_fill(&top_area, mask, style->body.shadow.color, opa_act);
top_area.y1--;
top_area.y2--;
fill_fp(&bottom_area, mask, style->body.shadow.color, opa_act);
lv_draw_fill(&bottom_area, mask, style->body.shadow.color, opa_act);
bottom_area.y1++;
bottom_area.y2++;
}

View File

@@ -98,7 +98,7 @@ void lv_draw_triangle(const lv_point_t * points, const lv_area_t * mask, lv_colo
draw_area.y1 = LV_MATH_MIN(act_area.y1, act_area.y2);
draw_area.y2 = LV_MATH_MAX(act_area.y1, act_area.y2);
draw_area.x2--; /*Do not draw most right pixel because it will be drawn by the adjacent triangle*/
fill_fp(&draw_area, mask, color, LV_OPA_50);
lv_draw_fill(&draw_area, mask, color, LV_OPA_COVER);
/*Calc. the next point of edge1*/
y1_tmp = edge1.y;

View File

@@ -53,8 +53,6 @@
*/
void lv_disp_drv_init(lv_disp_drv_t * driver)
{
driver->disp_fill = NULL;
driver->disp_map = NULL;
driver->disp_flush = NULL;
driver->hor_res = LV_HOR_RES_MAX;
driver->ver_res = LV_VER_RES_MAX;
@@ -64,13 +62,7 @@ void lv_disp_drv_init(lv_disp_drv_t * driver)
driver->mem_fill = NULL;
#endif
#if LV_VDB_SIZE
driver->vdb_wr = NULL;
driver->vdb = NULL;
driver->vdb2 = NULL;
driver->vdb_size = 0;
driver->vdb_double = 0;
#endif
}
/**
@@ -104,6 +96,11 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
return disp;
}
/**
* Get the next display.
* @param disp pointer to the current display. NULL to initialize.
* @return the next display or NULL if no more. Give the first display when the parameter is NULL
*/
lv_disp_t * lv_disp_get_next(lv_disp_t * disp)
{
if(disp == NULL) return lv_ll_get_head(&LV_GC_ROOT(_lv_disp_ll));
@@ -116,16 +113,9 @@ lv_disp_t * lv_disp_get_last(void)
return lv_ll_get_head(&LV_GC_ROOT(_lv_disp_ll));
}
/**
* Get the next display.
* @param disp pointer to the current display. NULL to initialize.
* @return the next display or NULL if no more. Give the first display when the parameter is NULL
*/
lv_disp_t * lv_disp_next(lv_disp_t * disp)
lv_vdb_t * lv_disp_get_vdb(lv_disp_t * disp)
{
if(disp == NULL) return lv_ll_get_head(&LV_GC_ROOT(_lv_disp_ll));
else return lv_ll_get_next(&LV_GC_ROOT(_lv_disp_ll), disp);
return disp->driver.buffer;
}
lv_coord_t lv_disp_get_hor_res(lv_disp_t * disp)
@@ -145,6 +135,18 @@ lv_coord_t lv_disp_get_ver_res(lv_disp_t * disp)
else return disp->driver.ver_res;
}
bool lv_disp_is_double_vdb(lv_disp_t * disp)
{
if(disp->driver.buffer->buf1 && disp->driver.buffer->buf2) return true;
else return false;
}
bool lv_disp_is_true_double_buffered(lv_disp_t * disp)
{
if(lv_disp_is_double_vdb(disp) && disp->driver.buffer->size == disp->driver.hor_res * disp->driver.ver_res) return true;
else return false;
}
/**********************
* STATIC FUNCTIONS
**********************/

View File

@@ -35,6 +35,25 @@ extern "C" {
struct _disp_t;
typedef struct
{
void * buf_act;
void * buf1;
void * buf2;
uint32_t size; /*In pixel count*/
struct {
uint32_t double_buffered :1;
uint32_t true_double_buffered :1;
}mode;
lv_area_t area;
struct {
uint32_t flushing :1;
}internal;
}lv_vdb_t;
/**
* Display Driver structure to be registered by HAL
*/
@@ -45,15 +64,11 @@ typedef struct _disp_drv_t {
lv_coord_t ver_res;
lv_vdb_t * buffer;
/*Write the internal buffer (VDB) to the display. 'lv_flush_ready()' has to be called when finished*/
void (*disp_flush)(struct _disp_t * disp, const lv_area_t * area, lv_color_t * color_p);
/*Fill an area with a color on the display*/
void (*disp_fill)(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color);
/*Write pixel map (e.g. image) to the display*/
void (*disp_map)(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_p);
/*Optional interface functions to use GPU*/
#if USE_LV_GPU
/*Blend two memories using opacity (GPU only)*/
@@ -63,15 +78,8 @@ typedef struct _disp_drv_t {
void (*mem_fill)(lv_color_t * dest, uint32_t length, lv_color_t color);
#endif
#if LV_VDB_SIZE
void * vdb;
void * vdb2;
uint32_t vdb_size;
uint32_t vdb_double :1;
/*Optional: Set a pixel in a buffer according to the requirements of the display*/
void (*vdb_wr)(uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, lv_color_t color, lv_opa_t opa);
#endif
} lv_disp_drv_t;
struct _lv_obj_t;
@@ -113,6 +121,7 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t *driver);
lv_disp_t * lv_disp_get_last(void);
lv_vdb_t * lv_disp_get_vdb(lv_disp_t * disp);
/**
* Get the next display.
* @param disp pointer to the current display. NULL to initialize.
@@ -124,6 +133,9 @@ lv_disp_t * lv_disp_get_next(lv_disp_t * disp);
lv_coord_t lv_disp_get_hor_res(lv_disp_t * disp);
lv_coord_t lv_disp_get_ver_res(lv_disp_t * disp);
bool lv_disp_is_double_vdb(lv_disp_t * disp);
bool lv_disp_is_true_double_buffered(lv_disp_t * disp);
/**********************
* MACROS
**********************/

View File

@@ -15,7 +15,7 @@
#include <string.h>
#include "../lv_draw/lv_draw.h"
#include "../lv_draw/lv_draw_vbasic.h"
#include "../lv_draw/lv_draw_basic.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_area.h"
#include "../lv_misc/lv_color.h"

1
lvgl.h
View File

@@ -24,7 +24,6 @@ extern "C" {
#include "lv_core/lv_obj.h"
#include "lv_core/lv_group.h"
#include "lv_core/lv_lang.h"
#include "lv_core/lv_vdb.h"
#include "lv_core/lv_refr.h"
#include "lv_core/lv_disp.h"