add lv_design_res_t
This commit is contained in:
1
lvgl.h
1
lvgl.h
@@ -58,6 +58,7 @@ extern "C" {
|
||||
#include "src/lv_objx/lv_tabview.h"
|
||||
#include "src/lv_objx/lv_tileview.h"
|
||||
#include "src/lv_objx/lv_mbox.h"
|
||||
#include "src/lv_objx/lv_objmask.h"
|
||||
#include "src/lv_objx/lv_gauge.h"
|
||||
#include "src/lv_objx/lv_lmeter.h"
|
||||
#include "src/lv_objx/lv_sw.h"
|
||||
|
||||
@@ -52,7 +52,7 @@ static void refresh_children_style(lv_obj_t * obj);
|
||||
static void delete_children(lv_obj_t * obj);
|
||||
static void lv_event_mark_deleted(lv_obj_t * obj);
|
||||
static void lv_obj_del_async_cb(void * obj);
|
||||
static bool lv_obj_design(lv_obj_t * obj, const lv_area_t * mask_p, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_obj_design(lv_obj_t * obj, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
|
||||
|
||||
/**********************
|
||||
@@ -2123,28 +2123,28 @@ static void lv_obj_del_async_cb(void * obj)
|
||||
/**
|
||||
* Handle the drawing related tasks of the base objects.
|
||||
* @param obj pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_obj_design(lv_obj_t * obj, const lv_area_t * mask_p, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_obj_design(lv_obj_t * obj, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
|
||||
/*Most trivial test. Is the mask fully IN the object? If no it surely doesn't cover it*/
|
||||
if(lv_area_is_in(mask_p, &obj->coords) == false) return false;
|
||||
if(lv_area_is_in(clip_area, &obj->coords) == false) return LV_DESIGN_RES_NOT_COVER;
|
||||
|
||||
/*Can cover the area only if fully solid (no opacity)*/
|
||||
const lv_style_t * style = lv_obj_get_style(obj);
|
||||
if(style->body.opa < LV_OPA_MAX) return false;
|
||||
if(style->body.opa < LV_OPA_MAX) return LV_DESIGN_RES_NOT_COVER;
|
||||
|
||||
/* Because of the radius it is not sure the area is covered
|
||||
* Check the areas where there is no radius*/
|
||||
lv_coord_t r = style->body.radius;
|
||||
|
||||
if(r == LV_RADIUS_CIRCLE) return false;
|
||||
if(r == LV_RADIUS_CIRCLE) return LV_DESIGN_RES_NOT_COVER;
|
||||
|
||||
lv_area_t area_tmp;
|
||||
|
||||
@@ -2152,20 +2152,22 @@ static bool lv_obj_design(lv_obj_t * obj, const lv_area_t * mask_p, lv_design_mo
|
||||
lv_obj_get_coords(obj, &area_tmp);
|
||||
area_tmp.x1 += r;
|
||||
area_tmp.x2 -= r;
|
||||
if(lv_area_is_in(mask_p, &area_tmp) == false) return false;
|
||||
if(lv_area_is_in(clip_area, &area_tmp) == false) return LV_DESIGN_RES_NOT_COVER;
|
||||
|
||||
/*Check vertically without radius*/
|
||||
lv_obj_get_coords(obj, &area_tmp);
|
||||
area_tmp.y1 += r;
|
||||
area_tmp.y2 -= r;
|
||||
if(lv_area_is_in(mask_p, &area_tmp) == false) return false;
|
||||
if(lv_area_is_in(clip_area, &area_tmp) == false) return LV_DESIGN_RES_NOT_COVER;
|
||||
|
||||
return LV_DESIGN_RES_COVER;
|
||||
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
const lv_style_t * style = lv_obj_get_style(obj);
|
||||
lv_draw_rect(&obj->coords, mask_p, style, lv_obj_get_opa_scale(obj));
|
||||
lv_draw_rect(&obj->coords, clip_area, style, lv_obj_get_opa_scale(obj));
|
||||
}
|
||||
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -64,11 +64,21 @@ enum {
|
||||
};
|
||||
typedef uint8_t lv_design_mode_t;
|
||||
|
||||
|
||||
/** Design results */
|
||||
enum {
|
||||
LV_DESIGN_RES_OK, /**< Draw ready */
|
||||
LV_DESIGN_RES_COVER, /**< Returned on `LV_DESIGN_COVER_CHK` if the areas is fully covered*/
|
||||
LV_DESIGN_RES_NOT_COVER, /**< Returned on `LV_DESIGN_COVER_CHK` if the areas is not covered*/
|
||||
LV_DESIGN_RES_MASKED, /**< Returned on `LV_DESIGN_COVER_CHK` if the areas is masked out (children also not cover)*/
|
||||
};
|
||||
typedef uint8_t lv_design_res_t;
|
||||
|
||||
/**
|
||||
* The design callback is used to draw the object on the screen.
|
||||
* It accepts the object, a mask area, and the mode in which to draw the object.
|
||||
*/
|
||||
typedef bool (*lv_design_cb_t)(struct _lv_obj_t * obj, const lv_area_t * mask_p, lv_design_mode_t mode);
|
||||
typedef lv_design_res_t (*lv_design_cb_t)(struct _lv_obj_t * obj, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
|
||||
enum {
|
||||
LV_EVENT_PRESSED, /**< The object has been pressed*/
|
||||
|
||||
@@ -419,6 +419,10 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
|
||||
|
||||
/*If this object is fully cover the draw area check the children too */
|
||||
if(lv_area_is_in(area_p, &obj->coords) && obj->hidden == 0) {
|
||||
|
||||
lv_design_res_t design_res = obj->design_cb(obj, area_p, LV_DESIGN_COVER_CHK);
|
||||
if(design_res == LV_DESIGN_RES_MASKED) return NULL;
|
||||
|
||||
lv_obj_t * i;
|
||||
LV_LL_READ(obj->child_ll, i)
|
||||
{
|
||||
@@ -433,7 +437,7 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
|
||||
/*If no better children check this object*/
|
||||
if(found_p == NULL) {
|
||||
const lv_style_t * style = lv_obj_get_style(obj);
|
||||
if(style->body.opa == LV_OPA_COVER && obj->design_cb(obj, area_p, LV_DESIGN_COVER_CHK) != false &&
|
||||
if(style->body.opa == LV_OPA_COVER && design_res == LV_DESIGN_RES_COVER &&
|
||||
lv_obj_get_opa_scale(obj) == LV_OPA_COVER) {
|
||||
found_p = obj;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ void lv_style_init(void)
|
||||
lv_style_pretty.line.color = lv_color_make(0x20, 0x20, 0x20);
|
||||
lv_style_pretty.body.main_color = LV_COLOR_WHITE;
|
||||
lv_style_pretty.body.grad_color = LV_COLOR_SILVER;
|
||||
lv_style_pretty.body.radius = LV_DPI / 15;
|
||||
lv_style_pretty.body.radius = LV_DPI / 5;
|
||||
lv_style_pretty.body.border.color = lv_color_make(0x40, 0x40, 0x40);
|
||||
lv_style_pretty.body.border.width = LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1;
|
||||
lv_style_pretty.body.border.opa = LV_OPA_30;
|
||||
@@ -172,24 +172,24 @@ void lv_style_init(void)
|
||||
lv_style_copy(&lv_style_btn_rel, &lv_style_plain);
|
||||
lv_style_btn_rel.body.main_color = lv_color_make(0x76, 0xa2, 0xd0);
|
||||
lv_style_btn_rel.body.grad_color = lv_color_make(0x19, 0x3a, 0x5d);
|
||||
lv_style_btn_rel.body.radius = LV_RADIUS_CIRCLE; //LV_DPI / 15;
|
||||
lv_style_btn_rel.body.opa = 200;//LV_OPA_COVER;
|
||||
lv_style_btn_rel.body.blend_mode = LV_BLEND_MODE_ADDITIVE;
|
||||
lv_style_btn_rel.body.radius = LV_DPI / 15;
|
||||
lv_style_btn_rel.body.opa = LV_OPA_COVER;
|
||||
// lv_style_btn_rel.body.blend_mode = LV_BLEND_MODE_ADDITIVE;
|
||||
lv_style_btn_rel.body.padding.left = LV_DPI / 4;
|
||||
lv_style_btn_rel.body.padding.right = LV_DPI / 4;
|
||||
lv_style_btn_rel.body.padding.top = LV_DPI / 6;
|
||||
lv_style_btn_rel.body.padding.bottom = LV_DPI / 6;
|
||||
lv_style_btn_rel.body.padding.inner = LV_DPI / 10;
|
||||
lv_style_btn_rel.body.border.color = lv_color_make(0x0b, 0x19, 0x28);
|
||||
lv_style_btn_rel.body.border.width = 0;//LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1;
|
||||
lv_style_btn_rel.body.border.width = LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1;
|
||||
lv_style_btn_rel.body.border.opa = LV_OPA_70;
|
||||
lv_style_btn_rel.body.shadow.color = LV_COLOR_WHITE;
|
||||
lv_style_btn_rel.body.shadow.width = 17;
|
||||
lv_style_btn_rel.body.shadow.spread = 5;
|
||||
lv_style_btn_rel.body.shadow.blend_mode = LV_BLEND_MODE_SUBTRACTIVE;
|
||||
lv_style_btn_rel.body.shadow.width = 0;
|
||||
lv_style_btn_rel.body.shadow.spread = 0;
|
||||
// lv_style_btn_rel.body.shadow.blend_mode = LV_BLEND_MODE_SUBTRACTIVE;
|
||||
lv_style_btn_rel.body.shadow.opa = LV_OPA_COVER;
|
||||
lv_style_btn_rel.body.shadow.offset.x = 18;
|
||||
lv_style_btn_rel.body.shadow.offset.y = 20;
|
||||
lv_style_btn_rel.body.shadow.offset.x = 0;
|
||||
lv_style_btn_rel.body.shadow.offset.y = 0;
|
||||
lv_style_btn_rel.text.color = lv_color_make(0xff, 0xff, 0xff);
|
||||
lv_style_btn_rel.image.color = lv_color_make(0xff, 0xff, 0xff);
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, cons
|
||||
circle_style.body.border.color = style->line.color;
|
||||
|
||||
|
||||
lv_mask_param_t mask_angle_param;
|
||||
lv_draw_mask_param_t mask_angle_param;
|
||||
lv_draw_mask_angle_init(&mask_angle_param, center_x, center_y, start_angle, end_angle);
|
||||
|
||||
int16_t mask_angle_id = lv_draw_mask_add(lv_draw_mask_angle, &mask_angle_param, NULL);
|
||||
|
||||
@@ -28,11 +28,11 @@
|
||||
|
||||
static void fill_true_color_normal(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
||||
lv_color_t color, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_mask_res_t mask_res);
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res);
|
||||
|
||||
static void fill_true_color_blended(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
||||
lv_color_t color, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_mask_res_t mask_res, lv_blend_mode_t mode);
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_blend_mode_t mode);
|
||||
|
||||
|
||||
|
||||
@@ -66,12 +66,12 @@ static inline lv_color_t color_blend_true_color_subtractive(lv_color_t fg, lv_co
|
||||
* @param mode
|
||||
*/
|
||||
void lv_blend_fill(const lv_area_t * clip_area, const lv_area_t * fill_area,
|
||||
lv_color_t color, lv_opa_t * mask, lv_mask_res_t mask_res, lv_opa_t opa,
|
||||
lv_color_t color, lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa,
|
||||
lv_blend_mode_t mode)
|
||||
{
|
||||
/*Do not draw transparent things*/
|
||||
if(opa < LV_OPA_MIN) return;
|
||||
if(mask_res == LV_MASK_RES_FULL_TRANSP) return;
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_TRANSP) return;
|
||||
|
||||
lv_disp_t * disp = lv_refr_get_disp_refreshing();
|
||||
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
|
||||
@@ -109,12 +109,12 @@ void lv_blend_fill(const lv_area_t * clip_area, const lv_area_t * fill_area,
|
||||
|
||||
|
||||
void lv_blend_map(const lv_area_t * clip_area, const lv_area_t * map_area, const lv_color_t * map_buf,
|
||||
const lv_opa_t * mask, lv_mask_res_t mask_res,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res,
|
||||
lv_opa_t opa, lv_blend_mode_t mode)
|
||||
{
|
||||
/*Do not draw transparent things*/
|
||||
if(opa < LV_OPA_MIN) return;
|
||||
if(mask_res == LV_MASK_RES_FULL_TRANSP) return;
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_TRANSP) return;
|
||||
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
@@ -152,7 +152,7 @@ void lv_blend_map(const lv_area_t * clip_area, const lv_area_t * map_area, const
|
||||
lv_coord_t y;
|
||||
|
||||
/*Simple fill (maybe with opacity), no masking*/
|
||||
if(mask_res == LV_MASK_RES_FULL_COVER) {
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) {
|
||||
/*Go to the first px of the map*/
|
||||
map_buf_tmp += (draw_area.x1 - (map_area->x1 - disp_area->x1));
|
||||
if(opa > LV_OPA_MAX) {
|
||||
@@ -224,7 +224,7 @@ void lv_blend_map(const lv_area_t * clip_area, const lv_area_t * map_area, const
|
||||
|
||||
static void fill_true_color_normal(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
||||
lv_color_t color, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_mask_res_t mask_res)
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res)
|
||||
{
|
||||
|
||||
/*Get the width of the `disp_area` it will be used to go to the next line*/
|
||||
@@ -237,7 +237,7 @@ static void fill_true_color_normal(const lv_area_t * disp_area, lv_color_t * dis
|
||||
lv_coord_t y;
|
||||
|
||||
/*Simple fill (maybe with opacity), no masking*/
|
||||
if(mask_res == LV_MASK_RES_FULL_COVER) {
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) {
|
||||
if(opa > LV_OPA_MAX) {
|
||||
lv_coord_t draw_area_w = lv_area_get_width(draw_area);
|
||||
lv_color_t * disp_buf_tmp_ori = disp_buf_tmp;
|
||||
@@ -338,7 +338,7 @@ static void fill_true_color_normal(const lv_area_t * disp_area, lv_color_t * dis
|
||||
|
||||
static void fill_true_color_blended(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
||||
lv_color_t color, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_mask_res_t mask_res, lv_blend_mode_t mode)
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_blend_mode_t mode)
|
||||
{
|
||||
/*Get the width of the `disp_area` it will be used to go to the next line*/
|
||||
lv_coord_t disp_w = lv_area_get_width(disp_area);
|
||||
@@ -365,7 +365,7 @@ static void fill_true_color_blended(const lv_area_t * disp_area, lv_color_t * di
|
||||
lv_coord_t y;
|
||||
|
||||
/*Simple fill (maybe with opacity), no masking*/
|
||||
if(mask_res == LV_MASK_RES_FULL_COVER) {
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) {
|
||||
lv_color_t last_dest_color = LV_COLOR_BLACK;
|
||||
lv_color_t last_res_color = lv_color_mix(color, last_dest_color, opa);
|
||||
for(y = draw_area->y1; y <= draw_area->y2; y++) {
|
||||
|
||||
@@ -37,12 +37,12 @@ typedef uint8_t lv_blend_mode_t;
|
||||
**********************/
|
||||
|
||||
void lv_blend_fill(const lv_area_t * clip_area, const lv_area_t * fill_area,
|
||||
lv_color_t color, lv_opa_t * mask, lv_mask_res_t mask_res, lv_opa_t opa,
|
||||
lv_color_t color, lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa,
|
||||
lv_blend_mode_t mode);
|
||||
|
||||
|
||||
void lv_blend_map(const lv_area_t * clip_area, const lv_area_t * map_area, const lv_color_t * map_buf,
|
||||
const lv_opa_t * mask, lv_mask_res_t mask_res,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res,
|
||||
lv_opa_t opa, lv_blend_mode_t mode);
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -7,9 +7,10 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_draw_img.h"
|
||||
#include "../lv_hal/lv_hal_disp.h"
|
||||
#include "lv_img_cache.h"
|
||||
#include "../lv_hal/lv_hal_disp.h"
|
||||
#include "../lv_misc/lv_log.h"
|
||||
#include "../lv_core/lv_refr.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -578,7 +579,7 @@ static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
|
||||
|
||||
/*The simplest case just copy the pixels into the VDB*/
|
||||
if(other_mask_cnt == 0 && chroma_key == false && alpha_byte == false && opa == LV_OPA_COVER && recolor_opa == LV_OPA_TRANSP) {
|
||||
lv_blend_map(clip_area, map_area, (lv_color_t *)map_p, NULL, LV_MASK_RES_FULL_COVER, LV_OPA_COVER, LV_BLEND_MODE_NORMAL);
|
||||
lv_blend_map(clip_area, map_area, (lv_color_t *)map_p, NULL, LV_DRAW_MASK_RES_FULL_COVER, LV_OPA_COVER, LV_BLEND_MODE_NORMAL);
|
||||
}
|
||||
/*In the other cases every pixel need to be checked one-by-one*/
|
||||
else {
|
||||
@@ -613,14 +614,14 @@ static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
|
||||
memset(mask_buf, 0xFF, sizeof(mask_buf));
|
||||
}
|
||||
|
||||
lv_mask_res_t mask_res;
|
||||
lv_draw_mask_res_t mask_res;
|
||||
lv_coord_t x;
|
||||
lv_coord_t y;
|
||||
for(y = 0; y < lv_area_get_height(&draw_area); y++) {
|
||||
map_px = map_buf_tmp;
|
||||
px_i_start = px_i;
|
||||
|
||||
mask_res = (alpha_byte || chroma_key) ? LV_MASK_RES_CHANGED : LV_MASK_RES_FULL_COVER;
|
||||
mask_res = (alpha_byte || chroma_key) ? LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
|
||||
for(x = 0; x < lv_area_get_width(&draw_area); x++, map_px += px_size_byte, px_i++) {
|
||||
if(alpha_byte) {
|
||||
lv_opa_t px_opa = map_px[LV_IMG_PX_SIZE_ALPHA_BYTE - 1];
|
||||
@@ -654,12 +655,12 @@ static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
|
||||
|
||||
/*Apply the masks if any*/
|
||||
if(other_mask_cnt) {
|
||||
lv_mask_res_t mask_res_sub = lv_draw_mask_apply(mask_buf + px_i_start, draw_area.x1 + vdb->area.x1, y + draw_area.y1 + vdb->area.y1, lv_area_get_width(&draw_area));
|
||||
if(mask_res_sub == LV_MASK_RES_FULL_TRANSP) {
|
||||
lv_draw_mask_res_t mask_res_sub = lv_draw_mask_apply(mask_buf + px_i_start, draw_area.x1 + vdb->area.x1, y + draw_area.y1 + vdb->area.y1, lv_area_get_width(&draw_area));
|
||||
if(mask_res_sub == LV_DRAW_MASK_RES_FULL_TRANSP) {
|
||||
memset(mask_buf + px_i_start, 0x00, lv_area_get_width(&draw_area));
|
||||
mask_res = LV_MASK_RES_CHANGED;
|
||||
} else if(mask_res_sub == LV_MASK_RES_CHANGED) {
|
||||
mask_res = LV_MASK_RES_CHANGED;
|
||||
mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
} else if(mask_res_sub == LV_DRAW_MASK_RES_CHANGED) {
|
||||
mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "lv_draw_label.h"
|
||||
#include "../lv_misc/lv_math.h"
|
||||
#include "../lv_hal/lv_hal_disp.h"
|
||||
#include "../lv_core/lv_refr.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -337,10 +338,6 @@ static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area
|
||||
lv_disp_t * disp = lv_refr_get_disp_refreshing();
|
||||
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
|
||||
|
||||
|
||||
lv_area_t * disp_area = &vdb->area;
|
||||
lv_color_t * disp_buf = &vdb->buf_act;
|
||||
|
||||
lv_coord_t col, row;
|
||||
|
||||
uint8_t width_byte_scr = g.box_w >> 3; /*Width in bytes (on the screen finally) (e.g. w = 11 -> 2 bytes wide)*/
|
||||
@@ -411,8 +408,8 @@ static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area
|
||||
|
||||
/*Apply masks if any*/
|
||||
if(other_mask_cnt) {
|
||||
lv_mask_res_t mask_res = lv_draw_mask_apply(mask_buf + mask_p_start, fill_area.x1, fill_area.y2, lv_area_get_width(&fill_area));
|
||||
if(mask_res == LV_MASK_RES_FULL_TRANSP) {
|
||||
lv_draw_mask_res_t mask_res = lv_draw_mask_apply(mask_buf + mask_p_start, fill_area.x1, fill_area.y2, lv_area_get_width(&fill_area));
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_TRANSP) {
|
||||
memset(mask_buf + mask_p_start, 0x00, lv_area_get_width(&fill_area));
|
||||
}
|
||||
}
|
||||
@@ -421,7 +418,7 @@ static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area
|
||||
fill_area.y2 ++;
|
||||
} else {
|
||||
lv_blend_fill(clip_area, &fill_area,
|
||||
color, mask_buf, LV_MASK_RES_CHANGED, opa,
|
||||
color, mask_buf, LV_DRAW_MASK_RES_CHANGED, opa,
|
||||
LV_BLEND_MODE_NORMAL);
|
||||
|
||||
fill_area.y1 = fill_area.y2 + 1;
|
||||
@@ -439,7 +436,7 @@ static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area
|
||||
if(fill_area.y1 != fill_area.y2) {
|
||||
fill_area.y2--;
|
||||
lv_blend_fill(clip_area, &fill_area,
|
||||
color, mask_buf, LV_MASK_RES_CHANGED, opa,
|
||||
color, mask_buf, LV_DRAW_MASK_RES_CHANGED, opa,
|
||||
LV_BLEND_MODE_NORMAL);
|
||||
mask_p = 0;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ static void draw_line_hor(const lv_point_t * point1, const lv_point_t * point2,
|
||||
/*If there is no mask then simply draw a rectangle*/
|
||||
if(other_mask_cnt == 0) {
|
||||
lv_blend_fill(clip, &draw_area,
|
||||
style->line.color, NULL, LV_MASK_RES_FULL_COVER, style->line.opa,
|
||||
style->line.color, NULL, LV_DRAW_MASK_RES_FULL_COVER, style->line.opa,
|
||||
LV_BLEND_MODE_NORMAL);
|
||||
}
|
||||
/*If there other mask apply it*/
|
||||
@@ -123,7 +123,7 @@ static void draw_line_hor(const lv_point_t * point1, const lv_point_t * point2,
|
||||
|
||||
lv_opa_t mask_buf[LV_HOR_RES_MAX];
|
||||
lv_coord_t h;
|
||||
lv_mask_res_t mask_res;
|
||||
lv_draw_mask_res_t mask_res;
|
||||
for(h = draw_area.y1; h <= draw_area.y2; h++) {
|
||||
memset(mask_buf, LV_OPA_COVER, draw_area_w);
|
||||
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
||||
@@ -167,7 +167,7 @@ static void draw_line_ver(const lv_point_t * point1, const lv_point_t * point2,
|
||||
if(other_mask_cnt == 0) {
|
||||
|
||||
lv_blend_fill(clip, &draw_area,
|
||||
style->line.color, NULL, LV_MASK_RES_FULL_COVER, style->line.opa,
|
||||
style->line.color, NULL, LV_DRAW_MASK_RES_FULL_COVER, style->line.opa,
|
||||
LV_BLEND_MODE_NORMAL);
|
||||
}
|
||||
/*If there other mask apply it*/
|
||||
@@ -195,7 +195,7 @@ static void draw_line_ver(const lv_point_t * point1, const lv_point_t * point2,
|
||||
|
||||
lv_opa_t mask_buf[LV_HOR_RES_MAX];
|
||||
lv_coord_t h;
|
||||
lv_mask_res_t mask_res;
|
||||
lv_draw_mask_res_t mask_res;
|
||||
for(h = draw_area.y1; h <= draw_area.y2; h++) {
|
||||
memset(mask_buf, LV_OPA_COVER, draw_area_w);
|
||||
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
||||
@@ -264,27 +264,27 @@ static void draw_line_skew(const lv_point_t * point1, const lv_point_t * point2,
|
||||
bool is_common = lv_area_intersect(&draw_area, &draw_area, clip);
|
||||
if(is_common == false) return;
|
||||
|
||||
lv_mask_param_t mask_left_param;
|
||||
lv_mask_param_t mask_right_param;
|
||||
lv_mask_param_t mask_top_param;
|
||||
lv_mask_param_t mask_bottom_param;
|
||||
lv_draw_mask_param_t mask_left_param;
|
||||
lv_draw_mask_param_t mask_right_param;
|
||||
lv_draw_mask_param_t mask_top_param;
|
||||
lv_draw_mask_param_t mask_bottom_param;
|
||||
|
||||
if(flat) {
|
||||
if(xdiff > 0) {
|
||||
lv_draw_mask_line_points_init(&mask_left_param, p1.x, p1.y - w_half0, p2.x, p2.y - w_half0, LV_LINE_MASK_SIDE_LEFT);
|
||||
lv_draw_mask_line_points_init(&mask_right_param, p1.x, p1.y + w_half1, p2.x, p2.y + w_half1, LV_LINE_MASK_SIDE_RIGHT);
|
||||
lv_draw_mask_line_points_init(&mask_left_param, p1.x, p1.y - w_half0, p2.x, p2.y - w_half0, LV_DRAW_MASK_LINE_SIDE_LEFT);
|
||||
lv_draw_mask_line_points_init(&mask_right_param, p1.x, p1.y + w_half1, p2.x, p2.y + w_half1, LV_DRAW_MASK_LINE_SIDE_RIGHT);
|
||||
} else {
|
||||
lv_draw_mask_line_points_init(&mask_left_param, p1.x, p1.y + w_half0, p2.x, p2.y + w_half0, LV_LINE_MASK_SIDE_LEFT);
|
||||
lv_draw_mask_line_points_init(&mask_right_param, p1.x, p1.y - w_half1, p2.x, p2.y - w_half1, LV_LINE_MASK_SIDE_RIGHT);
|
||||
lv_draw_mask_line_points_init(&mask_left_param, p1.x, p1.y + w_half0, p2.x, p2.y + w_half0, LV_DRAW_MASK_LINE_SIDE_LEFT);
|
||||
lv_draw_mask_line_points_init(&mask_right_param, p1.x, p1.y - w_half1, p2.x, p2.y - w_half1, LV_DRAW_MASK_LINE_SIDE_RIGHT);
|
||||
}
|
||||
} else {
|
||||
lv_draw_mask_line_points_init(&mask_left_param, p1.x + w_half0, p1.y, p2.x + w_half0, p2.y, LV_LINE_MASK_SIDE_LEFT);
|
||||
lv_draw_mask_line_points_init(&mask_right_param, p1.x - w_half1, p1.y, p2.x - w_half1, p2.y, LV_LINE_MASK_SIDE_RIGHT);
|
||||
lv_draw_mask_line_points_init(&mask_left_param, p1.x + w_half0, p1.y, p2.x + w_half0, p2.y, LV_DRAW_MASK_LINE_SIDE_LEFT);
|
||||
lv_draw_mask_line_points_init(&mask_right_param, p1.x - w_half1, p1.y, p2.x - w_half1, p2.y, LV_DRAW_MASK_LINE_SIDE_RIGHT);
|
||||
|
||||
}
|
||||
/*Use the normal vector for the endings*/
|
||||
lv_draw_mask_line_points_init(&mask_top_param, p1.x, p1.y, p1.x - ydiff, p1.y + xdiff, LV_LINE_MASK_SIDE_BOTTOM);
|
||||
lv_draw_mask_line_points_init(&mask_bottom_param, p2.x, p2.y,p2.x - ydiff, p2.y + xdiff, LV_LINE_MASK_SIDE_TOP);
|
||||
lv_draw_mask_line_points_init(&mask_top_param, p1.x, p1.y, p1.x - ydiff, p1.y + xdiff, LV_DRAW_MASK_LINE_SIDE_BOTTOM);
|
||||
lv_draw_mask_line_points_init(&mask_bottom_param, p2.x, p2.y,p2.x - ydiff, p2.y + xdiff, LV_DRAW_MASK_LINE_SIDE_TOP);
|
||||
|
||||
int16_t mask_left_id = lv_draw_mask_add(lv_draw_mask_line, &mask_left_param, NULL);
|
||||
int16_t mask_right_id = lv_draw_mask_add(lv_draw_mask_line, &mask_right_param, NULL);
|
||||
@@ -307,7 +307,7 @@ static void draw_line_skew(const lv_point_t * point1, const lv_point_t * point2,
|
||||
|
||||
/*Draw the background line by line*/
|
||||
lv_coord_t h;
|
||||
lv_mask_res_t mask_res;
|
||||
lv_draw_mask_res_t mask_res;
|
||||
lv_opa_t mask_buf[LV_HOR_RES_MAX];
|
||||
lv_area_t fill_area;
|
||||
fill_area.x1 = draw_area.x1 + disp_area->x1;
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
**********************/
|
||||
typedef struct
|
||||
{
|
||||
lv_mask_cb_t cb;
|
||||
lv_mask_param_t param;
|
||||
lv_draw_mask_cb_t cb;
|
||||
lv_draw_mask_param_t param;
|
||||
void * custom_id;
|
||||
}lv_mask_saved_t;
|
||||
|
||||
@@ -29,8 +29,8 @@ typedef struct
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static lv_mask_res_t line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_mask_line_param_t * p);
|
||||
static lv_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_mask_line_param_t * p);
|
||||
static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_draw_mask_line_param_t * p);
|
||||
static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_draw_mask_line_param_t * p);
|
||||
|
||||
static inline lv_opa_t mask_mix(lv_opa_t mask_act, lv_opa_t mask_new);
|
||||
|
||||
@@ -47,7 +47,7 @@ static lv_mask_saved_t mask_list[LV_MASK_MAX_NUM];
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
int16_t lv_draw_mask_add(lv_mask_cb_t mask_cb, lv_mask_param_t * param, void * custom_id)
|
||||
int16_t lv_draw_mask_add(lv_draw_mask_cb_t mask_cb, lv_draw_mask_param_t * param, void * custom_id)
|
||||
{
|
||||
/*Search a free entry*/
|
||||
uint8_t i;
|
||||
@@ -61,27 +61,27 @@ int16_t lv_draw_mask_add(lv_mask_cb_t mask_cb, lv_mask_param_t * param, void * c
|
||||
}
|
||||
|
||||
mask_list[i].cb = mask_cb;
|
||||
memcpy(&mask_list[i].param, param, sizeof(lv_mask_param_t));
|
||||
memcpy(&mask_list[i].param, param, sizeof(lv_draw_mask_param_t));
|
||||
mask_list[i].custom_id = custom_id;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
lv_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len)
|
||||
lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len)
|
||||
{
|
||||
bool changed = false;
|
||||
lv_mask_res_t res = LV_MASK_RES_FULL_COVER;
|
||||
lv_draw_mask_res_t res = LV_DRAW_MASK_RES_FULL_COVER;
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MASK_MAX_NUM; i++) {
|
||||
if(mask_list[i].cb) {
|
||||
res = mask_list[i].cb(mask_buf, abs_x, abs_y, len, (void*)&mask_list[i].param);
|
||||
if(res == LV_MASK_RES_FULL_TRANSP) return LV_MASK_RES_FULL_TRANSP;
|
||||
else if(res == LV_MASK_RES_CHANGED) changed = true;
|
||||
if(res == LV_DRAW_MASK_RES_FULL_TRANSP) return LV_DRAW_MASK_RES_FULL_TRANSP;
|
||||
else if(res == LV_DRAW_MASK_RES_CHANGED) changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
return changed ? LV_MASK_RES_CHANGED : LV_MASK_RES_FULL_COVER;
|
||||
return changed ? LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
|
||||
}
|
||||
|
||||
void lv_draw_mask_remove_id(int16_t id)
|
||||
@@ -111,10 +111,10 @@ uint8_t lv_draw_mask_get_cnt(void)
|
||||
return cnt;
|
||||
}
|
||||
|
||||
void lv_draw_mask_line_points_init(lv_mask_param_t * param, lv_coord_t p1x, lv_coord_t p1y, lv_coord_t p2x, lv_coord_t p2y, lv_line_mask_side_t side)
|
||||
void lv_draw_mask_line_points_init(lv_draw_mask_param_t * param, lv_coord_t p1x, lv_coord_t p1y, lv_coord_t p2x, lv_coord_t p2y, lv_draw_mask_line_side_t side)
|
||||
{
|
||||
lv_mask_line_param_t * p = ¶m->line;
|
||||
memset(p, 0x00, sizeof(lv_mask_line_param_t));
|
||||
lv_draw_mask_line_param_t * p = ¶m->line;
|
||||
memset(p, 0x00, sizeof(lv_draw_mask_line_param_t));
|
||||
|
||||
if(p1y > p2y) {
|
||||
lv_coord_t t;
|
||||
@@ -167,13 +167,13 @@ void lv_draw_mask_line_points_init(lv_mask_param_t * param, lv_coord_t p1x, lv_c
|
||||
p->steep = p->xy_steep;
|
||||
}
|
||||
|
||||
if(p->side == LV_LINE_MASK_SIDE_LEFT) p->inv = 0;
|
||||
else if(p->side == LV_LINE_MASK_SIDE_RIGHT) p->inv = 1;
|
||||
else if(p->side == LV_LINE_MASK_SIDE_TOP) {
|
||||
if(p->side == LV_DRAW_MASK_LINE_SIDE_LEFT) p->inv = 0;
|
||||
else if(p->side == LV_DRAW_MASK_LINE_SIDE_RIGHT) p->inv = 1;
|
||||
else if(p->side == LV_DRAW_MASK_LINE_SIDE_TOP) {
|
||||
if(p->steep > 0) p->inv = 1;
|
||||
else p->inv = 0;
|
||||
}
|
||||
else if(p->side == LV_LINE_MASK_SIDE_BOTTOM) {
|
||||
else if(p->side == LV_DRAW_MASK_LINE_SIDE_BOTTOM) {
|
||||
if(p->steep > 0) p->inv = 0;
|
||||
else p->inv = 1;
|
||||
}
|
||||
@@ -190,17 +190,14 @@ void lv_draw_mask_line_points_init(lv_mask_param_t * param, lv_coord_t p1x, lv_c
|
||||
* @param deg right 0 deg, bottom: 90
|
||||
* @param side
|
||||
*/
|
||||
void lv_draw_mask_line_angle_init(lv_mask_param_t * param, lv_coord_t p1x, lv_coord_t p1y, int16_t deg, lv_line_mask_side_t side)
|
||||
void lv_draw_mask_line_angle_init(lv_draw_mask_param_t * param, lv_coord_t p1x, lv_coord_t p1y, int16_t deg, lv_draw_mask_line_side_t side)
|
||||
{
|
||||
|
||||
lv_mask_angle_param_t * p = ¶m->angle;
|
||||
|
||||
/* Find an optimal degree.
|
||||
* lv_mask_line_points_init will swap the points to keep the smaller y in p1
|
||||
* Theoretically a line with `deg` or `deg+180` is the same only the points are swapped
|
||||
* Find the degree which keeps the origo in place */
|
||||
|
||||
// deg = 360-deg; /*To get clock-wise direction*/
|
||||
if(deg > 180) deg -= 180; /*> 180 will swap the origo*/
|
||||
|
||||
|
||||
@@ -210,12 +207,12 @@ void lv_draw_mask_line_angle_init(lv_mask_param_t * param, lv_coord_t p1x, lv_co
|
||||
p2x = (lv_trigo_sin(deg + 90) >> 5) + p1x;
|
||||
p2y = (lv_trigo_sin(deg) >> 5) + p1y;
|
||||
|
||||
lv_draw_mask_line_points_init(p, p1x, p1y, p2x, p2y, side);
|
||||
lv_draw_mask_line_points_init(param, p1x, p1y, p2x, p2y, side);
|
||||
}
|
||||
|
||||
lv_mask_res_t lv_draw_mask_line(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_mask_param_t * param)
|
||||
lv_draw_mask_res_t lv_draw_mask_line(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_draw_mask_param_t * param)
|
||||
{
|
||||
lv_mask_line_param_t * p = ¶m->line;
|
||||
lv_draw_mask_line_param_t * p = ¶m->line;
|
||||
|
||||
/*Make to points relative to the origo*/
|
||||
abs_y -= p->origo.y;
|
||||
@@ -226,40 +223,40 @@ lv_mask_res_t lv_draw_mask_line(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_
|
||||
/*Horizontal*/
|
||||
if(p->flat) {
|
||||
/*Non sense: Can't be on the right/left of a horizontal line*/
|
||||
if(p->side == LV_LINE_MASK_SIDE_LEFT || p->side == LV_LINE_MASK_SIDE_RIGHT) return LV_MASK_RES_FULL_COVER;
|
||||
else if(p->side == LV_LINE_MASK_SIDE_TOP && abs_y+1 < p->origo.y) return LV_MASK_RES_FULL_COVER;
|
||||
else if(p->side == LV_LINE_MASK_SIDE_BOTTOM && abs_y > p->origo.y) return LV_MASK_RES_FULL_COVER;
|
||||
if(p->side == LV_DRAW_MASK_LINE_SIDE_LEFT || p->side == LV_DRAW_MASK_LINE_SIDE_RIGHT) return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
else if(p->side == LV_DRAW_MASK_LINE_SIDE_TOP && abs_y+1 < p->origo.y) return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
else if(p->side == LV_DRAW_MASK_LINE_SIDE_BOTTOM && abs_y > p->origo.y) return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
else {
|
||||
return LV_MASK_RES_FULL_TRANSP;
|
||||
return LV_DRAW_MASK_RES_FULL_TRANSP;
|
||||
}
|
||||
}
|
||||
/*Vertical*/
|
||||
else {
|
||||
/*Non sense: Can't be on the top/bottom of a vertical line*/
|
||||
if(p->side == LV_LINE_MASK_SIDE_TOP || p->side == LV_LINE_MASK_SIDE_BOTTOM) return LV_MASK_RES_FULL_COVER;
|
||||
else if(p->side == LV_LINE_MASK_SIDE_RIGHT && abs_x > 0) return LV_MASK_RES_FULL_COVER;
|
||||
else if(p->side == LV_LINE_MASK_SIDE_LEFT) {
|
||||
if(abs_x + len < 0) return LV_MASK_RES_FULL_COVER;
|
||||
if(p->side == LV_DRAW_MASK_LINE_SIDE_TOP || p->side == LV_DRAW_MASK_LINE_SIDE_BOTTOM) return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
else if(p->side == LV_DRAW_MASK_LINE_SIDE_RIGHT && abs_x > 0) return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
else if(p->side == LV_DRAW_MASK_LINE_SIDE_LEFT) {
|
||||
if(abs_x + len < 0) return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
else {
|
||||
int32_t k = - abs_x;
|
||||
if(k < 0) k = 0;
|
||||
if(k >= 0 && k < len) memset(&mask_buf[k], 0x00, len - k);
|
||||
return LV_MASK_RES_CHANGED;
|
||||
return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(abs_x + len < 0) return LV_MASK_RES_FULL_TRANSP;
|
||||
if(abs_x + len < 0) return LV_DRAW_MASK_RES_FULL_TRANSP;
|
||||
else {
|
||||
int32_t k = - abs_x;
|
||||
if(k < 0) k = 0;
|
||||
if(k >= 0 && k < len) memset(&mask_buf[00], 0x00,k);
|
||||
return LV_MASK_RES_CHANGED;
|
||||
return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lv_mask_res_t res;
|
||||
lv_draw_mask_res_t res;
|
||||
if(p->flat) {
|
||||
res = line_mask_flat(mask_buf, abs_x, abs_y, len, p);
|
||||
} else {
|
||||
@@ -270,12 +267,12 @@ lv_mask_res_t lv_draw_mask_line(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_
|
||||
}
|
||||
|
||||
|
||||
void lv_draw_mask_angle_init(lv_mask_param_t * param, lv_coord_t origo_x, lv_coord_t origo_y, lv_coord_t start_angle, lv_coord_t end_angle)
|
||||
void lv_draw_mask_angle_init(lv_draw_mask_param_t * param, lv_coord_t origo_x, lv_coord_t origo_y, lv_coord_t start_angle, lv_coord_t end_angle)
|
||||
{
|
||||
lv_mask_angle_param_t * p = ¶m->line;
|
||||
lv_draw_mask_angle_param_t * p = ¶m->angle;
|
||||
|
||||
lv_line_mask_side_t start_side;
|
||||
lv_line_mask_side_t end_side;
|
||||
lv_draw_mask_line_side_t start_side;
|
||||
lv_draw_mask_line_side_t end_side;
|
||||
|
||||
if(end_angle < start_angle) {
|
||||
p->delta_deg = 360 - start_angle + end_angle;
|
||||
@@ -289,27 +286,27 @@ void lv_draw_mask_angle_init(lv_mask_param_t * param, lv_coord_t origo_x, lv_coo
|
||||
p->origo.y = origo_y;
|
||||
|
||||
if(start_angle > 0 && start_angle < 180) {
|
||||
start_side = LV_LINE_MASK_SIDE_LEFT;
|
||||
start_side = LV_DRAW_MASK_LINE_SIDE_LEFT;
|
||||
}
|
||||
else if(start_angle > 180 && start_angle < 360) {
|
||||
start_side = LV_LINE_MASK_SIDE_RIGHT;
|
||||
start_side = LV_DRAW_MASK_LINE_SIDE_RIGHT;
|
||||
}
|
||||
|
||||
if(end_angle > 0 && end_angle < 180) {
|
||||
end_side = LV_LINE_MASK_SIDE_RIGHT;
|
||||
end_side = LV_DRAW_MASK_LINE_SIDE_RIGHT;
|
||||
}
|
||||
else if(end_angle > 180 && end_angle < 360) {
|
||||
end_side = LV_LINE_MASK_SIDE_LEFT;
|
||||
end_side = LV_DRAW_MASK_LINE_SIDE_LEFT;
|
||||
}
|
||||
|
||||
lv_draw_mask_line_angle_init((lv_mask_param_t*)&p->start_line, origo_x, origo_y, start_angle, start_side);
|
||||
lv_draw_mask_line_angle_init((lv_mask_param_t*)&p->end_line, origo_x, origo_y, end_angle, end_side);
|
||||
lv_draw_mask_line_angle_init((lv_draw_mask_param_t*)&p->start_line, origo_x, origo_y, start_angle, start_side);
|
||||
lv_draw_mask_line_angle_init((lv_draw_mask_param_t*)&p->end_line, origo_x, origo_y, end_angle, end_side);
|
||||
}
|
||||
|
||||
|
||||
lv_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_mask_param_t * param)
|
||||
lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_draw_mask_param_t * param)
|
||||
{
|
||||
lv_mask_angle_param_t * p = ¶m->angle;
|
||||
lv_draw_mask_angle_param_t * p = ¶m->angle;
|
||||
|
||||
lv_coord_t rel_y = abs_y - p->origo.y;
|
||||
lv_coord_t rel_x = abs_x - p->origo.x;
|
||||
@@ -318,7 +315,7 @@ lv_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord
|
||||
if(p->start_angle < 180 && p->end_angle < 180 && p->start_angle != 0 && p->end_angle != 0 && p->start_angle > p->end_angle) {
|
||||
|
||||
if(abs_y < p->origo.y) {
|
||||
return LV_MASK_RES_FULL_COVER;
|
||||
return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
}
|
||||
|
||||
/*Start angle mask can work only from the end of end angle mask */
|
||||
@@ -327,31 +324,31 @@ lv_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord
|
||||
|
||||
int32_t dist = (end_angle_first - start_angle_last) >> 1;
|
||||
|
||||
lv_mask_res_t res1 = LV_MASK_RES_FULL_COVER;
|
||||
lv_mask_res_t res2 = LV_MASK_RES_FULL_COVER;
|
||||
lv_draw_mask_res_t res1 = LV_DRAW_MASK_RES_FULL_COVER;
|
||||
lv_draw_mask_res_t res2 = LV_DRAW_MASK_RES_FULL_COVER;
|
||||
|
||||
int32_t tmp = start_angle_last + dist - rel_x;
|
||||
if(tmp > len) tmp = len;
|
||||
if(tmp > 0) {
|
||||
res1 = lv_draw_mask_line(&mask_buf[0], abs_x, abs_y, tmp, (lv_mask_param_t*)&p->start_line);
|
||||
if(res1 == LV_MASK_RES_FULL_TRANSP) {
|
||||
res1 = lv_draw_mask_line(&mask_buf[0], abs_x, abs_y, tmp, (lv_draw_mask_param_t*)&p->start_line);
|
||||
if(res1 == LV_DRAW_MASK_RES_FULL_TRANSP) {
|
||||
memset(&mask_buf[0], 0x00, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
if(tmp > len) tmp = len;
|
||||
if(tmp < 0) tmp = 0;
|
||||
res2 = lv_draw_mask_line(&mask_buf[tmp], abs_x+tmp, abs_y, len-tmp, (lv_mask_param_t*)&p->end_line);
|
||||
if(res2 == LV_MASK_RES_FULL_TRANSP) {
|
||||
res2 = lv_draw_mask_line(&mask_buf[tmp], abs_x+tmp, abs_y, len-tmp, (lv_draw_mask_param_t*)&p->end_line);
|
||||
if(res2 == LV_DRAW_MASK_RES_FULL_TRANSP) {
|
||||
memset(&mask_buf[tmp], 0x00, len-tmp);
|
||||
}
|
||||
if(res1 == res2) return res1;
|
||||
else return LV_MASK_RES_CHANGED;
|
||||
else return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
else if(p->start_angle > 180 && p->end_angle > 180 && p->start_angle > p->end_angle) {
|
||||
|
||||
if(abs_y > p->origo.y) {
|
||||
return LV_MASK_RES_FULL_COVER;
|
||||
return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
}
|
||||
|
||||
/*Start angle mask can work only from the end of end angle mask */
|
||||
@@ -369,91 +366,94 @@ lv_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord
|
||||
|
||||
int32_t dist = (end_angle_first - start_angle_last) >> 1;
|
||||
|
||||
lv_mask_res_t res1 = LV_MASK_RES_FULL_COVER;
|
||||
lv_mask_res_t res2 = LV_MASK_RES_FULL_COVER;
|
||||
lv_draw_mask_res_t res1 = LV_DRAW_MASK_RES_FULL_COVER;
|
||||
lv_draw_mask_res_t res2 = LV_DRAW_MASK_RES_FULL_COVER;
|
||||
|
||||
int32_t tmp = start_angle_last + dist - rel_x;
|
||||
if(tmp > len) tmp = len;
|
||||
if(tmp > 0) {
|
||||
res1 = lv_draw_mask_line(&mask_buf[0], abs_x, abs_y, tmp, (lv_mask_param_t*)&p->end_line);
|
||||
if(res1 == LV_MASK_RES_FULL_TRANSP) {
|
||||
res1 = lv_draw_mask_line(&mask_buf[0], abs_x, abs_y, tmp, (lv_draw_mask_param_t*)&p->end_line);
|
||||
if(res1 == LV_DRAW_MASK_RES_FULL_TRANSP) {
|
||||
memset(&mask_buf[0], 0x00, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
if(tmp > len) tmp = len;
|
||||
if(tmp < 0) tmp = 0;
|
||||
res2 = lv_draw_mask_line(&mask_buf[tmp], abs_x+tmp, abs_y, len-tmp, (lv_mask_param_t*)&p->start_line);
|
||||
if(res2 == LV_MASK_RES_FULL_TRANSP) {
|
||||
res2 = lv_draw_mask_line(&mask_buf[tmp], abs_x+tmp, abs_y, len-tmp, (lv_draw_mask_param_t*)&p->start_line);
|
||||
if(res2 == LV_DRAW_MASK_RES_FULL_TRANSP) {
|
||||
memset(&mask_buf[tmp], 0x00, len-tmp);
|
||||
}
|
||||
if(res1 == res2) return res1;
|
||||
else return LV_MASK_RES_CHANGED;
|
||||
else return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
else {
|
||||
|
||||
lv_mask_res_t res1 = LV_MASK_RES_FULL_COVER;
|
||||
lv_mask_res_t res2 = LV_MASK_RES_FULL_COVER;
|
||||
lv_draw_mask_res_t res1 = LV_DRAW_MASK_RES_FULL_COVER;
|
||||
lv_draw_mask_res_t res2 = LV_DRAW_MASK_RES_FULL_COVER;
|
||||
|
||||
if(p->start_angle == 180) {
|
||||
if(abs_y < p->origo.y) res1 = LV_MASK_RES_FULL_COVER;
|
||||
else res1 = LV_MASK_RES_UNKNOWN;
|
||||
if(abs_y < p->origo.y) res1 = LV_DRAW_MASK_RES_FULL_COVER;
|
||||
else res1 = LV_DRAW_MASK_RES_UNKNOWN;
|
||||
}
|
||||
else if(p->start_angle == 0) {
|
||||
if(abs_y < p->origo.y) res1 = LV_MASK_RES_UNKNOWN;
|
||||
else res1 = LV_MASK_RES_FULL_COVER;
|
||||
if(abs_y < p->origo.y) res1 = LV_DRAW_MASK_RES_UNKNOWN;
|
||||
else res1 = LV_DRAW_MASK_RES_FULL_COVER;
|
||||
}
|
||||
else if((p->start_angle < 180 && abs_y < p->origo.y) ||
|
||||
(p->start_angle > 180 && abs_y >= p->origo.y)) {
|
||||
res1 = LV_MASK_RES_UNKNOWN;
|
||||
res1 = LV_DRAW_MASK_RES_UNKNOWN;
|
||||
}
|
||||
else {
|
||||
res1 = lv_draw_mask_line(mask_buf, abs_x, abs_y, len, (lv_mask_param_t*)&p->start_line);
|
||||
res1 = lv_draw_mask_line(mask_buf, abs_x, abs_y, len, (lv_draw_mask_param_t*)&p->start_line);
|
||||
}
|
||||
|
||||
if(p->end_angle == 180) {
|
||||
if(abs_y < p->origo.y) res2 = LV_MASK_RES_UNKNOWN;
|
||||
else res2 = LV_MASK_RES_FULL_COVER;
|
||||
if(abs_y < p->origo.y) res2 = LV_DRAW_MASK_RES_UNKNOWN;
|
||||
else res2 = LV_DRAW_MASK_RES_FULL_COVER;
|
||||
}
|
||||
else if(p->end_angle == 0) {
|
||||
if(abs_y < p->origo.y) res2 = LV_MASK_RES_FULL_COVER;
|
||||
else res2 = LV_MASK_RES_UNKNOWN;
|
||||
if(abs_y < p->origo.y) res2 = LV_DRAW_MASK_RES_FULL_COVER;
|
||||
else res2 = LV_DRAW_MASK_RES_UNKNOWN;
|
||||
}
|
||||
else if((p->end_angle < 180 && abs_y < p->origo.y) ||
|
||||
(p->end_angle > 180 && abs_y >= p->origo.y)) {
|
||||
res2 = LV_MASK_RES_UNKNOWN;
|
||||
res2 = LV_DRAW_MASK_RES_UNKNOWN;
|
||||
}
|
||||
else {
|
||||
res2 = lv_draw_mask_line(mask_buf, abs_x, abs_y, len, (lv_mask_param_t*)&p->end_line);
|
||||
res2 = lv_draw_mask_line(mask_buf, abs_x, abs_y, len, (lv_draw_mask_param_t*)&p->end_line);
|
||||
}
|
||||
|
||||
if(res1 == LV_MASK_RES_FULL_TRANSP || res2 == LV_MASK_RES_FULL_TRANSP) return LV_MASK_RES_FULL_TRANSP;
|
||||
else if(res1 == LV_MASK_RES_UNKNOWN && res2 == LV_MASK_RES_UNKNOWN) return LV_MASK_RES_FULL_TRANSP;
|
||||
else if(res1 == LV_MASK_RES_FULL_COVER && res2 == LV_MASK_RES_FULL_COVER) return LV_MASK_RES_FULL_COVER;
|
||||
else return LV_MASK_RES_CHANGED;
|
||||
if(res1 == LV_DRAW_MASK_RES_FULL_TRANSP || res2 == LV_DRAW_MASK_RES_FULL_TRANSP) return LV_DRAW_MASK_RES_FULL_TRANSP;
|
||||
else if(res1 == LV_DRAW_MASK_RES_UNKNOWN && res2 == LV_DRAW_MASK_RES_UNKNOWN) return LV_DRAW_MASK_RES_FULL_TRANSP;
|
||||
else if(res1 == LV_DRAW_MASK_RES_FULL_COVER && res2 == LV_DRAW_MASK_RES_FULL_COVER) return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
else return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
}
|
||||
|
||||
void lv_draw_mask_radius_init(lv_mask_param_t * param, const lv_area_t * rect, lv_coord_t radius, bool inv)
|
||||
void lv_draw_mask_radius_init(lv_draw_mask_param_t * param, const lv_area_t * rect, lv_coord_t radius, bool inv)
|
||||
{
|
||||
lv_mask_radius_param_t * p = ¶m->radius;
|
||||
lv_draw_mask_radius_param_t * p = ¶m->radius;
|
||||
|
||||
lv_coord_t short_side = LV_MATH_MIN(lv_area_get_width(rect), lv_area_get_height(rect));
|
||||
if(radius > short_side >> 1) radius = short_side >> 1;
|
||||
|
||||
lv_area_copy(&p->rect, rect);
|
||||
p->radius = radius;
|
||||
p->inv = inv ? 1 : 0;
|
||||
}
|
||||
|
||||
lv_mask_res_t lv_mask_radius(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_mask_param_t * param)
|
||||
lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_draw_mask_param_t * param)
|
||||
{
|
||||
lv_mask_radius_param_t * p = ¶m->radius;
|
||||
lv_draw_mask_radius_param_t * p = ¶m->radius;
|
||||
|
||||
if(p->inv == 0) {
|
||||
if(abs_y < p->rect.y1 || abs_y > p->rect.y2) {
|
||||
return LV_MASK_RES_FULL_TRANSP;
|
||||
return LV_DRAW_MASK_RES_FULL_TRANSP;
|
||||
}
|
||||
} else {
|
||||
if(abs_y < p->rect.y1 || abs_y > p->rect.y2) {
|
||||
return LV_MASK_RES_FULL_COVER;
|
||||
return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,8 +471,8 @@ lv_mask_res_t lv_mask_radius(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t a
|
||||
if(first < len) {
|
||||
memset(&mask_buf[first], 0x00, len-first);
|
||||
}
|
||||
if(last == 0 && first == len) return LV_MASK_RES_FULL_COVER;
|
||||
else return LV_MASK_RES_CHANGED;
|
||||
if(last == 0 && first == len) return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
else return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
else {
|
||||
int32_t first = p->rect.x1 - abs_x;
|
||||
@@ -485,7 +485,7 @@ lv_mask_res_t lv_mask_radius(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t a
|
||||
}
|
||||
}
|
||||
}
|
||||
return LV_MASK_RES_CHANGED;
|
||||
return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
|
||||
int32_t k = p->rect.x1 -abs_x; /*First relevant coordinate on the of the mask*/
|
||||
@@ -638,14 +638,14 @@ lv_mask_res_t lv_mask_radius(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t a
|
||||
}
|
||||
}
|
||||
|
||||
return LV_MASK_RES_CHANGED;
|
||||
return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static lv_mask_res_t line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_mask_line_param_t * p)
|
||||
static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_draw_mask_line_param_t * p)
|
||||
{
|
||||
lv_coord_t y_at_x;
|
||||
y_at_x = (int32_t)((int32_t)p->yx_steep * abs_x) >> 10;
|
||||
@@ -653,17 +653,17 @@ static lv_mask_res_t line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_co
|
||||
if(p->yx_steep > 0) {
|
||||
if(y_at_x > abs_y) {
|
||||
if(p->inv) {
|
||||
return LV_MASK_RES_FULL_COVER;
|
||||
return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
} else {
|
||||
return LV_MASK_RES_FULL_TRANSP;
|
||||
return LV_DRAW_MASK_RES_FULL_TRANSP;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(y_at_x < abs_y) {
|
||||
if(p->inv) {
|
||||
return LV_MASK_RES_FULL_COVER;
|
||||
return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
} else {
|
||||
return LV_MASK_RES_FULL_TRANSP;
|
||||
return LV_DRAW_MASK_RES_FULL_TRANSP;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -674,17 +674,17 @@ static lv_mask_res_t line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_co
|
||||
if(p->yx_steep > 0) {
|
||||
if(y_at_x < abs_y) {
|
||||
if(p->inv) {
|
||||
return LV_MASK_RES_FULL_TRANSP;
|
||||
return LV_DRAW_MASK_RES_FULL_TRANSP;
|
||||
} else {
|
||||
return LV_MASK_RES_FULL_COVER;
|
||||
return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(y_at_x > abs_y) {
|
||||
if(p->inv) {
|
||||
return LV_MASK_RES_FULL_TRANSP;
|
||||
return LV_DRAW_MASK_RES_FULL_TRANSP;
|
||||
} else {
|
||||
return LV_MASK_RES_FULL_COVER;
|
||||
return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -744,10 +744,10 @@ static lv_mask_res_t line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_co
|
||||
}
|
||||
}
|
||||
|
||||
return LV_MASK_RES_CHANGED;
|
||||
return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
|
||||
static lv_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_mask_line_param_t * p)
|
||||
static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_draw_mask_line_param_t * p)
|
||||
{
|
||||
int32_t k;
|
||||
lv_coord_t x_at_y;
|
||||
@@ -757,9 +757,9 @@ static lv_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_c
|
||||
if(p->xy_steep > 0) x_at_y++;
|
||||
if(x_at_y < abs_x) {
|
||||
if(p->inv) {
|
||||
return LV_MASK_RES_FULL_COVER;
|
||||
return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
} else {
|
||||
return LV_MASK_RES_FULL_TRANSP;
|
||||
return LV_DRAW_MASK_RES_FULL_TRANSP;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -768,9 +768,9 @@ static lv_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_c
|
||||
x_at_y = (int32_t)((int32_t)p->xy_steep * (abs_y)) >> 10;
|
||||
if(x_at_y > abs_x + len) {
|
||||
if(p->inv) {
|
||||
return LV_MASK_RES_FULL_TRANSP;
|
||||
return LV_DRAW_MASK_RES_FULL_TRANSP;
|
||||
} else {
|
||||
return LV_MASK_RES_FULL_COVER;
|
||||
return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -872,7 +872,7 @@ static lv_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_c
|
||||
}
|
||||
}
|
||||
|
||||
return LV_MASK_RES_CHANGED;
|
||||
return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
|
||||
static inline lv_opa_t mask_mix(lv_opa_t mask_act, lv_opa_t mask_new)
|
||||
|
||||
@@ -27,23 +27,23 @@ extern "C" {
|
||||
**********************/
|
||||
|
||||
enum {
|
||||
LV_MASK_RES_FULL_TRANSP,
|
||||
LV_MASK_RES_FULL_COVER,
|
||||
LV_MASK_RES_CHANGED,
|
||||
LV_MASK_RES_UNKNOWN
|
||||
LV_DRAW_MASK_RES_FULL_TRANSP,
|
||||
LV_DRAW_MASK_RES_FULL_COVER,
|
||||
LV_DRAW_MASK_RES_CHANGED,
|
||||
LV_DRAW_MASK_RES_UNKNOWN
|
||||
};
|
||||
|
||||
typedef uint8_t lv_mask_res_t;
|
||||
typedef uint8_t lv_draw_mask_res_t;
|
||||
|
||||
|
||||
enum {
|
||||
LV_LINE_MASK_SIDE_LEFT = 0,
|
||||
LV_LINE_MASK_SIDE_RIGHT,
|
||||
LV_LINE_MASK_SIDE_TOP,
|
||||
LV_LINE_MASK_SIDE_BOTTOM,
|
||||
LV_DRAW_MASK_LINE_SIDE_LEFT = 0,
|
||||
LV_DRAW_MASK_LINE_SIDE_RIGHT,
|
||||
LV_DRAW_MASK_LINE_SIDE_TOP,
|
||||
LV_DRAW_MASK_LINE_SIDE_BOTTOM,
|
||||
};
|
||||
|
||||
typedef uint8_t lv_line_mask_side_t;
|
||||
typedef uint8_t lv_draw_mask_line_side_t;
|
||||
|
||||
typedef struct {
|
||||
lv_point_t origo;
|
||||
@@ -63,22 +63,22 @@ typedef struct {
|
||||
uint8_t flat :1;
|
||||
|
||||
/*Which side to keep?*/
|
||||
lv_line_mask_side_t side :2;
|
||||
lv_draw_mask_line_side_t side :2;
|
||||
|
||||
/* Invert the mask. The default is: Keep the left part.
|
||||
* It is used to select left/right/top/bottom*/
|
||||
uint8_t inv:1;
|
||||
}lv_mask_line_param_t;
|
||||
}lv_draw_mask_line_param_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
lv_point_t origo;
|
||||
lv_coord_t start_angle;
|
||||
lv_coord_t end_angle;
|
||||
lv_mask_line_param_t start_line;
|
||||
lv_mask_line_param_t end_line;
|
||||
lv_draw_mask_line_param_t start_line;
|
||||
lv_draw_mask_line_param_t end_line;
|
||||
uint16_t delta_deg;
|
||||
}lv_mask_angle_param_t;
|
||||
}lv_draw_mask_angle_param_t;
|
||||
|
||||
typedef struct {
|
||||
lv_area_t rect;
|
||||
@@ -86,38 +86,38 @@ typedef struct {
|
||||
|
||||
/* Invert the mask. The default is: Keep the are inside.*/
|
||||
uint8_t inv:1;
|
||||
}lv_mask_radius_param_t;
|
||||
}lv_draw_mask_radius_param_t;
|
||||
|
||||
|
||||
typedef union {
|
||||
lv_mask_line_param_t line;
|
||||
lv_mask_radius_param_t radius;
|
||||
lv_mask_angle_param_t angle;
|
||||
}lv_mask_param_t;
|
||||
lv_draw_mask_line_param_t line;
|
||||
lv_draw_mask_radius_param_t radius;
|
||||
lv_draw_mask_angle_param_t angle;
|
||||
}lv_draw_mask_param_t;
|
||||
|
||||
typedef lv_mask_res_t (*lv_mask_cb_t)(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_mask_param_t * p);
|
||||
typedef lv_draw_mask_res_t (*lv_draw_mask_cb_t)(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_draw_mask_param_t * p);
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
int16_t lv_draw_mask_add(lv_mask_cb_t mask_cb, lv_mask_param_t * param, void * custom_id);
|
||||
int16_t lv_draw_mask_add(lv_draw_mask_cb_t mask_cb, lv_draw_mask_param_t * param, void * custom_id);
|
||||
void lv_draw_mask_remove_id(int16_t id);
|
||||
void lv_draw_mask_remove_custom(void * custom_id);
|
||||
uint8_t lv_draw_mask_get_cnt(void);
|
||||
|
||||
lv_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len);
|
||||
lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len);
|
||||
|
||||
void lv_draw_mask_line_points_init(lv_mask_param_t * param, lv_coord_t p1x, lv_coord_t p1y, lv_coord_t p2x, lv_coord_t p2y, lv_line_mask_side_t side);
|
||||
void lv_draw_mask_line_angle_init(lv_mask_param_t * param, lv_coord_t p1x, lv_coord_t p1y, int16_t deg, lv_line_mask_side_t side);
|
||||
lv_mask_res_t lv_draw_mask_line(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_mask_param_t * param);
|
||||
void lv_draw_mask_line_points_init(lv_draw_mask_param_t * param, lv_coord_t p1x, lv_coord_t p1y, lv_coord_t p2x, lv_coord_t p2y, lv_draw_mask_line_side_t side);
|
||||
void lv_draw_mask_line_angle_init(lv_draw_mask_param_t * param, lv_coord_t p1x, lv_coord_t p1y, int16_t deg, lv_draw_mask_line_side_t side);
|
||||
lv_draw_mask_res_t lv_draw_mask_line(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_draw_mask_param_t * param);
|
||||
|
||||
|
||||
void lv_draw_mask_radius_init(lv_mask_param_t * param, const lv_area_t * rect, lv_coord_t radius, bool inv);
|
||||
lv_mask_res_t lv_mask_radius(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_mask_param_t * param);
|
||||
void lv_draw_mask_radius_init(lv_draw_mask_param_t * param, const lv_area_t * rect, lv_coord_t radius, bool inv);
|
||||
lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_draw_mask_param_t * param);
|
||||
|
||||
void lv_draw_mask_angle_init(lv_mask_param_t * param, lv_coord_t origio_x, lv_coord_t origo_y, lv_coord_t start_angle, lv_coord_t end_angle);
|
||||
lv_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_mask_param_t * param);
|
||||
void lv_draw_mask_angle_init(lv_draw_mask_param_t * param, lv_coord_t origio_x, lv_coord_t origo_y, lv_coord_t start_angle, lv_coord_t end_angle);
|
||||
lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_draw_mask_param_t * param);
|
||||
|
||||
|
||||
/**********************
|
||||
|
||||
@@ -104,21 +104,21 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
||||
/*Most simple case: just a plain rectangle*/
|
||||
if(other_mask_cnt == 0 && rout == 0 && style->body.main_color.full == style->body.grad_color.full) {
|
||||
lv_blend_fill(clip, coords,
|
||||
style->body.main_color, NULL, LV_MASK_RES_FULL_COVER, style->body.opa,
|
||||
style->body.main_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, style->body.opa,
|
||||
style->body.blend_mode);
|
||||
}
|
||||
/*More complex case: there is a radius, gradient or mask.*/
|
||||
else {
|
||||
|
||||
lv_mask_param_t mask_rout_param;
|
||||
lv_draw_mask_param_t mask_rout_param;
|
||||
if(rout > 0) {
|
||||
lv_draw_mask_radius_init(&mask_rout_param, coords, rout, false);
|
||||
mask_rout_id = lv_draw_mask_add(lv_mask_radius, &mask_rout_param, NULL);
|
||||
mask_rout_id = lv_draw_mask_add(lv_draw_mask_radius, &mask_rout_param, NULL);
|
||||
}
|
||||
|
||||
/*Draw the background line by line*/
|
||||
lv_coord_t h;
|
||||
lv_mask_res_t mask_res = LV_MASK_RES_FULL_COVER;
|
||||
lv_draw_mask_res_t mask_res = LV_DRAW_MASK_RES_FULL_COVER;
|
||||
lv_color_t grad_color = style->body.main_color;
|
||||
|
||||
if(opa >= LV_OPA_MIN) {
|
||||
@@ -133,7 +133,7 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
||||
/*In not corner areas apply the mask only if required*/
|
||||
if(y > coords->y1 + rout + 1 &&
|
||||
y < coords->y2 - rout - 1) {
|
||||
mask_res = LV_MASK_RES_FULL_COVER;
|
||||
mask_res = LV_DRAW_MASK_RES_FULL_COVER;
|
||||
if(other_mask_cnt != 0) {
|
||||
memset(mask_buf, LV_OPA_COVER, draw_area_w);
|
||||
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
||||
@@ -173,7 +173,7 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
||||
fill_area2.x2 = coords->x2 - rout;
|
||||
|
||||
lv_blend_fill(clip, &fill_area2,
|
||||
grad_color, NULL, LV_MASK_RES_FULL_COVER, style->body.opa, style->body.blend_mode);
|
||||
grad_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, style->body.opa, style->body.blend_mode);
|
||||
|
||||
fill_area2.x1 = coords->x2 - rout + 1;
|
||||
fill_area2.x2 = coords->x2;
|
||||
@@ -196,7 +196,7 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
||||
lv_coord_t border_width = style->body.border.width;
|
||||
if(border_width) {
|
||||
/*Move the vdb_buf_tmp to the first row*/
|
||||
lv_mask_param_t mask_rsmall_param;
|
||||
lv_draw_mask_param_t mask_rsmall_param;
|
||||
|
||||
/*Get the inner radius*/
|
||||
lv_coord_t rin = rout - border_width;
|
||||
@@ -212,12 +212,12 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
||||
|
||||
/*Create the mask*/
|
||||
lv_draw_mask_radius_init(&mask_rsmall_param, &area_small, rout - border_width, true);
|
||||
int16_t mask_rsmall_id = lv_draw_mask_add(lv_mask_radius, &mask_rsmall_param, NULL);
|
||||
int16_t mask_rsmall_id = lv_draw_mask_add(lv_draw_mask_radius, &mask_rsmall_param, NULL);
|
||||
|
||||
lv_coord_t corner_size = LV_MATH_MAX(rout, border_width - 1);
|
||||
|
||||
lv_coord_t h;
|
||||
lv_mask_res_t mask_res;
|
||||
lv_draw_mask_res_t mask_res;
|
||||
lv_area_t fill_area;
|
||||
|
||||
/*Apply some optimization if there is no other mask*/
|
||||
@@ -247,7 +247,7 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
||||
fill_area2.x2 = coords->x2 - rout;
|
||||
|
||||
lv_blend_fill(clip, &fill_area2,
|
||||
style->body.border.color, NULL, LV_MASK_RES_FULL_COVER, style->body.border.opa, style->body.border.blend_mode);
|
||||
style->body.border.color, NULL, LV_DRAW_MASK_RES_FULL_COVER, style->body.border.opa, style->body.border.blend_mode);
|
||||
}
|
||||
fill_area2.x1 = coords->x2 - rout + 1;
|
||||
fill_area2.x2 = coords->x2;
|
||||
@@ -285,7 +285,7 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
||||
fill_area2.x2 = coords->x2 - rout;
|
||||
|
||||
lv_blend_fill(clip, &fill_area2,
|
||||
style->body.border.color, NULL, LV_MASK_RES_FULL_COVER, style->body.border.opa, style->body.border.blend_mode);
|
||||
style->body.border.color, NULL, LV_DRAW_MASK_RES_FULL_COVER, style->body.border.opa, style->body.border.blend_mode);
|
||||
}
|
||||
fill_area2.x1 = coords->x2 - rout + 1;
|
||||
fill_area2.x2 = coords->x2;
|
||||
@@ -307,14 +307,14 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, const lv_s
|
||||
fill_area.y2 = coords->y2 - corner_size - 1;
|
||||
|
||||
lv_blend_fill(clip, &fill_area,
|
||||
style->body.border.color, NULL, LV_MASK_RES_FULL_COVER, style->body.border.opa, style->body.border.blend_mode);
|
||||
style->body.border.color, NULL, LV_DRAW_MASK_RES_FULL_COVER, style->body.border.opa, style->body.border.blend_mode);
|
||||
|
||||
/*Draw the right vertical border*/
|
||||
fill_area.x1 = coords->x2 - border_width + 1;
|
||||
fill_area.x2 = coords->x2;
|
||||
|
||||
lv_blend_fill(clip, &fill_area,
|
||||
style->body.border.color, NULL, LV_MASK_RES_FULL_COVER, style->body.border.opa, style->body.border.blend_mode);
|
||||
style->body.border.color, NULL, LV_DRAW_MASK_RES_FULL_COVER, style->body.border.opa, style->body.border.blend_mode);
|
||||
}
|
||||
/*Process line by line if there is other mask too*/
|
||||
else {
|
||||
@@ -418,16 +418,16 @@ static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const
|
||||
lv_coord_t y_max;
|
||||
|
||||
/*Create a mask*/
|
||||
lv_mask_res_t mask_res;
|
||||
lv_draw_mask_res_t mask_res;
|
||||
lv_opa_t mask_buf[LV_HOR_RES_MAX];
|
||||
|
||||
lv_mask_param_t mask_rout_param;
|
||||
lv_draw_mask_param_t mask_rout_param;
|
||||
lv_draw_mask_radius_init(&mask_rout_param, coords, r_bg, true);
|
||||
|
||||
/*Draw a radius into the shadow buffer*/
|
||||
int16_t mask_rout_id = LV_MASK_ID_INV;
|
||||
|
||||
mask_rout_id = lv_draw_mask_add(lv_mask_radius, &mask_rout_param, NULL);
|
||||
mask_rout_id = lv_draw_mask_add(lv_draw_mask_radius, &mask_rout_param, NULL);
|
||||
|
||||
lv_area_t a;
|
||||
|
||||
@@ -462,7 +462,7 @@ static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const
|
||||
for(y = 0; y < corner_size - ver_mid_dist + ver_mid_corr; y++) {
|
||||
memcpy(mask_buf, sh_buf_tmp, corner_size);
|
||||
mask_res = lv_draw_mask_apply(mask_buf + first_px, a.x1, a.y1, lv_area_get_width(&a));
|
||||
if(mask_res == LV_MASK_RES_FULL_COVER) mask_res = LV_MASK_RES_CHANGED;
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
|
||||
lv_blend_fill(clip, &a,
|
||||
style->body.shadow.color, mask_buf + first_px, mask_res, opa, style->body.shadow.blend_mode);
|
||||
@@ -480,7 +480,7 @@ static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const
|
||||
for(y = 0; y < corner_size - ver_mid_dist; y++) {
|
||||
memcpy(mask_buf, sh_buf_tmp, corner_size);
|
||||
mask_res = lv_draw_mask_apply(mask_buf + first_px, a.x1, a.y1, lv_area_get_width(&a));
|
||||
if(mask_res == LV_MASK_RES_FULL_COVER) mask_res = LV_MASK_RES_CHANGED;
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
|
||||
lv_blend_fill(clip, &a,
|
||||
style->body.shadow.color, mask_buf + first_px, mask_res, opa, style->body.shadow.blend_mode);
|
||||
@@ -510,7 +510,7 @@ static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const
|
||||
lv_opa_t opa_tmp = sh_buf_tmp[x - a.x1 + first_px];
|
||||
if(opa_tmp != LV_OPA_COVER || opa != LV_OPA_COVER) opa_tmp = (opa * opa_tmp) >> 8;
|
||||
lv_blend_fill(clip, &va,
|
||||
style->body.shadow.color, NULL, LV_MASK_RES_FULL_COVER, opa_tmp, style->body.shadow.blend_mode);
|
||||
style->body.shadow.color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa_tmp, style->body.shadow.blend_mode);
|
||||
}
|
||||
va.x1++;
|
||||
va.x2++;
|
||||
@@ -521,7 +521,7 @@ static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const
|
||||
for(y = corner_size; y < lv_area_get_height(&sh_area) - corner_size; y++) {
|
||||
memcpy(mask_buf, sh_buf_tmp, corner_size);
|
||||
mask_res = lv_draw_mask_apply(mask_buf + first_px, a.x1, a.y1, lv_area_get_width(&a));
|
||||
if(mask_res == LV_MASK_RES_FULL_COVER) mask_res = LV_MASK_RES_CHANGED;
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
|
||||
lv_blend_fill(clip, &a,
|
||||
style->body.shadow.color, mask_buf+first_px, mask_res, opa, style->body.shadow.blend_mode);
|
||||
@@ -562,7 +562,7 @@ static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const
|
||||
for(y = 0; y < corner_size - ver_mid_dist + ver_mid_corr; y++) {
|
||||
memcpy(mask_buf, sh_buf_tmp, corner_size);
|
||||
mask_res = lv_draw_mask_apply(mask_buf + first_px, a.x1, a.y1, lv_area_get_width(&a));
|
||||
if(mask_res == LV_MASK_RES_FULL_COVER) mask_res = LV_MASK_RES_CHANGED;
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
|
||||
lv_blend_fill(clip, &a,
|
||||
style->body.shadow.color, mask_buf + first_px, mask_res, opa, style->body.shadow.blend_mode);
|
||||
@@ -580,7 +580,7 @@ static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const
|
||||
for(y = 0; y < corner_size - ver_mid_dist; y++) {
|
||||
memcpy(mask_buf, sh_buf_tmp, corner_size);
|
||||
mask_res = lv_draw_mask_apply(mask_buf + first_px, a.x1, a.y1, lv_area_get_width(&a));
|
||||
if(mask_res == LV_MASK_RES_FULL_COVER) mask_res = LV_MASK_RES_CHANGED;
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
|
||||
lv_blend_fill(clip, &a,
|
||||
style->body.shadow.color, mask_buf + first_px, mask_res, opa, style->body.shadow.blend_mode);
|
||||
@@ -607,7 +607,7 @@ static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const
|
||||
lv_opa_t opa_tmp = sh_buf_tmp[x - a.x1 + first_px];
|
||||
if(opa_tmp != LV_OPA_COVER || opa != LV_OPA_COVER) opa_tmp = (opa * opa_tmp) >> 8;
|
||||
lv_blend_fill(clip, &va,
|
||||
style->body.shadow.color, NULL, LV_MASK_RES_FULL_COVER, opa_tmp, style->body.shadow.blend_mode);
|
||||
style->body.shadow.color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa_tmp, style->body.shadow.blend_mode);
|
||||
va.x1++;
|
||||
va.x2++;
|
||||
}
|
||||
@@ -616,7 +616,7 @@ static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const
|
||||
for(y = corner_size; y < lv_area_get_height(&sh_area) - corner_size; y++) {
|
||||
memcpy(mask_buf, sh_buf_tmp, corner_size);
|
||||
mask_res = lv_draw_mask_apply(mask_buf + first_px, a.x1, a.y1, lv_area_get_width(&a));
|
||||
if(mask_res == LV_MASK_RES_FULL_COVER) mask_res = LV_MASK_RES_CHANGED;
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
|
||||
lv_blend_fill(clip, &a,
|
||||
style->body.shadow.color, mask_buf + first_px, mask_res, opa, style->body.shadow.blend_mode);
|
||||
@@ -650,7 +650,7 @@ static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const
|
||||
if(simple_mode == false) {
|
||||
memset(mask_buf, sh_buf_tmp[0], lv_area_get_width(&a));
|
||||
mask_res = lv_draw_mask_apply(mask_buf, a.x1, a.y1, lv_area_get_width(&a));
|
||||
if(mask_res == LV_MASK_RES_FULL_COVER) mask_res = LV_MASK_RES_CHANGED;
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
|
||||
lv_blend_fill(clip, &a,
|
||||
style->body.shadow.color, mask_buf, mask_res, opa, style->body.shadow.blend_mode);
|
||||
@@ -659,7 +659,7 @@ static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const
|
||||
lv_opa_t opa_tmp = sh_buf_tmp[0];
|
||||
if(opa_tmp != LV_OPA_COVER || opa != LV_OPA_COVER) opa_tmp = (opa * opa_tmp) >> 8;
|
||||
lv_blend_fill(clip, &a,
|
||||
style->body.shadow.color, NULL, LV_MASK_RES_FULL_COVER, opa_tmp, style->body.shadow.blend_mode);
|
||||
style->body.shadow.color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa_tmp, style->body.shadow.blend_mode);
|
||||
}
|
||||
|
||||
a.y1++;
|
||||
@@ -679,14 +679,14 @@ static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const
|
||||
if(simple_mode == false) {
|
||||
memset(mask_buf, sh_buf_tmp[0], lv_area_get_width(&a));
|
||||
mask_res = lv_draw_mask_apply(mask_buf, a.x1, a.y1, lv_area_get_width(&a));
|
||||
if(mask_res == LV_MASK_RES_FULL_COVER) mask_res = LV_MASK_RES_CHANGED;
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
lv_blend_fill(clip, &a,
|
||||
style->body.shadow.color, mask_buf, mask_res, opa, LV_BLEND_MODE_NORMAL);
|
||||
} else {
|
||||
lv_opa_t opa_tmp = sh_buf_tmp[0];
|
||||
if(opa_tmp != LV_OPA_COVER || opa != LV_OPA_COVER) opa_tmp = (opa * opa_tmp) >> 8;
|
||||
lv_blend_fill(clip, &a,
|
||||
style->body.shadow.color, NULL, LV_MASK_RES_FULL_COVER, opa_tmp, style->body.shadow.blend_mode);
|
||||
style->body.shadow.color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa_tmp, style->body.shadow.blend_mode);
|
||||
}
|
||||
|
||||
a.y1++;
|
||||
@@ -735,9 +735,9 @@ static void shadow_draw_corner_buf(const lv_area_t * coords, lv_opa_t * sh_buf,
|
||||
sh_area.x1 = sh_area.x2 - lv_area_get_width(coords);
|
||||
sh_area.y2 = sh_area.y1 + lv_area_get_height(coords);
|
||||
|
||||
lv_mask_param_t mask_param;
|
||||
lv_draw_mask_param_t mask_param;
|
||||
lv_draw_mask_radius_init(&mask_param, &sh_area, r, false);
|
||||
int16_t mask_id = lv_draw_mask_add(lv_mask_radius, &mask_param, NULL);
|
||||
// int16_t mask_id = lv_draw_mask_add(lv_mask_radius, &mask_param, NULL);
|
||||
|
||||
#if SHADOW_ENHANCE
|
||||
/*Set half shadow width width because blur will be repeated*/
|
||||
@@ -747,15 +747,15 @@ static void shadow_draw_corner_buf(const lv_area_t * coords, lv_opa_t * sh_buf,
|
||||
else sw = sw_ori >> 1;
|
||||
#endif
|
||||
|
||||
lv_mask_res_t mask_res;
|
||||
lv_draw_mask_res_t mask_res;
|
||||
lv_coord_t y;
|
||||
lv_opa_t mask_line[size];
|
||||
uint16_t sh_ups_buf[size*size];
|
||||
uint16_t * sh_ups_tmp_buf = sh_ups_buf;
|
||||
for(y = 0; y < size; y++) {
|
||||
memset(mask_line, 0xFF, size);
|
||||
mask_res = lv_draw_mask_apply(mask_line, 0, y, size);
|
||||
if(mask_res == LV_MASK_RES_FULL_TRANSP) {
|
||||
mask_res = lv_draw_mask_radius(mask_line, 0, y, size, &mask_param);
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_TRANSP) {
|
||||
memset(sh_ups_tmp_buf, 0x00, size * sizeof(sh_ups_buf[0]));
|
||||
} else {
|
||||
lv_coord_t i;
|
||||
@@ -769,9 +769,6 @@ static void shadow_draw_corner_buf(const lv_area_t * coords, lv_opa_t * sh_buf,
|
||||
sh_ups_tmp_buf += size;
|
||||
}
|
||||
|
||||
lv_draw_mask_remove_id(mask_id);
|
||||
|
||||
|
||||
|
||||
// uint32_t k;
|
||||
// for(k = 0; k < size * size; k++) {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_arc_design(lv_obj_t * arc, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_arc_signal(lv_obj_t * arc, lv_signal_t sign, void * param);
|
||||
|
||||
/**********************
|
||||
@@ -204,18 +204,18 @@ const lv_style_t * lv_arc_get_style(const lv_obj_t * arc, lv_arc_style_t type)
|
||||
/**
|
||||
* Handle the drawing related tasks of the arcs
|
||||
* @param arc pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_arc_design(lv_obj_t * arc, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
/*Return false if the object is not covers the mask_p area*/
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
return false;
|
||||
return LV_DESIGN_RES_NOT_COVER;
|
||||
}
|
||||
/*Draw the object*/
|
||||
else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
@@ -226,7 +226,7 @@ static bool lv_arc_design(lv_obj_t * arc, const lv_area_t * mask, lv_design_mode
|
||||
lv_coord_t x = arc->coords.x1 + lv_obj_get_width(arc) / 2;
|
||||
lv_coord_t y = arc->coords.y1 + lv_obj_get_height(arc) / 2;
|
||||
lv_opa_t opa_scale = lv_obj_get_opa_scale(arc);
|
||||
lv_draw_arc(x, y, r, mask, ext->angle_start, ext->angle_end, style, opa_scale);
|
||||
lv_draw_arc(x, y, r, clip_area, ext->angle_start, ext->angle_end, style, opa_scale);
|
||||
|
||||
/*Draw circle on the ends if enabled */
|
||||
if(style->line.rounded) {
|
||||
@@ -245,7 +245,7 @@ static bool lv_arc_design(lv_obj_t * arc, const lv_area_t * mask, lv_design_mode
|
||||
cir_area.x2 = cir_x + x + thick_half;
|
||||
cir_area.y2 = cir_y + y + thick_half;
|
||||
|
||||
lv_draw_rect(&cir_area, mask, &cir_style, opa_scale);
|
||||
lv_draw_rect(&cir_area, clip_area, &cir_style, opa_scale);
|
||||
|
||||
cir_x = ((r - thick_half) * lv_trigo_sin(ext->angle_end) >> LV_TRIGO_SHIFT);
|
||||
cir_y = ((r - thick_half) * lv_trigo_sin(ext->angle_end + 90) >> LV_TRIGO_SHIFT);
|
||||
@@ -255,7 +255,7 @@ static bool lv_arc_design(lv_obj_t * arc, const lv_area_t * mask, lv_design_mode
|
||||
cir_area.x2 = cir_x + x + thick_half;
|
||||
cir_area.y2 = cir_y + y + thick_half;
|
||||
|
||||
lv_draw_rect(&cir_area, mask, &cir_style, opa_scale);
|
||||
lv_draw_rect(&cir_area, clip_area, &cir_style, opa_scale);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -263,7 +263,7 @@ static bool lv_arc_design(lv_obj_t * arc, const lv_area_t * mask, lv_design_mode
|
||||
else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
}
|
||||
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_bar_design(lv_obj_t * bar, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_bar_design(lv_obj_t * bar, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param);
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
@@ -344,18 +344,18 @@ const lv_style_t * lv_bar_get_style(const lv_obj_t * bar, lv_bar_style_t type)
|
||||
/**
|
||||
* Handle the drawing related tasks of the bars
|
||||
* @param bar pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_bar_design(lv_obj_t * bar, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_bar_design(lv_obj_t * bar, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
/*Return false if the object is not covers the mask area*/
|
||||
return ancestor_design_f(bar, mask, mode);
|
||||
return ancestor_design_f(bar, clip_area, mode);
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
lv_opa_t opa_scale = lv_obj_get_opa_scale(bar);
|
||||
|
||||
@@ -370,9 +370,9 @@ static bool lv_bar_design(lv_obj_t * bar, const lv_area_t * mask, lv_design_mode
|
||||
lv_style_t style_tmp;
|
||||
lv_style_copy(&style_tmp, style_bg);
|
||||
style_tmp.body.border.width = 0;
|
||||
lv_draw_rect(&bar->coords, mask, &style_tmp, opa_scale);
|
||||
lv_draw_rect(&bar->coords, clip_area, &style_tmp, opa_scale);
|
||||
} else {
|
||||
ancestor_design_f(bar, mask, mode);
|
||||
ancestor_design_f(bar, clip_area, mode);
|
||||
}
|
||||
#endif
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
|
||||
@@ -462,7 +462,7 @@ static bool lv_bar_design(lv_obj_t * bar, const lv_area_t * mask, lv_design_mode
|
||||
}
|
||||
|
||||
/*Draw the indicator*/
|
||||
lv_draw_rect(&indic_area, mask, style_indic, opa_scale);
|
||||
lv_draw_rect(&indic_area, clip_area, style_indic, opa_scale);
|
||||
}
|
||||
} else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
#if LV_USE_GROUP
|
||||
@@ -474,11 +474,11 @@ static bool lv_bar_design(lv_obj_t * bar, const lv_area_t * mask, lv_design_mode
|
||||
lv_style_copy(&style_tmp, style_bg);
|
||||
style_tmp.body.opa = LV_OPA_TRANSP;
|
||||
style_tmp.body.shadow.width = 0;
|
||||
lv_draw_rect(&bar->coords, mask, &style_tmp, opa_scale);
|
||||
lv_draw_rect(&bar->coords, clip_area, &style_tmp, opa_scale);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_btn_design(lv_obj_t * btn, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_btn_design(lv_obj_t * btn, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param);
|
||||
|
||||
#if LV_USE_ANIMATION && LV_BTN_INK_EFFECT
|
||||
@@ -392,17 +392,17 @@ const lv_style_t * lv_btn_get_style(const lv_obj_t * btn, lv_btn_style_t type)
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_btn_design(lv_obj_t * btn, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_btn_design(lv_obj_t * btn, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
return false;
|
||||
return ancestor_design(btn, clip_area, mode);
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
|
||||
#if LV_USE_ANIMATION && LV_BTN_INK_EFFECT
|
||||
if(btn != ink_obj) {
|
||||
ancestor_design(btn, mask, mode);
|
||||
ancestor_design(btn, clip_area, mode);
|
||||
} else {
|
||||
lv_opa_t opa_scale = lv_obj_get_opa_scale(btn);
|
||||
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
|
||||
@@ -412,7 +412,7 @@ static bool lv_btn_design(lv_obj_t * btn, const lv_area_t * mask, lv_design_mode
|
||||
lv_style_t style_tmp;
|
||||
lv_style_copy(&style_tmp, ext->styles[ink_bg_state]);
|
||||
style_tmp.body.shadow.width = ext->styles[ink_top_state]->body.shadow.width;
|
||||
lv_draw_rect(&btn->coords, mask, &style_tmp, opa_scale);
|
||||
lv_draw_rect(&btn->coords, clip_area, &style_tmp, opa_scale);
|
||||
|
||||
lv_coord_t w = lv_obj_get_width(btn);
|
||||
lv_coord_t h = lv_obj_get_height(btn);
|
||||
@@ -451,22 +451,22 @@ static bool lv_btn_design(lv_obj_t * btn, const lv_area_t * mask, lv_design_mode
|
||||
style_tmp.body.border.width = 0;
|
||||
|
||||
/*Draw the circle*/
|
||||
lv_draw_rect(&cir_area, mask, &style_tmp, opa_scale);
|
||||
lv_draw_rect(&cir_area, clip_area, &style_tmp, opa_scale);
|
||||
} else {
|
||||
lv_style_t res;
|
||||
lv_style_copy(&res, ext->styles[ink_bg_state]);
|
||||
lv_style_mix(ext->styles[ink_bg_state], ext->styles[ink_top_state], &res, ink_act_value);
|
||||
lv_draw_rect(&btn->coords, mask, &res, opa_scale);
|
||||
lv_draw_rect(&btn->coords, clip_area, &res, opa_scale);
|
||||
}
|
||||
}
|
||||
#else
|
||||
ancestor_design(btn, mask, mode);
|
||||
ancestor_design(btn, clip_area, mode);
|
||||
#endif
|
||||
} else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
ancestor_design(btn, mask, mode);
|
||||
ancestor_design(btn, clip_area, mode);
|
||||
}
|
||||
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param);
|
||||
static bool lv_btnm_design(lv_obj_t * btnm, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_btnm_design(lv_obj_t * btnm, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static uint8_t get_button_width(lv_btnm_ctrl_t ctrl_bits);
|
||||
static bool button_is_hidden(lv_btnm_ctrl_t ctrl_bits);
|
||||
static bool button_is_repeat_disabled(lv_btnm_ctrl_t ctrl_bits);
|
||||
@@ -588,23 +588,22 @@ bool lv_btnm_get_one_toggle(const lv_obj_t * btnm)
|
||||
/**
|
||||
* Handle the drawing related tasks of the button matrixs
|
||||
* @param btnm pointer to a button matrix object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_btnm_design(lv_obj_t * btnm, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_btnm_design(lv_obj_t * btnm, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
return ancestor_design_f(btnm, mask, mode);
|
||||
/*Return false if the object is not covers the mask_p area*/
|
||||
return ancestor_design_f(btnm, clip_area, mode);
|
||||
}
|
||||
/*Draw the object*/
|
||||
else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
|
||||
ancestor_design_f(btnm, mask, mode);
|
||||
ancestor_design_f(btnm, clip_area, mode);
|
||||
|
||||
lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm);
|
||||
const lv_style_t * bg_style = lv_obj_get_style(btnm);
|
||||
@@ -679,7 +678,7 @@ static bool lv_btnm_design(lv_obj_t * btnm, const lv_area_t * mask, lv_design_mo
|
||||
style_tmp.body.border.part &= ~LV_BORDER_RIGHT;
|
||||
}
|
||||
}
|
||||
lv_draw_rect(&area_tmp, mask, &style_tmp, opa_scale);
|
||||
lv_draw_rect(&area_tmp, clip_area, &style_tmp, opa_scale);
|
||||
|
||||
/*Calculate the size of the text*/
|
||||
if(btn_style->glass) btn_style = bg_style;
|
||||
@@ -693,10 +692,10 @@ static bool lv_btnm_design(lv_obj_t * btnm, const lv_area_t * mask, lv_design_mo
|
||||
area_tmp.x2 = area_tmp.x1 + txt_size.x;
|
||||
area_tmp.y2 = area_tmp.y1 + txt_size.y;
|
||||
|
||||
lv_draw_label(&area_tmp, mask, btn_style, opa_scale, ext->map_p[txt_i], txt_flag, NULL, -1, -1, NULL);
|
||||
lv_draw_label(&area_tmp, clip_area, btn_style, opa_scale, ext->map_p[txt_i], txt_flag, NULL, -1, -1, NULL);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,7 +33,7 @@ typedef uint8_t day_draw_state_t;
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_calendar_design(lv_obj_t * calendar, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_calendar_design(lv_obj_t * calendar, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_calendar_signal(lv_obj_t * calendar, lv_signal_t sign, void * param);
|
||||
static bool calculate_touched_day(lv_obj_t * calendar, const lv_point_t * touched_point);
|
||||
static lv_coord_t get_header_height(lv_obj_t * calendar);
|
||||
@@ -410,34 +410,34 @@ const lv_style_t * lv_calendar_get_style(const lv_obj_t * calendar, lv_calendar_
|
||||
/**
|
||||
* Handle the drawing related tasks of the calendars
|
||||
* @param calendar pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_calendar_design(lv_obj_t * calendar, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_calendar_design(lv_obj_t * calendar, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
/*Return false if the object is not covers the mask_p area*/
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
return ancestor_design(calendar, mask, mode);
|
||||
return ancestor_design(calendar, clip_area, mode);
|
||||
}
|
||||
/*Draw the object*/
|
||||
else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
lv_opa_t opa_scale = lv_obj_get_opa_scale(calendar);
|
||||
lv_draw_rect(&calendar->coords, mask, lv_calendar_get_style(calendar, LV_CALENDAR_STYLE_BG), opa_scale);
|
||||
lv_draw_rect(&calendar->coords, clip_area, lv_calendar_get_style(calendar, LV_CALENDAR_STYLE_BG), opa_scale);
|
||||
|
||||
draw_header(calendar, mask);
|
||||
draw_day_names(calendar, mask);
|
||||
draw_days(calendar, mask);
|
||||
draw_header(calendar, clip_area);
|
||||
draw_day_names(calendar, clip_area);
|
||||
draw_days(calendar, clip_area);
|
||||
|
||||
}
|
||||
/*Post draw when the children are drawn*/
|
||||
else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
}
|
||||
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_cb_design(lv_obj_t * cb, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static bool lv_bullet_design(lv_obj_t * bullet, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_cb_design(lv_obj_t * cb, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_bullet_design(lv_obj_t * bullet, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param);
|
||||
|
||||
/**********************
|
||||
@@ -213,20 +213,20 @@ const lv_style_t * lv_cb_get_style(const lv_obj_t * cb, lv_cb_style_t type)
|
||||
/**
|
||||
* Handle the drawing related tasks of the check boxes
|
||||
* @param cb pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_cb_design(lv_obj_t * cb, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_cb_design(lv_obj_t * cb, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
/*Return false if the object is not covers the mask_p area*/
|
||||
result = ancestor_bg_design(cb, mask, mode);
|
||||
result = ancestor_bg_design(cb, clip_area, mode);
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN || mode == LV_DESIGN_DRAW_POST) {
|
||||
lv_cb_ext_t * cb_ext = lv_obj_get_ext_attr(cb);
|
||||
lv_btn_ext_t * bullet_ext = lv_obj_get_ext_attr(cb_ext->bullet);
|
||||
@@ -234,10 +234,10 @@ static bool lv_cb_design(lv_obj_t * cb, const lv_area_t * mask, lv_design_mode_t
|
||||
/*Be sure the state of the bullet is the same as the parent button*/
|
||||
bullet_ext->state = cb_ext->bg_btn.state;
|
||||
|
||||
result = ancestor_bg_design(cb, mask, mode);
|
||||
result = ancestor_bg_design(cb, clip_area, mode);
|
||||
|
||||
} else {
|
||||
result = ancestor_bg_design(cb, mask, mode);
|
||||
result = ancestor_bg_design(cb, clip_area, mode);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -246,17 +246,17 @@ static bool lv_cb_design(lv_obj_t * cb, const lv_area_t * mask, lv_design_mode_t
|
||||
/**
|
||||
* Handle the drawing related tasks of the check boxes
|
||||
* @param bullet pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_bullet_design(lv_obj_t * bullet, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_bullet_design(lv_obj_t * bullet, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
return ancestor_bullet_design(bullet, mask, mode);
|
||||
return ancestor_bullet_design(bullet, clip_area, mode);
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
#if LV_USE_GROUP
|
||||
/* If the check box is the active in a group and
|
||||
@@ -274,16 +274,16 @@ static bool lv_bullet_design(lv_obj_t * bullet, const lv_area_t * mask, lv_desig
|
||||
}
|
||||
}
|
||||
#endif
|
||||
ancestor_bullet_design(bullet, mask, mode);
|
||||
ancestor_bullet_design(bullet, clip_area, mode);
|
||||
|
||||
#if LV_USE_GROUP
|
||||
bullet->style_p = style_ori; /*Revert the style*/
|
||||
#endif
|
||||
} else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
ancestor_bullet_design(bullet, mask, mode);
|
||||
ancestor_bullet_design(bullet, clip_area, mode);
|
||||
}
|
||||
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_chart_design(lv_obj_t * chart, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_chart_design(lv_obj_t * chart, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param);
|
||||
static void lv_chart_draw_div(lv_obj_t * chart, const lv_area_t * mask);
|
||||
static void lv_chart_draw_lines(lv_obj_t * chart, const lv_area_t * mask);
|
||||
@@ -599,35 +599,34 @@ uint16_t lv_chart_get_margin(lv_obj_t * chart)
|
||||
/**
|
||||
* Handle the drawing related tasks of the chart backgrounds
|
||||
* @param chart pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_chart_design(lv_obj_t * chart, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_chart_design(lv_obj_t * chart, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
/*Return false if the object is not covers the mask_p area*/
|
||||
return ancestor_design_f(chart, mask, mode);
|
||||
return ancestor_design_f(chart, clip_area, mode);
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
/*Draw the background*/
|
||||
lv_draw_rect(&chart->coords, mask, lv_obj_get_style(chart), lv_obj_get_opa_scale(chart));
|
||||
lv_draw_rect(&chart->coords, clip_area, lv_obj_get_style(chart), lv_obj_get_opa_scale(chart));
|
||||
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
|
||||
lv_chart_draw_div(chart, mask);
|
||||
lv_chart_draw_div(chart, clip_area);
|
||||
|
||||
if(ext->type & LV_CHART_TYPE_LINE) lv_chart_draw_lines(chart, mask);
|
||||
if(ext->type & LV_CHART_TYPE_COLUMN) lv_chart_draw_cols(chart, mask);
|
||||
if(ext->type & LV_CHART_TYPE_POINT) lv_chart_draw_points(chart, mask);
|
||||
if(ext->type & LV_CHART_TYPE_VERTICAL_LINE) lv_chart_draw_vertical_lines(chart, mask);
|
||||
if(ext->type & LV_CHART_TYPE_AREA) lv_chart_draw_areas(chart, mask);
|
||||
if(ext->type & LV_CHART_TYPE_LINE) lv_chart_draw_lines(chart, clip_area);
|
||||
if(ext->type & LV_CHART_TYPE_COLUMN) lv_chart_draw_cols(chart, clip_area);
|
||||
if(ext->type & LV_CHART_TYPE_POINT) lv_chart_draw_points(chart, clip_area);
|
||||
if(ext->type & LV_CHART_TYPE_VERTICAL_LINE) lv_chart_draw_vertical_lines(chart, clip_area);
|
||||
if(ext->type & LV_CHART_TYPE_AREA) lv_chart_draw_areas(chart, clip_area);
|
||||
|
||||
lv_chart_draw_axes(chart, mask);
|
||||
lv_chart_draw_axes(chart, clip_area);
|
||||
}
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_draw/lv_draw_mask.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
#include "../lv_misc/lv_area.h"
|
||||
#include "../lv_misc/lv_color.h"
|
||||
@@ -31,6 +32,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static lv_design_res_t lv_cont_design(lv_obj_t * cont, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_cont_signal(lv_obj_t * cont, lv_signal_t sign, void * param);
|
||||
static void lv_cont_refr_layout(lv_obj_t * cont);
|
||||
static void lv_cont_layout_col(lv_obj_t * cont);
|
||||
@@ -43,6 +45,7 @@ static void lv_cont_refr_autofit(lv_obj_t * cont);
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_design_cb_t ancestor_design;
|
||||
static lv_signal_cb_t ancestor_signal;
|
||||
|
||||
/**********************
|
||||
@@ -70,6 +73,7 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
if(new_cont == NULL) return NULL;
|
||||
|
||||
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_cont);
|
||||
if(ancestor_design == NULL) ancestor_design= lv_obj_get_design_cb(new_cont);
|
||||
|
||||
lv_obj_allocate_ext_attr(new_cont, sizeof(lv_cont_ext_t));
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext_attr(new_cont);
|
||||
@@ -83,6 +87,7 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->layout = LV_LAYOUT_OFF;
|
||||
|
||||
lv_obj_set_signal_cb(new_cont, lv_cont_signal);
|
||||
lv_obj_set_design_cb(new_cont, lv_cont_design);
|
||||
|
||||
/*Init the new container*/
|
||||
if(copy == NULL) {
|
||||
@@ -223,6 +228,41 @@ lv_fit_t lv_cont_get_fit_bottom(const lv_obj_t * cont)
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Handle the drawing related tasks of the drop down lists
|
||||
* @param btn pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static lv_design_res_t lv_cont_design(lv_obj_t * cont, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont);
|
||||
if(ext->masked) return LV_DESIGN_RES_MASKED;
|
||||
else return ancestor_design(cont, clip_area, mode);
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
ancestor_design(cont, clip_area, mode);
|
||||
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont);
|
||||
if(ext->masked) {
|
||||
const lv_style_t * style = lv_cont_get_style(cont, LV_CONT_STYLE_MAIN);
|
||||
lv_draw_mask_param_t mp;
|
||||
lv_draw_mask_radius_init(&mp, &cont->coords, style->body.radius, false);
|
||||
lv_draw_mask_add(lv_draw_mask_radius, &mp, cont + 4);
|
||||
}
|
||||
} else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont);
|
||||
if(ext->masked) {
|
||||
lv_draw_mask_remove_custom(cont + 4);
|
||||
}
|
||||
}
|
||||
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
/**
|
||||
* Signal function of the container
|
||||
* @param cont pointer to a container object
|
||||
|
||||
@@ -64,11 +64,12 @@ typedef struct
|
||||
{
|
||||
/*Inherited from 'base_obj' so no inherited ext. */ /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
uint8_t layout : 4; /*A layout from 'lv_layout_t' enum*/
|
||||
uint8_t fit_left : 2; /*A fit type from `lv_fit_t` enum */
|
||||
uint8_t fit_right : 2; /*A fit type from `lv_fit_t` enum */
|
||||
uint8_t fit_top : 2; /*A fit type from `lv_fit_t` enum */
|
||||
uint8_t fit_bottom : 2; /*A fit type from `lv_fit_t` enum */
|
||||
lv_layout_t layout : 4; /*A layout from 'lv_layout_t' enum*/
|
||||
lv_fit_t fit_left : 2; /*A fit type from `lv_fit_t` enum */
|
||||
lv_fit_t fit_right : 2; /*A fit type from `lv_fit_t` enum */
|
||||
lv_fit_t fit_top : 2; /*A fit type from `lv_fit_t` enum */
|
||||
lv_fit_t fit_bottom : 2; /*A fit type from `lv_fit_t` enum */
|
||||
uint8_t masked :1; /*Automatically a draw mask to to mask out the corners*/
|
||||
} lv_cont_ext_t;
|
||||
|
||||
/*Styles*/
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_ddlist_design(lv_obj_t * ddlist, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_ddlist_design(lv_obj_t * ddlist, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * param);
|
||||
static lv_res_t lv_ddlist_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param);
|
||||
static lv_res_t release_handler(lv_obj_t * ddlist);
|
||||
@@ -485,22 +485,22 @@ static lv_txt_flag_t lv_ddlist_get_txt_flag(const lv_obj_t * ddlist)
|
||||
/**
|
||||
* Handle the drawing related tasks of the drop down lists
|
||||
* @param ddlist pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_ddlist_design(lv_obj_t * ddlist, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_ddlist_design(lv_obj_t * ddlist, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
/*Return false if the object is not covers the mask_p area*/
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
return ancestor_design(ddlist, mask, mode);
|
||||
return ancestor_design(ddlist, clip_area, mode);
|
||||
}
|
||||
/*Draw the object*/
|
||||
else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
ancestor_design(ddlist, mask, mode);
|
||||
ancestor_design(ddlist, clip_area, mode);
|
||||
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
lv_opa_t opa_scale = lv_obj_get_opa_scale(ddlist);
|
||||
@@ -520,7 +520,7 @@ static bool lv_ddlist_design(lv_obj_t * ddlist, const lv_area_t * mask, lv_desig
|
||||
rect_area.x1 = ddlist->coords.x1;
|
||||
rect_area.x2 = ddlist->coords.x2;
|
||||
|
||||
lv_draw_rect(&rect_area, mask, ext->sel_style, opa_scale);
|
||||
lv_draw_rect(&rect_area, clip_area, ext->sel_style, opa_scale);
|
||||
}
|
||||
}
|
||||
/*Post draw when the children are drawn*/
|
||||
@@ -545,7 +545,7 @@ static bool lv_ddlist_design(lv_obj_t * ddlist, const lv_area_t * mask, lv_desig
|
||||
area_sel.x2 = ddlist->coords.x2;
|
||||
lv_area_t mask_sel;
|
||||
bool area_ok;
|
||||
area_ok = lv_area_intersect(&mask_sel, mask, &area_sel);
|
||||
area_ok = lv_area_intersect(&mask_sel, clip_area, &area_sel);
|
||||
if(area_ok) {
|
||||
const lv_style_t * sel_style = lv_ddlist_get_style(ddlist, LV_DDLIST_STYLE_SEL);
|
||||
lv_style_t new_style;
|
||||
@@ -580,7 +580,7 @@ static bool lv_ddlist_design(lv_obj_t * ddlist, const lv_area_t * mask, lv_desig
|
||||
|
||||
lv_area_t mask_arrow;
|
||||
bool area_ok;
|
||||
area_ok = lv_area_intersect(&mask_arrow, mask, &area_arrow);
|
||||
area_ok = lv_area_intersect(&mask_arrow, clip_area, &area_arrow);
|
||||
if(area_ok) {
|
||||
lv_draw_label(&area_arrow, &mask_arrow, &new_style, opa_scale, LV_SYMBOL_DOWN, LV_TXT_FLAG_NONE,
|
||||
NULL, -1, -1, NULL); /*Use a down arrow in ddlist, you can replace it with your
|
||||
@@ -589,10 +589,10 @@ static bool lv_ddlist_design(lv_obj_t * ddlist, const lv_area_t * mask, lv_desig
|
||||
}
|
||||
}
|
||||
/*Draw the scrollbar in the ancestor page design function*/
|
||||
ancestor_design(ddlist, mask, mode);
|
||||
ancestor_design(ddlist, clip_area, mode);
|
||||
}
|
||||
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_gauge_design(lv_obj_t * gauge, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_gauge_design(lv_obj_t * gauge, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param);
|
||||
static void lv_gauge_draw_scale(lv_obj_t * gauge, const lv_area_t * mask);
|
||||
static void lv_gauge_draw_needle(lv_obj_t * gauge, const lv_area_t * mask);
|
||||
@@ -249,19 +249,19 @@ uint8_t lv_gauge_get_label_count(const lv_obj_t * gauge)
|
||||
/**
|
||||
* Handle the drawing related tasks of the gauges
|
||||
* @param gauge pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_gauge_design(lv_obj_t * gauge, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_gauge_design(lv_obj_t * gauge, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
|
||||
/*Return false if the object is not covers the mask_p area*/
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
return false;
|
||||
return LV_DESIGN_RES_NOT_COVER;
|
||||
}
|
||||
/*Draw the object*/
|
||||
else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
@@ -273,11 +273,11 @@ static bool lv_gauge_design(lv_obj_t * gauge, const lv_area_t * mask, lv_design_
|
||||
const lv_style_t * style = lv_obj_get_style(gauge);
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
|
||||
lv_gauge_draw_scale(gauge, mask);
|
||||
lv_gauge_draw_scale(gauge, clip_area);
|
||||
|
||||
/*Draw the ancestor line meter with max value to show the rainbow like line colors*/
|
||||
uint16_t line_cnt_tmp = ext->lmeter.line_cnt;
|
||||
ancestor_design(gauge, mask, mode); /*To draw lines*/
|
||||
ancestor_design(gauge, clip_area, mode); /*To draw lines*/
|
||||
|
||||
/*Temporally modify the line meter to draw longer lines where labels are*/
|
||||
lv_style_t style_tmp;
|
||||
@@ -287,20 +287,20 @@ static bool lv_gauge_design(lv_obj_t * gauge, const lv_area_t * mask, lv_design_
|
||||
style_tmp.body.padding.right = style_tmp.body.padding.right * 2; /*Longer lines*/
|
||||
gauge->style_p = &style_tmp;
|
||||
|
||||
ancestor_design(gauge, mask, mode); /*To draw lines*/
|
||||
ancestor_design(gauge, clip_area, mode); /*To draw lines*/
|
||||
|
||||
ext->lmeter.line_cnt = line_cnt_tmp; /*Restore the parameters*/
|
||||
gauge->style_p = style_ori_p; /*Restore the ORIGINAL style pointer*/
|
||||
|
||||
lv_gauge_draw_needle(gauge, mask);
|
||||
lv_gauge_draw_needle(gauge, clip_area);
|
||||
|
||||
}
|
||||
/*Post draw when the children are drawn*/
|
||||
else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
ancestor_design(gauge, mask, mode);
|
||||
ancestor_design(gauge, clip_area, mode);
|
||||
}
|
||||
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_img_design(lv_obj_t * img, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param);
|
||||
|
||||
/**********************
|
||||
@@ -312,23 +312,25 @@ lv_coord_t lv_img_get_offset_y(lv_obj_t * img)
|
||||
/**
|
||||
* Handle the drawing related tasks of the images
|
||||
* @param img pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_img_design(lv_obj_t * img, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
const lv_style_t * style = lv_obj_get_style(img);
|
||||
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
|
||||
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
bool cover = false;
|
||||
if(ext->src_type == LV_IMG_SRC_UNKNOWN || ext->src_type == LV_IMG_SRC_SYMBOL) return false;
|
||||
lv_design_res_t cover = LV_DESIGN_RES_NOT_COVER;
|
||||
if(ext->src_type == LV_IMG_SRC_UNKNOWN || ext->src_type == LV_IMG_SRC_SYMBOL) return LV_DESIGN_RES_NOT_COVER;
|
||||
|
||||
if(ext->cf == LV_IMG_CF_TRUE_COLOR || ext->cf == LV_IMG_CF_RAW) cover = lv_area_is_in(mask, &img->coords);
|
||||
if(ext->cf == LV_IMG_CF_TRUE_COLOR || ext->cf == LV_IMG_CF_RAW) {
|
||||
cover = lv_area_is_in(clip_area, &img->coords) ? LV_DESIGN_RES_COVER : LV_DESIGN_RES_NOT_COVER;
|
||||
}
|
||||
|
||||
return cover;
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
@@ -351,7 +353,7 @@ static bool lv_img_design(lv_obj_t * img, const lv_area_t * mask, lv_design_mode
|
||||
cords_tmp.x1 = coords.x1;
|
||||
cords_tmp.x2 = coords.x1 + ext->w - 1;
|
||||
for(; cords_tmp.x1 < coords.x2; cords_tmp.x1 += ext->w, cords_tmp.x2 += ext->w) {
|
||||
lv_draw_img(&cords_tmp, mask, ext->src, style, opa_scale);
|
||||
lv_draw_img(&cords_tmp, clip_area, ext->src, style, opa_scale);
|
||||
}
|
||||
}
|
||||
} else if(ext->src_type == LV_IMG_SRC_SYMBOL) {
|
||||
@@ -359,11 +361,11 @@ static bool lv_img_design(lv_obj_t * img, const lv_area_t * mask, lv_design_mode
|
||||
lv_style_t style_mod;
|
||||
lv_style_copy(&style_mod, style);
|
||||
style_mod.text.color = style->image.color;
|
||||
lv_draw_label(&coords, mask, &style_mod, opa_scale, ext->src, LV_TXT_FLAG_NONE, NULL, -1, -1, NULL);
|
||||
lv_draw_label(&coords, clip_area, &style_mod, opa_scale, ext->src, LV_TXT_FLAG_NONE, NULL, -1, -1, NULL);
|
||||
} else {
|
||||
/*Trigger the error handler of image drawer*/
|
||||
LV_LOG_WARN("lv_img_design: image source type is unknown");
|
||||
lv_draw_img(&img->coords, mask, NULL, style, opa_scale);
|
||||
lv_draw_img(&img->coords, clip_area, NULL, style, opa_scale);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_imgbtn_signal(lv_obj_t * imgbtn, lv_signal_t sign, void * param);
|
||||
static void refr_img(lv_obj_t * imgbtn);
|
||||
|
||||
@@ -242,21 +242,21 @@ const lv_style_t * lv_imgbtn_get_style(const lv_obj_t * imgbtn, lv_imgbtn_style_
|
||||
/**
|
||||
* Handle the drawing related tasks of the image buttons
|
||||
* @param imgbtn pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
/*Return false if the object is not covers the mask_p area*/
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
lv_imgbtn_ext_t * ext = lv_obj_get_ext_attr(imgbtn);
|
||||
bool cover = false;
|
||||
lv_design_res_t cover = LV_DESIGN_RES_NOT_COVER;
|
||||
if(ext->act_cf == LV_IMG_CF_TRUE_COLOR || ext->act_cf == LV_IMG_CF_RAW) {
|
||||
cover = lv_area_is_in(mask, &imgbtn->coords);
|
||||
cover = lv_area_is_in(clip_area, &imgbtn->coords) ? LV_DESIGN_RES_COVER : LV_DESIGN_RES_NOT_COVER;
|
||||
}
|
||||
|
||||
return cover;
|
||||
@@ -271,7 +271,7 @@ static bool lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * mask, lv_desig
|
||||
|
||||
#if LV_IMGBTN_TILED == 0
|
||||
const void * src = ext->img_src[state];
|
||||
lv_draw_img(&imgbtn->coords, mask, src, style, opa_scale);
|
||||
lv_draw_img(&imgbtn->coords, clip_area, src, style, opa_scale);
|
||||
#else
|
||||
const void * src;
|
||||
lv_img_header_t header;
|
||||
@@ -287,7 +287,7 @@ static bool lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * mask, lv_desig
|
||||
coords.y1 = imgbtn->coords.y1;
|
||||
coords.x2 = coords.x1 + header.w - 1;
|
||||
coords.y2 = coords.y1 + header.h - 1;
|
||||
lv_draw_img(&coords, mask, src, style, opa_scale);
|
||||
lv_draw_img(&coords, clip_area, src, style, opa_scale);
|
||||
}
|
||||
|
||||
src = ext->img_src_right[state];
|
||||
@@ -298,7 +298,7 @@ static bool lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * mask, lv_desig
|
||||
coords.y1 = imgbtn->coords.y1;
|
||||
coords.x2 = imgbtn->coords.x2;
|
||||
coords.y2 = imgbtn->coords.y1 + header.h - 1;
|
||||
lv_draw_img(&coords, mask, src, style, opa_scale);
|
||||
lv_draw_img(&coords, clip_area, src, style, opa_scale);
|
||||
}
|
||||
|
||||
src = ext->img_src_mid[state];
|
||||
@@ -313,7 +313,7 @@ static bool lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * mask, lv_desig
|
||||
coords.y2 = imgbtn->coords.y1 + header.h - 1;
|
||||
|
||||
for(i = 0; i < obj_w - right_w - left_w; i += header.w) {
|
||||
lv_draw_img(&coords, mask, src, style, opa_scale);
|
||||
lv_draw_img(&coords, clip_area, src, style, opa_scale);
|
||||
coords.x1 = coords.x2 + 1;
|
||||
coords.x2 += header.w;
|
||||
}
|
||||
@@ -326,7 +326,7 @@ static bool lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * mask, lv_desig
|
||||
else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
}
|
||||
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static lv_res_t lv_label_signal(lv_obj_t * label, lv_signal_t sign, void * param);
|
||||
static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_label_design(lv_obj_t * label, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static void lv_label_refr_text(lv_obj_t * label);
|
||||
static void lv_label_revert_dots(lv_obj_t * label);
|
||||
|
||||
@@ -803,18 +803,18 @@ void lv_label_cut_text(lv_obj_t * label, uint32_t pos, uint32_t cnt)
|
||||
/**
|
||||
* Handle the drawing related tasks of the labels
|
||||
* @param label pointer to a label object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_label_design(lv_obj_t * label, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
/* A label never covers an area */
|
||||
if(mode == LV_DESIGN_COVER_CHK)
|
||||
return false;
|
||||
return LV_DESIGN_RES_NOT_COVER;
|
||||
else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
lv_area_t coords;
|
||||
const lv_style_t * style = lv_obj_get_style(label);
|
||||
@@ -824,7 +824,7 @@ static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_
|
||||
#if LV_USE_GROUP
|
||||
lv_group_t * g = lv_obj_get_group(label);
|
||||
if(lv_group_get_focused(g) == label) {
|
||||
lv_draw_rect(&coords, mask, style, opa_scale);
|
||||
lv_draw_rect(&coords, clip_area, style, opa_scale);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -838,7 +838,7 @@ static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_
|
||||
bg.y1 -= style->body.padding.top;
|
||||
bg.y2 += style->body.padding.bottom;
|
||||
|
||||
lv_draw_rect(&bg, mask, style, lv_obj_get_opa_scale(label));
|
||||
lv_draw_rect(&bg, clip_area, style, lv_obj_get_opa_scale(label));
|
||||
}
|
||||
|
||||
/*TEST: draw a background for the label*/
|
||||
@@ -871,7 +871,7 @@ static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_
|
||||
/*Just for compatibility*/
|
||||
lv_draw_label_hint_t * hint = NULL;
|
||||
#endif
|
||||
lv_draw_label(&coords, mask, style, opa_scale, ext->text, flag, &ext->offset,
|
||||
lv_draw_label(&coords, clip_area, style, opa_scale, ext->text, flag, &ext->offset,
|
||||
lv_label_get_text_sel_start(label), lv_label_get_text_sel_end(label), hint);
|
||||
|
||||
|
||||
@@ -888,7 +888,7 @@ static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_
|
||||
lv_font_get_glyph_width(style->text.font, ' ', ' ') * LV_LABEL_WAIT_CHAR_COUNT;
|
||||
ofs.y = ext->offset.y;
|
||||
|
||||
lv_draw_label(&coords, mask, style, opa_scale, ext->text, flag, &ofs,
|
||||
lv_draw_label(&coords, clip_area, style, opa_scale, ext->text, flag, &ofs,
|
||||
lv_label_get_text_sel_start(label), lv_label_get_text_sel_end(label), NULL);
|
||||
}
|
||||
|
||||
@@ -896,12 +896,12 @@ static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_
|
||||
if(size.y > lv_obj_get_height(label)) {
|
||||
ofs.x = ext->offset.x;
|
||||
ofs.y = ext->offset.y + size.y + lv_font_get_line_height(style->text.font);
|
||||
lv_draw_label(&coords, mask, style, opa_scale, ext->text, flag, &ofs,
|
||||
lv_draw_label(&coords, clip_area, style, opa_scale, ext->text, flag, &ofs,
|
||||
lv_label_get_text_sel_start(label), lv_label_get_text_sel_end(label), NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,13 +27,13 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_led_design(lv_obj_t * led, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_led_design(lv_obj_t * led, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_led_signal(lv_obj_t * led, lv_signal_t sign, void * param);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_design_cb_t ancestor_design_f;
|
||||
static lv_design_cb_t ancestor_design;
|
||||
static lv_signal_cb_t ancestor_signal;
|
||||
|
||||
/**********************
|
||||
@@ -60,7 +60,7 @@ lv_obj_t * lv_led_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
if(new_led == NULL) return NULL;
|
||||
|
||||
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_led);
|
||||
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_cb(new_led);
|
||||
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(new_led);
|
||||
|
||||
/*Allocate the object type specific extended data*/
|
||||
lv_led_ext_t * ext = lv_obj_allocate_ext_attr(new_led, sizeof(lv_led_ext_t));
|
||||
@@ -172,18 +172,18 @@ uint8_t lv_led_get_bright(const lv_obj_t * led)
|
||||
/**
|
||||
* Handle the drawing related tasks of the leds
|
||||
* @param led pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_led_design(lv_obj_t * led, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_led_design(lv_obj_t * led, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
/*Return false if the object is not covers the mask area*/
|
||||
return ancestor_design_f(led, mask, mode);
|
||||
/*Return false if the object is not covers the clip_area area*/
|
||||
return ancestor_design(led, clip_area, mode);
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
/*Make darker colors in a temporary style according to the brightness*/
|
||||
lv_led_ext_t * ext = lv_obj_get_ext_attr(led);
|
||||
@@ -210,10 +210,10 @@ static bool lv_led_design(lv_obj_t * led, const lv_area_t * mask, lv_design_mode
|
||||
((bright_tmp - LV_LED_BRIGHT_OFF) * style->body.shadow.width) / (LV_LED_BRIGHT_ON - LV_LED_BRIGHT_OFF);
|
||||
|
||||
led->style_p = &leds_tmp;
|
||||
ancestor_design_f(led, mask, mode);
|
||||
ancestor_design(led, clip_area, mode);
|
||||
led->style_p = style_ori_p; /*Restore the ORIGINAL style pointer*/
|
||||
}
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_line_design(lv_obj_t * line, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_line_design(lv_obj_t * line, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_line_signal(lv_obj_t * line, lv_signal_t sign, void * param);
|
||||
|
||||
/**********************
|
||||
@@ -196,18 +196,18 @@ bool lv_line_get_y_invert(const lv_obj_t * line)
|
||||
/**
|
||||
* Handle the drawing related tasks of the lines
|
||||
* @param line pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_line_design(lv_obj_t * line, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_line_design(lv_obj_t * line, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
/*A line never covers an area*/
|
||||
if(mode == LV_DESIGN_COVER_CHK)
|
||||
return false;
|
||||
return LV_DESIGN_RES_NOT_COVER;
|
||||
else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
lv_line_ext_t * ext = lv_obj_get_ext_attr(line);
|
||||
|
||||
@@ -245,7 +245,7 @@ static bool lv_line_design(lv_obj_t * line, const lv_area_t * mask, lv_design_mo
|
||||
p1.y = h - ext->point_array[i].y + y_ofs;
|
||||
p2.y = h - ext->point_array[i + 1].y + y_ofs;
|
||||
}
|
||||
lv_draw_line(&p1, &p2, mask, style, opa_scale);
|
||||
lv_draw_line(&p1, &p2, clip_area, style, opa_scale);
|
||||
|
||||
/*Draw circle on the joints if enabled*/
|
||||
if(style->line.rounded) {
|
||||
@@ -253,7 +253,7 @@ static bool lv_line_design(lv_obj_t * line, const lv_area_t * mask, lv_design_mo
|
||||
circle_area.y1 = p1.y - ((style->line.width - 1) >> 1) - ((style->line.width - 1) & 0x1);
|
||||
circle_area.x2 = p1.x + ((style->line.width - 1) >> 1);
|
||||
circle_area.y2 = p1.y + ((style->line.width - 1) >> 1);
|
||||
lv_draw_rect(&circle_area, mask, &circle_style_tmp, opa_scale);
|
||||
lv_draw_rect(&circle_area, clip_area, &circle_style_tmp, opa_scale);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,10 +263,10 @@ static bool lv_line_design(lv_obj_t * line, const lv_area_t * mask, lv_design_mo
|
||||
circle_area.y1 = p2.y - ((style->line.width - 1) >> 1) - ((style->line.width - 1) & 0x1);
|
||||
circle_area.x2 = p2.x + ((style->line.width - 1) >> 1);
|
||||
circle_area.y2 = p2.y + ((style->line.width - 1) >> 1);
|
||||
lv_draw_rect(&circle_area, mask, &circle_style_tmp, opa_scale);
|
||||
lv_draw_rect(&circle_area, clip_area, &circle_style_tmp, opa_scale);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_lmeter_design(lv_obj_t * lmeter, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_lmeter_design(lv_obj_t * lmeter, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_lmeter_signal(lv_obj_t * lmeter, lv_signal_t sign, void * param);
|
||||
static lv_coord_t lv_lmeter_coord_round(int32_t x);
|
||||
|
||||
@@ -234,18 +234,18 @@ uint16_t lv_lmeter_get_scale_angle(const lv_obj_t * lmeter)
|
||||
/**
|
||||
* Handle the drawing related tasks of the line meters
|
||||
* @param lmeter pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_lmeter_design(lv_obj_t * lmeter, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_lmeter_design(lv_obj_t * lmeter, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
/*Return false if the object is not covers the mask_p area*/
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
return false;
|
||||
return LV_DESIGN_RES_NOT_COVER;
|
||||
}
|
||||
/*Draw the object*/
|
||||
else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
@@ -310,7 +310,7 @@ static bool lv_lmeter_design(lv_obj_t * lmeter, const lv_area_t * mask, lv_desig
|
||||
lv_color_mix(style->body.grad_color, style->body.main_color, (255 * i) / ext->line_cnt);
|
||||
}
|
||||
|
||||
lv_draw_line(&p1, &p2, mask, &style_tmp, opa_scale);
|
||||
lv_draw_line(&p1, &p2, clip_area, &style_tmp, opa_scale);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -318,7 +318,7 @@ static bool lv_lmeter_design(lv_obj_t * lmeter, const lv_area_t * mask, lv_desig
|
||||
else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
}
|
||||
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,14 +30,14 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_templ_design(lv_obj_t * templ, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_templ_design(lv_obj_t * templ, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_templ_signal(lv_obj_t * templ, lv_signal_t sign, void * param);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_signal_func_t ancestor_signal;
|
||||
static lv_design_func_t ancestor_design;
|
||||
static lv_signal_cb_t ancestor_signal;
|
||||
static lv_design_cb_t ancestor_design;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
@@ -67,15 +67,15 @@ lv_obj_t * lv_templ_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_templ_ext_t * ext = lv_obj_allocate_ext_attr(new_templ, sizeof(lv_templ_ext_t));
|
||||
lv_mem_assert(ext);
|
||||
if(ext == NULL) return NULL;
|
||||
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_func(new_templ);
|
||||
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_func(new_templ);
|
||||
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_templ);
|
||||
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(new_templ);
|
||||
|
||||
/*Initialize the allocated 'ext' */
|
||||
ext->xyz = 0;
|
||||
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
lv_obj_set_signal_func(new_templ, lv_templ_signal);
|
||||
lv_obj_set_design_func(new_templ, lv_templ_design);
|
||||
lv_obj_set_signal_cb(new_templ, lv_templ_signal);
|
||||
lv_obj_set_design_cb(new_templ, lv_templ_design);
|
||||
|
||||
/*Init the new template template*/
|
||||
if(copy == NULL) {
|
||||
@@ -174,13 +174,13 @@ lv_style_t * lv_templ_get_style(const lv_obj_t * templ, lv_templ_style_t type)
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_templ_design(lv_obj_t * templ, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_templ_design(lv_obj_t * templ, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
/*Return false if the object is not covers the mask_p area*/
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
return false;
|
||||
return LV_DESIGN_RES_NOT_COVER;
|
||||
}
|
||||
/*Draw the object*/
|
||||
else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
@@ -190,7 +190,7 @@ static bool lv_templ_design(lv_obj_t * templ, const lv_area_t * mask, lv_design_
|
||||
else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
}
|
||||
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void lv_page_sb_refresh(lv_obj_t * page);
|
||||
static bool lv_page_design(lv_obj_t * page, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static bool lv_scrl_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_page_design(lv_obj_t * page, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_scrl_design(lv_obj_t * scrl, const lv_area_t * clisp_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param);
|
||||
static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param);
|
||||
static void scrl_def_event_cb(lv_obj_t * scrl, lv_event_t event);
|
||||
@@ -108,6 +108,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
/*Init the new page object*/
|
||||
if(copy == NULL) {
|
||||
ext->bg.masked = 1;
|
||||
ext->scrl = lv_cont_create(new_page, NULL);
|
||||
lv_obj_set_signal_cb(ext->scrl, lv_page_scrollable_signal);
|
||||
lv_obj_set_design_cb(ext->scrl, lv_scrl_design);
|
||||
@@ -630,17 +631,17 @@ void lv_page_start_edge_flash(lv_obj_t * page)
|
||||
/**
|
||||
* Handle the drawing related tasks of the pages
|
||||
* @param page pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_page_design(lv_obj_t * page, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_page_design(lv_obj_t * page, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
return ancestor_design(page, mask, mode);
|
||||
return ancestor_design(page, clip_area, mode);
|
||||
}
|
||||
/*Cache page bg style for temporary modification*/
|
||||
const lv_style_t * style = lv_page_get_style(page, LV_PAGE_STYLE_BG);
|
||||
@@ -650,13 +651,20 @@ static bool lv_page_design(lv_obj_t * page, const lv_area_t * mask, lv_design_mo
|
||||
if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
/*Draw without border*/
|
||||
style_tmp.body.border.width = 0;
|
||||
lv_draw_rect(&page->coords, mask, &style_tmp, lv_obj_get_opa_scale(page));
|
||||
lv_draw_rect(&page->coords, clip_area, &style_tmp, lv_obj_get_opa_scale(page));
|
||||
|
||||
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
|
||||
if(ext->bg.masked) {
|
||||
const lv_style_t * style = lv_page_get_style(page, LV_PAGE_STYLE_BG);
|
||||
lv_draw_mask_param_t mp;
|
||||
lv_draw_mask_radius_init(&mp, &page->coords, style->body.radius, false);
|
||||
lv_draw_mask_add(lv_draw_mask_radius, &mp, page + 4);
|
||||
}
|
||||
} else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
/*Draw only a border*/
|
||||
style_tmp.body.shadow.width = 0;
|
||||
style_tmp.body.opa = LV_OPA_TRANSP;
|
||||
lv_draw_rect(&page->coords, mask, &style_tmp, lv_obj_get_opa_scale(page));
|
||||
lv_draw_rect(&page->coords, clip_area, &style_tmp, lv_obj_get_opa_scale(page));
|
||||
|
||||
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
|
||||
|
||||
@@ -669,7 +677,7 @@ static bool lv_page_design(lv_obj_t * page, const lv_area_t * mask, lv_design_mo
|
||||
sb_area.y1 += page->coords.y1;
|
||||
sb_area.x2 += page->coords.x1;
|
||||
sb_area.y2 += page->coords.y1;
|
||||
lv_draw_rect(&sb_area, mask, ext->sb.style, lv_obj_get_opa_scale(page));
|
||||
lv_draw_rect(&sb_area, clip_area, ext->sb.style, lv_obj_get_opa_scale(page));
|
||||
}
|
||||
|
||||
if(ext->sb.ver_draw && (ext->sb.mode & LV_SB_MODE_HIDE) == 0) {
|
||||
@@ -679,7 +687,7 @@ static bool lv_page_design(lv_obj_t * page, const lv_area_t * mask, lv_design_mo
|
||||
sb_area.y1 += page->coords.y1;
|
||||
sb_area.x2 += page->coords.x1;
|
||||
sb_area.y2 += page->coords.y1;
|
||||
lv_draw_rect(&sb_area, mask, ext->sb.style, lv_obj_get_opa_scale(page));
|
||||
lv_draw_rect(&sb_area, clip_area, ext->sb.style, lv_obj_get_opa_scale(page));
|
||||
}
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
@@ -718,29 +726,33 @@ static bool lv_page_design(lv_obj_t * page, const lv_area_t * mask, lv_design_mo
|
||||
flash_style.body.radius = LV_RADIUS_CIRCLE;
|
||||
uint32_t opa = (flash_style.body.opa * ext->edge_flash.state) / LV_PAGE_END_FLASH_SIZE;
|
||||
flash_style.body.opa = opa;
|
||||
lv_draw_rect(&flash_area, mask, &flash_style, lv_obj_get_opa_scale(page));
|
||||
lv_draw_rect(&flash_area, clip_area, &flash_style, lv_obj_get_opa_scale(page));
|
||||
}
|
||||
}
|
||||
|
||||
if(ext->bg.masked) {
|
||||
lv_draw_mask_remove_custom(page + 4);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the drawing related tasks of the scrollable object
|
||||
* @param scrl pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clisp_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_scrl_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_scrl_design(lv_obj_t * scrl, const lv_area_t * clisp_area, lv_design_mode_t mode)
|
||||
{
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
return ancestor_design(scrl, mask, mode);
|
||||
return ancestor_design(scrl, clisp_area, mode);
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
#if LV_USE_GROUP
|
||||
/* If the page is focused in a group and
|
||||
@@ -766,16 +778,16 @@ static bool lv_scrl_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mo
|
||||
}
|
||||
}
|
||||
#endif
|
||||
ancestor_design(scrl, mask, mode);
|
||||
ancestor_design(scrl, clisp_area, mode);
|
||||
|
||||
#if LV_USE_GROUP
|
||||
scrl->style_p = style_scrl_ori; /*Revert the style*/
|
||||
#endif
|
||||
} else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
ancestor_design(scrl, mask, mode);
|
||||
ancestor_design(scrl, clisp_area, mode);
|
||||
}
|
||||
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_preload_design(lv_obj_t * preload, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_preload_design(lv_obj_t * preload, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_preload_signal(lv_obj_t * preload, lv_signal_t sign, void * param);
|
||||
|
||||
/**********************
|
||||
@@ -345,18 +345,18 @@ void lv_preload_spinner_anim(void * ptr, lv_anim_value_t val)
|
||||
/**
|
||||
* Handle the drawing related tasks of the pre loaders
|
||||
* @param preload pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_preload_design(lv_obj_t * preload, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_preload_design(lv_obj_t * preload, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
/*Return false if the object is not covers the mask_p area*/
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
return false;
|
||||
return LV_DESIGN_RES_NOT_COVER;
|
||||
}
|
||||
/*Draw the object*/
|
||||
else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
@@ -383,16 +383,16 @@ static bool lv_preload_design(lv_obj_t * preload, const lv_area_t * mask, lv_des
|
||||
bg_area.x2 = x + r;
|
||||
bg_area.y2 = y + r;
|
||||
|
||||
lv_draw_rect(&bg_area, mask, &bg_style, lv_obj_get_opa_scale(preload));
|
||||
lv_draw_rect(&bg_area, clip_area, &bg_style, lv_obj_get_opa_scale(preload));
|
||||
}
|
||||
/*Draw the arc above the background circle */
|
||||
ancestor_design(preload, mask, mode);
|
||||
ancestor_design(preload, clip_area, mode);
|
||||
}
|
||||
/*Post draw when the children are drawn*/
|
||||
else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
}
|
||||
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_roller_design(lv_obj_t * roller, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_roller_design(lv_obj_t * roller, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void * param);
|
||||
static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * param);
|
||||
static void refr_position(lv_obj_t * roller, lv_anim_enable_t animen);
|
||||
@@ -295,22 +295,22 @@ const lv_style_t * lv_roller_get_style(const lv_obj_t * roller, lv_roller_style_
|
||||
/**
|
||||
* Handle the drawing related tasks of the rollers
|
||||
* @param roller pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_roller_design(lv_obj_t * roller, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_roller_design(lv_obj_t * roller, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
/*Return false if the object is not covers the mask_p area*/
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
return false;
|
||||
return LV_DESIGN_RES_NOT_COVER;
|
||||
}
|
||||
/*Draw the object*/
|
||||
else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
draw_bg(roller, mask);
|
||||
draw_bg(roller, clip_area);
|
||||
|
||||
const lv_style_t * style = lv_roller_get_style(roller, LV_ROLLER_STYLE_BG);
|
||||
lv_opa_t opa_scale = lv_obj_get_opa_scale(roller);
|
||||
@@ -328,7 +328,7 @@ static bool lv_roller_design(lv_obj_t * roller, const lv_area_t * mask, lv_desig
|
||||
rect_area.x1 = roller_coords.x1;
|
||||
rect_area.x2 = roller_coords.x2;
|
||||
|
||||
lv_draw_rect(&rect_area, mask, ext->ddlist.sel_style, opa_scale);
|
||||
lv_draw_rect(&rect_area, clip_area, ext->ddlist.sel_style, opa_scale);
|
||||
}
|
||||
/*Post draw when the children are drawn*/
|
||||
else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
@@ -347,7 +347,7 @@ static bool lv_roller_design(lv_obj_t * roller, const lv_area_t * mask, lv_desig
|
||||
rect_area.x2 = roller->coords.x2;
|
||||
lv_area_t mask_sel;
|
||||
bool area_ok;
|
||||
area_ok = lv_area_intersect(&mask_sel, mask, &rect_area);
|
||||
area_ok = lv_area_intersect(&mask_sel, clip_area, &rect_area);
|
||||
if(area_ok) {
|
||||
const lv_style_t * sel_style = lv_roller_get_style(roller, LV_ROLLER_STYLE_SEL);
|
||||
lv_style_t new_style;
|
||||
@@ -371,7 +371,7 @@ static bool lv_roller_design(lv_obj_t * roller, const lv_area_t * mask, lv_desig
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_slider_design(lv_obj_t * slider, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * param);
|
||||
|
||||
/**********************
|
||||
@@ -215,18 +215,18 @@ const lv_style_t * lv_slider_get_style(const lv_obj_t * slider, lv_slider_style_
|
||||
/**
|
||||
* Handle the drawing related tasks of the sliders
|
||||
* @param slider pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_slider_design(lv_obj_t * slider, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
/*Return false if the object is not covers the mask_p area*/
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
return false;
|
||||
return LV_DESIGN_RES_NOT_COVER;
|
||||
}
|
||||
/*Draw the object*/
|
||||
else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
@@ -272,7 +272,7 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig
|
||||
}
|
||||
|
||||
#if LV_USE_GROUP == 0
|
||||
lv_draw_rect(&area_bg, mask, style_bg, lv_obj_get_opa_scale(slider));
|
||||
lv_draw_rect(&area_bg, clip_area, style_bg, lv_obj_get_opa_scale(slider));
|
||||
#else
|
||||
/* Draw the borders later if the slider is focused.
|
||||
* At value = 100% the indicator can cover to whole background and the focused style won't
|
||||
@@ -281,9 +281,9 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig
|
||||
lv_style_t style_tmp;
|
||||
lv_style_copy(&style_tmp, style_bg);
|
||||
style_tmp.body.border.width = 0;
|
||||
lv_draw_rect(&area_bg, mask, &style_tmp, opa_scale);
|
||||
lv_draw_rect(&area_bg, clip_area, &style_tmp, opa_scale);
|
||||
} else {
|
||||
lv_draw_rect(&area_bg, mask, style_bg, opa_scale);
|
||||
lv_draw_rect(&area_bg, clip_area, style_bg, opa_scale);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -339,7 +339,7 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig
|
||||
|
||||
/*Draw the indicator but don't draw an ugly 1px wide rectangle on the left on min.
|
||||
* value*/
|
||||
if(area_indic.x1 != area_indic.x2) lv_draw_rect(&area_indic, mask, style_indic, opa_scale);
|
||||
if(area_indic.x1 != area_indic.x2) lv_draw_rect(&area_indic, clip_area, style_indic, opa_scale);
|
||||
|
||||
} else {
|
||||
lv_coord_t indic_h = lv_area_get_height(&area_indic);
|
||||
@@ -363,7 +363,7 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig
|
||||
|
||||
/*Draw the indicator but don't draw an ugly 1px height rectangle on the bottom on min.
|
||||
* value*/
|
||||
if(area_indic.x1 != area_indic.x2) lv_draw_rect(&area_indic, mask, style_indic, opa_scale);
|
||||
if(area_indic.x1 != area_indic.x2) lv_draw_rect(&area_indic, clip_area, style_indic, opa_scale);
|
||||
}
|
||||
|
||||
/*Before the knob add the border if required*/
|
||||
@@ -376,7 +376,7 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig
|
||||
lv_style_copy(&style_tmp, style_bg);
|
||||
style_tmp.body.opa = LV_OPA_TRANSP;
|
||||
style_tmp.body.shadow.width = 0;
|
||||
lv_draw_rect(&area_bg, mask, &style_tmp, opa_scale);
|
||||
lv_draw_rect(&area_bg, clip_area, &style_tmp, opa_scale);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -442,13 +442,13 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig
|
||||
knob_area.x1 = slider->coords.x1;
|
||||
knob_area.x2 = slider->coords.x2;
|
||||
}
|
||||
lv_draw_rect(&knob_area, mask, style_knob, opa_scale);
|
||||
lv_draw_rect(&knob_area, clip_area, style_knob, opa_scale);
|
||||
}
|
||||
/*Post draw when the children are drawn*/
|
||||
else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
}
|
||||
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,8 +40,8 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_ta_design(lv_obj_t * ta, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static bool lv_ta_scrollable_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_ta_design(lv_obj_t * ta, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_ta_scrollable_design(lv_obj_t * scrl, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param);
|
||||
static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param);
|
||||
#if LV_USE_ANIMATION
|
||||
@@ -1207,48 +1207,48 @@ void lv_ta_cursor_up(lv_obj_t * ta)
|
||||
/**
|
||||
* Handle the drawing related tasks of the text areas
|
||||
* @param ta pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW_MAIN: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_ta_design(lv_obj_t * ta, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_ta_design(lv_obj_t * ta, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
/*Return false if the object is not covers the mask_p area*/
|
||||
return ancestor_design(ta, mask, mode);
|
||||
return ancestor_design(ta, clip_area, mode);
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
/*Draw the object*/
|
||||
ancestor_design(ta, mask, mode);
|
||||
ancestor_design(ta, clip_area, mode);
|
||||
|
||||
} else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
ancestor_design(ta, mask, mode);
|
||||
ancestor_design(ta, clip_area, mode);
|
||||
}
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* An extended scrollable design of the page. Calls the normal design function and draws a cursor.
|
||||
* @param scrl pointer to the scrollable part of the Text area
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW_MAIN: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @return return true/false, depends on 'mode'
|
||||
*/
|
||||
static bool lv_ta_scrollable_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_ta_scrollable_design(lv_obj_t * scrl, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
/*Return false if the object is not covers the mask_p area*/
|
||||
return scrl_design(scrl, mask, mode);
|
||||
return scrl_design(scrl, clip_area, mode);
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
/*Draw the object*/
|
||||
scrl_design(scrl, mask, mode);
|
||||
scrl_design(scrl, clip_area, mode);
|
||||
} else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
scrl_design(scrl, mask, mode);
|
||||
scrl_design(scrl, clip_area, mode);
|
||||
|
||||
/*Draw the cursor*/
|
||||
lv_obj_t * ta = lv_obj_get_parent(scrl);
|
||||
@@ -1275,28 +1275,28 @@ static bool lv_ta_scrollable_design(lv_obj_t * scrl, const lv_area_t * mask, lv_
|
||||
lv_opa_t opa_scale = lv_obj_get_opa_scale(ta);
|
||||
|
||||
if(ext->cursor.type == LV_CURSOR_LINE) {
|
||||
lv_draw_rect(&cur_area, mask, &cur_style, opa_scale);
|
||||
lv_draw_rect(&cur_area, clip_area, &cur_style, opa_scale);
|
||||
} else if(ext->cursor.type == LV_CURSOR_BLOCK) {
|
||||
lv_draw_rect(&cur_area, mask, &cur_style, opa_scale);
|
||||
lv_draw_rect(&cur_area, clip_area, &cur_style, opa_scale);
|
||||
|
||||
char letter_buf[8] = {0};
|
||||
memcpy(letter_buf, &txt[ext->cursor.txt_byte_pos], lv_txt_encoded_size(&txt[ext->cursor.txt_byte_pos]));
|
||||
|
||||
cur_area.x1 += cur_style.body.padding.left;
|
||||
cur_area.y1 += cur_style.body.padding.top;
|
||||
lv_draw_label(&cur_area, mask, &cur_style, opa_scale, letter_buf, LV_TXT_FLAG_NONE, 0,
|
||||
lv_draw_label(&cur_area, clip_area, &cur_style, opa_scale, letter_buf, LV_TXT_FLAG_NONE, 0,
|
||||
LV_LABEL_TEXT_SEL_OFF, LV_LABEL_TEXT_SEL_OFF, NULL);
|
||||
|
||||
} else if(ext->cursor.type == LV_CURSOR_OUTLINE) {
|
||||
cur_style.body.opa = LV_OPA_TRANSP;
|
||||
if(cur_style.body.border.width == 0) cur_style.body.border.width = 1; /*Be sure the border will be drawn*/
|
||||
lv_draw_rect(&cur_area, mask, &cur_style, opa_scale);
|
||||
lv_draw_rect(&cur_area, clip_area, &cur_style, opa_scale);
|
||||
} else if(ext->cursor.type == LV_CURSOR_UNDERLINE) {
|
||||
lv_draw_rect(&cur_area, mask, &cur_style, opa_scale);
|
||||
lv_draw_rect(&cur_area, clip_area, &cur_style, opa_scale);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_design_res_t lv_table_design(lv_obj_t * table, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_table_signal(lv_obj_t * table, lv_signal_t sign, void * param);
|
||||
static lv_coord_t get_row_height(lv_obj_t * table, uint16_t row_id);
|
||||
static void refr_size(lv_obj_t * table);
|
||||
@@ -584,22 +584,22 @@ const lv_style_t * lv_table_get_style(const lv_obj_t * table, lv_table_style_t t
|
||||
/**
|
||||
* Handle the drawing related tasks of the tables
|
||||
* @param table pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
* @param return an element of `lv_design_res_t`
|
||||
*/
|
||||
static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_mode_t mode)
|
||||
static lv_design_res_t lv_table_design(lv_obj_t * table, const lv_area_t * clip_area, lv_design_mode_t mode)
|
||||
{
|
||||
/*Return false if the object is not covers the mask_p area*/
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
return false;
|
||||
return LV_DESIGN_RES_NOT_COVER;
|
||||
}
|
||||
/*Draw the object*/
|
||||
else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
ancestor_scrl_design(table, mask, mode);
|
||||
ancestor_scrl_design(table, clip_area, mode);
|
||||
|
||||
lv_table_ext_t * ext = lv_obj_get_ext_attr(table);
|
||||
const lv_style_t * bg_style = lv_obj_get_style(table);
|
||||
@@ -654,7 +654,7 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_
|
||||
}
|
||||
}
|
||||
|
||||
lv_draw_rect(&cell_area, mask, cell_style, opa_scale);
|
||||
lv_draw_rect(&cell_area, clip_area, cell_style, opa_scale);
|
||||
|
||||
if(ext->cell_data[cell]) {
|
||||
|
||||
@@ -688,7 +688,7 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_
|
||||
|
||||
lv_area_t label_mask;
|
||||
bool label_mask_ok;
|
||||
label_mask_ok = lv_area_intersect(&label_mask, mask, &cell_area);
|
||||
label_mask_ok = lv_area_intersect(&label_mask, clip_area, &cell_area);
|
||||
if(label_mask_ok) {
|
||||
lv_draw_label(&txt_area, &label_mask, cell_style, opa_scale, ext->cell_data[cell] + 1,
|
||||
txt_flags, NULL, -1, -1, NULL);
|
||||
@@ -708,7 +708,7 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_
|
||||
|
||||
p1.y = txt_area.y1 + txt_size.y + cell_style->text.line_space / 2;
|
||||
p2.y = txt_area.y1 + txt_size.y + cell_style->text.line_space / 2;
|
||||
lv_draw_line(&p1, &p2, mask, cell_style, opa_scale);
|
||||
lv_draw_line(&p1, &p2, clip_area, cell_style, opa_scale);
|
||||
|
||||
ext->cell_data[cell][i] = '\n';
|
||||
}
|
||||
@@ -724,7 +724,7 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_
|
||||
else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
}
|
||||
|
||||
return true;
|
||||
return LV_DESIGN_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user