mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
fix(comment): remove the space after /* and before */
This commit is contained in:
parent
a7084509b5
commit
9254a7ea14
@ -44,14 +44,14 @@ Before every function have a comment like this:
|
||||
lv_obj_t * lv_obj_get_scr(lv_obj_t * obj);
|
||||
```
|
||||
|
||||
Always use `/* Something */` format and NOT `//Something`
|
||||
Always use `/*Something*/` format and NOT `//Something`
|
||||
|
||||
Write readable code to avoid descriptive comments like:
|
||||
`x++; /* Add 1 to x */`.
|
||||
`x++; /*Add 1 to x*/`.
|
||||
The code should show clearly what you are doing.
|
||||
|
||||
You should write **why** have you done this:
|
||||
`x++; /*Because of closing '\0' of the string */`
|
||||
`x++; /*Because of closing '\0' of the string*/`
|
||||
|
||||
Short "code summaries" of a few lines are accepted. E.g. `/*Calculate the new coordinates*/`
|
||||
|
||||
@ -66,7 +66,7 @@ Here is example to show bracket placing and using of white spaces:
|
||||
* @param text '\0' terminated character string. NULL to refresh with the current text.
|
||||
*/
|
||||
void lv_label_set_text(lv_obj_t * label, const char * text)
|
||||
{ /* Main brackets of functions in new line*/
|
||||
{ /*Main brackets of functions in new line*/
|
||||
|
||||
if(label == NULL) return; /*No bracket only if the command is inline with the if statement*/
|
||||
|
||||
@ -74,7 +74,7 @@ void lv_label_set_text(lv_obj_t * label, const char * text)
|
||||
|
||||
lv_label_ext_t * ext = lv_obj_get_ext(label);
|
||||
|
||||
/*Comment before a section */
|
||||
/*Comment before a section*/
|
||||
if(text == ext->txt || text == NULL) { /*Bracket of statements start inline*/
|
||||
lv_label_refr_text(label);
|
||||
return;
|
||||
|
@ -1,25 +1,21 @@
|
||||
#include <lvgl.h>
|
||||
#include <TFT_eSPI.h>
|
||||
/* If you want to use the LVGL examples,
|
||||
make sure to install the lv_examples Arduino library
|
||||
and uncomment the following line.
|
||||
#include <lv_examples.h> */
|
||||
/*If you want to use the LVGL examples,
|
||||
make sure to install the lv_examples Arduino library
|
||||
and uncomment the following line.
|
||||
#include <lv_examples.h>*/
|
||||
|
||||
TFT_eSPI tft = TFT_eSPI(); /* TFT instance */
|
||||
TFT_eSPI tft = TFT_eSPI(); /*TFT instance*/
|
||||
|
||||
/* Change to your screen resolution */
|
||||
/*Change to your screen resolution*/
|
||||
static uint32_t screenWidth = 320;
|
||||
static uint32_t screenHeight = 240;
|
||||
|
||||
<<<<<<< HEAD
|
||||
static lv_disp_buf_t disp_buf;
|
||||
=======
|
||||
static lv_draw_buf_t draw_buf;
|
||||
>>>>>>> xiaoxiang781216-disp
|
||||
static lv_color_t buf[screenWidth * 10];
|
||||
|
||||
#if LV_USE_LOG != 0
|
||||
/* Serial debugging */
|
||||
/*Serial debugging*/
|
||||
void my_print(lv_log_level_t level, const char *file, uint32_t line, const char *fn_name, const char *dsc)
|
||||
{
|
||||
Serial.printf("%s(%s)@%d->%s\r\n", file, fn_name, line, dsc);
|
||||
@ -27,7 +23,7 @@ void my_print(lv_log_level_t level, const char *file, uint32_t line, const char
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Display flushing */
|
||||
/*Display flushing*/
|
||||
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
|
||||
{
|
||||
uint32_t w = (area->x2 - area->x1 + 1);
|
||||
@ -69,49 +65,49 @@ bool my_touchpad_read(lv_indev_drv_t *indev_driver, lv_indev_data_t *data)
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200); /* prepare for possible serial debug */
|
||||
Serial.begin(115200); /*prepare for possible serial debug*/
|
||||
|
||||
lv_init();
|
||||
|
||||
#if LV_USE_LOG != 0
|
||||
lv_log_register_print_cb(my_print); /* register print function for debugging */
|
||||
lv_log_register_print_cb(my_print); /*register print function for debugging*/
|
||||
#endif
|
||||
|
||||
tft.begin(); /* TFT init */
|
||||
tft.setRotation(1); /* Landscape orientation */
|
||||
tft.begin(); /*TFT init*/
|
||||
tft.setRotation(1); /*Landscape orientation*/
|
||||
|
||||
/* Set the touchscreen calibration data,
|
||||
the actual data for your display can be aquired using
|
||||
the Generic -> Touch_calibrate example from the TFT_eSPI library */
|
||||
/*Set the touchscreen calibration data,
|
||||
the actual data for your display can be aquired using
|
||||
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
|
||||
uint16_t calData[5] = {275, 3620, 264, 3532, 1};
|
||||
tft.setTouch(calData);
|
||||
|
||||
lv_draw_buf_init(&draw_buf, buf, NULL, screenWidth * 10);
|
||||
|
||||
/* Initialize the display */
|
||||
/*Initialize the display*/
|
||||
lv_disp_drv_t disp_drv;
|
||||
lv_disp_drv_init(&disp_drv);
|
||||
/* Change the following line to your display resolution */
|
||||
/*Change the following line to your display resolution*/
|
||||
disp_drv.hor_res = screenWidth;
|
||||
disp_drv.ver_res = screenHeight;
|
||||
disp_drv.flush_cb = my_disp_flush;
|
||||
disp_drv.draw_buf = &draw_buf;
|
||||
lv_disp_drv_register(&disp_drv);
|
||||
|
||||
/* Initialize the (dummy) input device driver */
|
||||
/*Initialize the (dummy) input device driver*/
|
||||
lv_indev_drv_t indev_drv;
|
||||
lv_indev_drv_init(&indev_drv);
|
||||
indev_drv.type = LV_INDEV_TYPE_POINTER;
|
||||
indev_drv.read_cb = my_touchpad_read;
|
||||
lv_indev_drv_register(&indev_drv);
|
||||
|
||||
/* Try an example from the lv_examples Arduino library
|
||||
make sure to include it as written above.
|
||||
lv_example_btn_1(); */
|
||||
/*Try an example from the lv_examples Arduino library
|
||||
make sure to include it as written above.
|
||||
lv_example_btn_1();*/
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
lv_timer_handler(); /* let the GUI do its work */
|
||||
lv_timer_handler(); /*let the GUI do its work*/
|
||||
delay(5);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ void lv_example_get_started_3(void);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EX_GET_STARTED_H*/
|
||||
|
@ -17,13 +17,13 @@ static void slider_event_cb(lv_obj_t * slider, lv_event_t event)
|
||||
*/
|
||||
void lv_example_get_started_3(void)
|
||||
{
|
||||
/* Create a slider in the center of the display */
|
||||
/*Create a slider in the center of the display*/
|
||||
lv_obj_t * slider = lv_slider_create(lv_scr_act(), NULL);
|
||||
lv_obj_set_width(slider, 200); /*Set the width*/
|
||||
lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0); /*Align to the center of the parent (screen)*/
|
||||
lv_obj_add_event_cb(slider, slider_event_cb, NULL); /*Assign an event function*/
|
||||
|
||||
/* Create a label below the slider */
|
||||
/*Create a label below the slider*/
|
||||
label = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(label, "0");
|
||||
lv_obj_align(label, slider, LV_ALIGN_OUT_TOP_MID, 0, -15); /*Align below the slider*/
|
||||
|
@ -37,7 +37,7 @@ void lv_example_flex_6(void);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EXAMPLE_FLEX_H*/
|
||||
|
@ -37,7 +37,7 @@ void lv_example_grid_6(void);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EXAMPLE_GRID_H*/
|
||||
|
@ -28,8 +28,8 @@ void lv_example_grid_1(void)
|
||||
uint8_t row = i / 3;
|
||||
|
||||
obj = lv_obj_create(cont, NULL);
|
||||
/* Stretch the cell horizontally and vertically too
|
||||
* Set span to 1 to make the cell 1 column/row sized */
|
||||
/*Stretch the cell horizontally and vertically too
|
||||
*Set span to 1 to make the cell 1 column/row sized*/
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1,
|
||||
LV_GRID_STRETCH, row, 1);
|
||||
|
||||
|
@ -23,7 +23,7 @@ void lv_example_grid_2(void)
|
||||
lv_obj_t * label;
|
||||
lv_obj_t * obj;
|
||||
|
||||
/*Cell to 0;0 and align to to the start (left/top) horizontally and vertically too */
|
||||
/*Cell to 0;0 and align to to the start (left/top) horizontally and vertically too*/
|
||||
obj = lv_obj_create(cont, NULL);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_START, 0, 1,
|
||||
@ -31,7 +31,7 @@ void lv_example_grid_2(void)
|
||||
label = lv_label_create(obj, NULL);
|
||||
lv_label_set_text(label, "c0, r0");
|
||||
|
||||
/*Cell to 1;0 and align to to the start (left) horizontally and center vertically too */
|
||||
/*Cell to 1;0 and align to to the start (left) horizontally and center vertically too*/
|
||||
obj = lv_obj_create(cont, NULL);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_START, 1, 1,
|
||||
@ -39,7 +39,7 @@ void lv_example_grid_2(void)
|
||||
label = lv_label_create(obj, NULL);
|
||||
lv_label_set_text(label, "c1, r0");
|
||||
|
||||
/*Cell to 2;0 and align to to the start (left) horizontally and end (bottom) vertically too */
|
||||
/*Cell to 2;0 and align to to the start (left) horizontally and end (bottom) vertically too*/
|
||||
obj = lv_obj_create(cont, NULL);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_START, 2, 1,
|
||||
@ -47,7 +47,7 @@ void lv_example_grid_2(void)
|
||||
label = lv_label_create(obj, NULL);
|
||||
lv_label_set_text(label, "c2, r0");
|
||||
|
||||
/*Cell to 1;1 but 2 column wide (span = 2).Set width and height to stretched. */
|
||||
/*Cell to 1;1 but 2 column wide (span = 2).Set width and height to stretched.*/
|
||||
obj = lv_obj_create(cont, NULL);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, 1, 2,
|
||||
@ -55,7 +55,7 @@ void lv_example_grid_2(void)
|
||||
label = lv_label_create(obj, NULL);
|
||||
lv_label_set_text(label, "c1-2, r1");
|
||||
|
||||
/*Cell to 0;1 but 2 rows tall (span = 2).Set width and height to stretched. */
|
||||
/*Cell to 0;1 but 2 rows tall (span = 2).Set width and height to stretched.*/
|
||||
obj = lv_obj_create(cont, NULL);
|
||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, 0, 1,
|
||||
|
@ -6,14 +6,14 @@
|
||||
*/
|
||||
void lv_example_grid_3(void)
|
||||
{
|
||||
/* Column 1: fix width 60 px
|
||||
* Column 2: 1 unit from the remaining free space
|
||||
* Column 3: 2 unit from the remaining free space */
|
||||
/*Column 1: fix width 60 px
|
||||
*Column 2: 1 unit from the remaining free space
|
||||
*Column 3: 2 unit from the remaining free space*/
|
||||
static lv_coord_t col_dsc[3] = {60, LV_GRID_FR(1), LV_GRID_FR(2)};
|
||||
|
||||
/* Row 1: fix width 60 px
|
||||
* Row 2: 1 unit from the remaining free space
|
||||
* Row 3: fix width 60 px */
|
||||
/*Row 1: fix width 60 px
|
||||
*Row 2: 1 unit from the remaining free space
|
||||
*Row 3: fix width 60 px*/
|
||||
static lv_coord_t row_dsc[3] = {40, LV_GRID_FR(1), 40};
|
||||
|
||||
static lv_grid_t grid;
|
||||
@ -34,8 +34,8 @@ void lv_example_grid_3(void)
|
||||
uint8_t row = i / 3;
|
||||
|
||||
obj = lv_obj_create(cont, NULL);
|
||||
/* Stretch the cell horizontally and vertically too
|
||||
* Set span to 1 to make the cell 1 column/row sized */
|
||||
/*Stretch the cell horizontally and vertically too
|
||||
*Set span to 1 to make the cell 1 column/row sized*/
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1,
|
||||
LV_GRID_STRETCH, row, 1);
|
||||
|
||||
|
@ -30,8 +30,8 @@ void lv_example_grid_4(void)
|
||||
uint8_t row = i / 3;
|
||||
|
||||
obj = lv_obj_create(cont, NULL);
|
||||
/* Stretch the cell horizontally and vertically too
|
||||
* Set span to 1 to make the cell 1 column/row sized */
|
||||
/*Stretch the cell horizontally and vertically too
|
||||
*Set span to 1 to make the cell 1 column/row sized*/
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1,
|
||||
LV_GRID_STRETCH, row, 1);
|
||||
|
||||
|
@ -29,8 +29,8 @@ void lv_example_grid_6(void)
|
||||
uint8_t row = i / 3;
|
||||
|
||||
obj = lv_obj_create(cont, NULL);
|
||||
/* Stretch the cell horizontally and vertically too
|
||||
* Set span to 1 to make the cell 1 column/row sized */
|
||||
/*Stretch the cell horizontally and vertically too
|
||||
*Set span to 1 to make the cell 1 column/row sized*/
|
||||
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1,
|
||||
LV_GRID_STRETCH, row, 1);
|
||||
|
||||
|
@ -33,7 +33,7 @@ extern "C" {
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EXAMPLE_LAYOUT_H*/
|
||||
|
@ -36,7 +36,7 @@ extern "C" {
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EXAMPLES_H*/
|
||||
|
@ -54,7 +54,8 @@ void lv_port_disp_init(void)
|
||||
* Create a buffer for drawing
|
||||
*----------------------------*/
|
||||
|
||||
/* LVGL requires a buffer where it internally draws the widgets.
|
||||
/**
|
||||
* LVGL requires a buffer where it internally draws the widgets.
|
||||
* Later this buffer will passed your display drivers `flush_cb` to copy its content to your display.
|
||||
* The buffer has to be greater than 1 display row
|
||||
*
|
||||
@ -72,7 +73,7 @@ void lv_port_disp_init(void)
|
||||
* Similar to 2) but the buffer have to be screen sized. When LVGL is ready it will give the
|
||||
* whole frame to display. This way you only need to change the frame buffer's address instead of
|
||||
* copying the pixels.
|
||||
* */
|
||||
*/
|
||||
|
||||
/* Example for 1) */
|
||||
static lv_draw_buf_t draw_buf_dsc_1;
|
||||
@ -123,15 +124,15 @@ void lv_port_disp_init(void)
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/* Initialize your display and the required peripherals. */
|
||||
/*Initialize your display and the required peripherals.*/
|
||||
static void disp_init(void)
|
||||
{
|
||||
/*You code here*/
|
||||
}
|
||||
|
||||
/* Flush the content of the internal buffer the specific area on the display
|
||||
* You can use DMA or any hardware acceleration to do this operation in the background but
|
||||
* 'lv_disp_flush_ready()' has to be called when finished. */
|
||||
/*Flush the content of the internal buffer the specific area on the display
|
||||
*You can use DMA or any hardware acceleration to do this operation in the background but
|
||||
*'lv_disp_flush_ready()' has to be called when finished.*/
|
||||
static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
|
||||
{
|
||||
/*The most simple case (but also the slowest) to put all pixels to the screen one-by-one*/
|
||||
@ -140,21 +141,21 @@ static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_colo
|
||||
int32_t y;
|
||||
for(y = area->y1; y <= area->y2; y++) {
|
||||
for(x = area->x1; x <= area->x2; x++) {
|
||||
/* Put a pixel to the display. For example: */
|
||||
/* put_px(x, y, *color_p)*/
|
||||
/*Put a pixel to the display. For example:*/
|
||||
/*put_px(x, y, *color_p)*/
|
||||
color_p++;
|
||||
}
|
||||
}
|
||||
|
||||
/* IMPORTANT!!!
|
||||
* Inform the graphics library that you are ready with the flushing*/
|
||||
/*IMPORTANT!!!
|
||||
*Inform the graphics library that you are ready with the flushing*/
|
||||
lv_disp_flush_ready(disp_drv);
|
||||
}
|
||||
|
||||
/*OPTIONAL: GPU INTERFACE*/
|
||||
#if LV_USE_GPU
|
||||
|
||||
/* If your MCU has hardware accelerator (GPU) then you can use it to fill a memory with a color*/
|
||||
/*If your MCU has hardware accelerator (GPU) then you can use it to fill a memory with a color*/
|
||||
static void gpu_fill(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width,
|
||||
const lv_area_t * fill_area, lv_color_t color)
|
||||
{
|
||||
@ -172,8 +173,8 @@ static void gpu_fill(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t
|
||||
|
||||
#endif /*LV_USE_GPU*/
|
||||
|
||||
#else /* Enable this file at the top */
|
||||
#else /*Enable this file at the top*/
|
||||
|
||||
/* This dummy typedef exists purely to silence -Wpedantic. */
|
||||
/*This dummy typedef exists purely to silence -Wpedantic.*/
|
||||
typedef int keep_pedantic_happy;
|
||||
#endif
|
||||
|
@ -35,7 +35,7 @@ extern "C" {
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_PORT_DISP_TEMPL_H*/
|
||||
|
@ -19,17 +19,17 @@
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/* Create a type to store the required data about your file.
|
||||
* If you are using a File System library
|
||||
* it already should have a File type.
|
||||
* For example FatFS has `FIL`. In this case use `typedef FIL file_t`*/
|
||||
/*Create a type to store the required data about your file.
|
||||
*If you are using a File System library
|
||||
*it already should have a File type.
|
||||
*For example FatFS has `FIL`. In this case use `typedef FIL file_t`*/
|
||||
typedef struct {
|
||||
/*Add the data you need to store about a file*/
|
||||
uint32_t dummy1;
|
||||
uint32_t dummy2;
|
||||
}file_t;
|
||||
|
||||
/*Similarly to `file_t` create a type for directory reading too */
|
||||
/*Similarly to `file_t` create a type for directory reading too*/
|
||||
typedef struct {
|
||||
/*Add the data you need to store about directory reading*/
|
||||
uint32_t dummy1;
|
||||
@ -83,7 +83,7 @@ void lv_port_fs_init(void)
|
||||
* Register the file system interface in LVGL
|
||||
*--------------------------------------------------*/
|
||||
|
||||
/* Add a simple drive to open images */
|
||||
/*Add a simple drive to open images*/
|
||||
lv_fs_drv_t fs_drv;
|
||||
lv_fs_drv_init(&fs_drv);
|
||||
|
||||
@ -114,7 +114,7 @@ void lv_port_fs_init(void)
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/* Initialize your Storage device and File system. */
|
||||
/*Initialize your Storage device and File system.*/
|
||||
static void fs_init(void)
|
||||
{
|
||||
/*E.g. for FatFS initialize the SD card and FatFS itself*/
|
||||
@ -138,19 +138,19 @@ static lv_fs_res_t fs_open (lv_fs_drv_t * drv, void * file_p, const char * path,
|
||||
{
|
||||
/*Open a file for write*/
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
}
|
||||
else if(mode == LV_FS_MODE_RD)
|
||||
{
|
||||
/*Open a file for read*/
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
}
|
||||
else if(mode == (LV_FS_MODE_WR | LV_FS_MODE_RD))
|
||||
{
|
||||
/*Open a file for read and write*/
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -167,7 +167,7 @@ static lv_fs_res_t fs_close (lv_fs_drv_t * drv, void * file_p)
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -186,7 +186,7 @@ static lv_fs_res_t fs_read (lv_fs_drv_t * drv, void * file_p, void * buf, uint32
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -204,7 +204,7 @@ static lv_fs_res_t fs_write(lv_fs_drv_t * drv, void * file_p, const void * buf,
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -221,7 +221,7 @@ static lv_fs_res_t fs_seek (lv_fs_drv_t * drv, void * file_p, uint32_t pos)
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -237,7 +237,7 @@ static lv_fs_res_t fs_size (lv_fs_drv_t * drv, void * file_p, uint32_t * size_p)
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -253,7 +253,7 @@ static lv_fs_res_t fs_tell (lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p)
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -268,7 +268,7 @@ static lv_fs_res_t fs_remove (lv_fs_drv_t * drv, const char *path)
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -284,7 +284,7 @@ static lv_fs_res_t fs_trunc (lv_fs_drv_t * drv, void * file_p)
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -300,7 +300,7 @@ static lv_fs_res_t fs_rename (lv_fs_drv_t * drv, const char * oldname, const cha
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -317,7 +317,7 @@ static lv_fs_res_t fs_free (lv_fs_drv_t * drv, uint32_t * total_p, uint32_t * fr
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -333,7 +333,7 @@ static lv_fs_res_t fs_dir_open (lv_fs_drv_t * drv, void * rddir_p, const char *p
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -350,7 +350,7 @@ static lv_fs_res_t fs_dir_read (lv_fs_drv_t * drv, void * rddir_p, char *fn)
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -365,13 +365,13 @@ static lv_fs_res_t fs_dir_close (lv_fs_drv_t * drv, void * rddir_p)
|
||||
{
|
||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||
|
||||
/* Add your code here*/
|
||||
/*Add your code here*/
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#else /* Enable this file at the top */
|
||||
#else /*Enable this file at the top*/
|
||||
|
||||
/* This dummy typedef exists purely to silence -Wpedantic. */
|
||||
/*This dummy typedef exists purely to silence -Wpedantic.*/
|
||||
typedef int keep_pedantic_happy;
|
||||
#endif
|
||||
|
@ -35,7 +35,7 @@ extern "C" {
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_PORT_FS_TEMPL_H*/
|
||||
|
@ -68,7 +68,8 @@ static lv_indev_state_t encoder_state;
|
||||
|
||||
void lv_port_indev_init(void)
|
||||
{
|
||||
/* Here you will find example implementation of input devices supported by LittelvGL:
|
||||
/**
|
||||
* Here you will find example implementation of input devices supported by LittelvGL:
|
||||
* - Touchpad
|
||||
* - Mouse (with cursor support)
|
||||
* - Keypad (supports GUI usage only with key)
|
||||
@ -125,10 +126,10 @@ void lv_port_indev_init(void)
|
||||
indev_drv.read_cb = keypad_read;
|
||||
indev_keypad = lv_indev_drv_register(&indev_drv);
|
||||
|
||||
/* Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
|
||||
* add objects to the group with `lv_group_add_obj(group, obj)`
|
||||
* and assign this input device to group to navigate in it:
|
||||
* `lv_indev_set_group(indev_keypad, group);` */
|
||||
/*Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
|
||||
*add objects to the group with `lv_group_add_obj(group, obj)`
|
||||
*and assign this input device to group to navigate in it:
|
||||
*`lv_indev_set_group(indev_keypad, group);`*/
|
||||
|
||||
/*------------------
|
||||
* Encoder
|
||||
@ -143,10 +144,10 @@ void lv_port_indev_init(void)
|
||||
indev_drv.read_cb = encoder_read;
|
||||
indev_encoder = lv_indev_drv_register(&indev_drv);
|
||||
|
||||
/* Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
|
||||
* add objects to the group with `lv_group_add_obj(group, obj)`
|
||||
* and assign this input device to group to navigate in it:
|
||||
* `lv_indev_set_group(indev_encoder, group);` */
|
||||
/*Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
|
||||
*add objects to the group with `lv_group_add_obj(group, obj)`
|
||||
*and assign this input device to group to navigate in it:
|
||||
*`lv_indev_set_group(indev_encoder, group);`*/
|
||||
|
||||
/*------------------
|
||||
* Button
|
||||
@ -183,7 +184,7 @@ static void touchpad_init(void)
|
||||
/*Your code comes here*/
|
||||
}
|
||||
|
||||
/* Will be called by the library to read the touchpad */
|
||||
/*Will be called by the library to read the touchpad*/
|
||||
static bool touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
||||
{
|
||||
static lv_coord_t last_x = 0;
|
||||
@ -226,13 +227,13 @@ static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y)
|
||||
* Mouse
|
||||
* -----------------*/
|
||||
|
||||
/* Initialize your mouse */
|
||||
/*Initialize your mouse*/
|
||||
static void mouse_init(void)
|
||||
{
|
||||
/*Your code comes here*/
|
||||
}
|
||||
|
||||
/* Will be called by the library to read the mouse */
|
||||
/*Will be called by the library to read the mouse*/
|
||||
static bool mouse_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
||||
{
|
||||
/*Get the current x and y coordinates*/
|
||||
@ -270,13 +271,13 @@ static void mouse_get_xy(lv_coord_t * x, lv_coord_t * y)
|
||||
* Keypad
|
||||
* -----------------*/
|
||||
|
||||
/* Initialize your keypad */
|
||||
/*Initialize your keypad*/
|
||||
static void keypad_init(void)
|
||||
{
|
||||
/*Your code comes here*/
|
||||
}
|
||||
|
||||
/* Will be called by the library to read the mouse */
|
||||
/*Will be called by the library to read the mouse*/
|
||||
static bool keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
||||
{
|
||||
static uint32_t last_key = 0;
|
||||
@ -331,13 +332,13 @@ static uint32_t keypad_get_key(void)
|
||||
* Encoder
|
||||
* -----------------*/
|
||||
|
||||
/* Initialize your keypad */
|
||||
/*Initialize your keypad*/
|
||||
static void encoder_init(void)
|
||||
{
|
||||
/*Your code comes here*/
|
||||
}
|
||||
|
||||
/* Will be called by the library to read the encoder */
|
||||
/*Will be called by the library to read the encoder*/
|
||||
static bool encoder_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
||||
{
|
||||
|
||||
@ -361,13 +362,13 @@ static void encoder_handler(void)
|
||||
* Button
|
||||
* -----------------*/
|
||||
|
||||
/* Initialize your buttons */
|
||||
/*Initialize your buttons*/
|
||||
static void button_init(void)
|
||||
{
|
||||
/*Your code comes here*/
|
||||
}
|
||||
|
||||
/* Will be called by the library to read the button */
|
||||
/*Will be called by the library to read the button*/
|
||||
static bool button_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
||||
{
|
||||
|
||||
@ -416,8 +417,8 @@ static bool button_is_pressed(uint8_t id)
|
||||
return false;
|
||||
}
|
||||
|
||||
#else /* Enable this file at the top */
|
||||
#else /*Enable this file at the top*/
|
||||
|
||||
/* This dummy typedef exists purely to silence -Wpedantic. */
|
||||
/*This dummy typedef exists purely to silence -Wpedantic.*/
|
||||
typedef int keep_pedantic_happy;
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ extern "C" {
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_PORT_INDEV_TEMPL_H*/
|
||||
|
@ -34,7 +34,7 @@ void lv_example_scroll_3(void);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EXAMPLE_SCROLL_H*/
|
||||
|
@ -42,7 +42,7 @@ void lv_example_style_11(void);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EXAMPLE_STYLE_H*/
|
||||
|
@ -31,8 +31,8 @@ void lv_example_arc_2(void)
|
||||
lv_arc_set_angles(arc, 270, 270);
|
||||
lv_obj_align(arc, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
/* Create an `lv_timer` to update the arc.
|
||||
* Store the `arc` in the user data*/
|
||||
/*Create an `lv_timer` to update the arc.
|
||||
*Store the `arc` in the user data*/
|
||||
lv_timer_create(arc_loader, 20, arc);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ static void event_cb(lv_obj_t * obj, lv_event_t e)
|
||||
txt_area.x1 = txt_area.x2 - txt_size.x + 1;
|
||||
dsc.color = lv_color_white();
|
||||
}
|
||||
/*If the indicator is still short put the text out of it on the right */
|
||||
/*If the indicator is still short put the text out of it on the right*/
|
||||
else {
|
||||
txt_area.x1 = bar->indic_area.x2 + 5;
|
||||
txt_area.x2 = txt_area.x1 + txt_size.x - 1;
|
||||
|
@ -22,13 +22,13 @@ void lv_example_btn_3(void)
|
||||
lv_anim_path_set_cb(&path_overshoot, lv_anim_path_overshoot);
|
||||
|
||||
|
||||
/* Transition descriptor when going back to the default state.
|
||||
* Add some delay to be sure the press transition is visible even if the press was very short*/
|
||||
/*Transition descriptor when going back to the default state.
|
||||
*Add some delay to be sure the press transition is visible even if the press was very short*/
|
||||
static lv_style_transition_dsc_t transition_dsc_def;
|
||||
lv_style_transition_dsc_init(&transition_dsc_def, props, &path_overshoot, 250, 100);
|
||||
|
||||
/* Transition descriptor when going to pressed state.
|
||||
* No delay, go to presses state immediately*/
|
||||
/*Transition descriptor when going to pressed state.
|
||||
*No delay, go to presses state immediately*/
|
||||
static lv_style_transition_dsc_t transition_dsc_pr;
|
||||
lv_style_transition_dsc_init(&transition_dsc_pr, props, &path_ease_in_out, 250, 0);
|
||||
|
||||
|
@ -7,7 +7,7 @@ static void event_cb(lv_obj_t * obj, lv_event_t e)
|
||||
if(e == LV_EVENT_DRAW_PART_BEGIN) {
|
||||
lv_obj_draw_dsc_t * dsc = lv_event_get_param();
|
||||
|
||||
/*Change the draw descriptor the 2nd button */
|
||||
/*Change the draw descriptor the 2nd button*/
|
||||
if(dsc->id == 1) {
|
||||
dsc->rect_dsc->radius = 0;
|
||||
if(lv_btnmatrix_get_selected_btn(obj) == dsc->id) dsc->rect_dsc->bg_color = lv_color_blue_darken_3();
|
||||
@ -18,7 +18,7 @@ static void event_cb(lv_obj_t * obj, lv_event_t e)
|
||||
dsc->rect_dsc->shadow_ofs_y = 3;
|
||||
dsc->label_dsc->color = lv_color_white();
|
||||
}
|
||||
/*Change the draw descriptor the 3rd button */
|
||||
/*Change the draw descriptor the 3rd button*/
|
||||
else if(dsc->id == 2) {
|
||||
dsc->rect_dsc->radius = LV_RADIUS_CIRCLE;
|
||||
if(lv_btnmatrix_get_selected_btn(obj) == dsc->id) dsc->rect_dsc->bg_color = lv_color_red_darken_3();
|
||||
|
@ -36,8 +36,8 @@ void lv_example_canvas_1(void)
|
||||
|
||||
lv_canvas_draw_text(canvas, 40, 20, 100, &label_dsc, "Some text on text canvas");
|
||||
|
||||
/* Test the rotation. It requires an other buffer where the orignal image is stored.
|
||||
* So copy the current image to buffer and rotate it to the canvas */
|
||||
/*Test the rotation. It requires an other buffer where the orignal image is stored.
|
||||
*So copy the current image to buffer and rotate it to the canvas*/
|
||||
static lv_color_t cbuf_tmp[CANVAS_WIDTH * CANVAS_HEIGHT];
|
||||
memcpy(cbuf_tmp, cbuf, sizeof(cbuf_tmp));
|
||||
lv_img_dsc_t img;
|
||||
|
@ -7,7 +7,7 @@ static lv_chart_series_t * ser2;
|
||||
|
||||
static void event_cb(lv_obj_t * obj, lv_event_t e)
|
||||
{
|
||||
/*Add the faded area before the lines are drawn */
|
||||
/*Add the faded area before the lines are drawn*/
|
||||
if(e == LV_EVENT_DRAW_PART_BEGIN) {
|
||||
lv_obj_draw_dsc_t * dsc = lv_event_get_param();
|
||||
if(dsc->part != LV_PART_ITEMS) return;
|
||||
|
@ -33,7 +33,7 @@ void lv_example_dropdown_3(void)
|
||||
lv_dropdown_set_symbol(dropdown, &img_caret_down);
|
||||
lv_obj_set_style_transform_angle(dropdown, LV_PART_MAIN, LV_STATE_CHECKED, 1800);
|
||||
|
||||
/* In a menu we don't need to show the last clicked item*/
|
||||
/*In a menu we don't need to show the last clicked item*/
|
||||
lv_dropdown_set_selected_highlight(dropdown, false);
|
||||
|
||||
lv_obj_add_event_cb(dropdown, event_cb, NULL);
|
||||
|
@ -29,7 +29,7 @@ void lv_example_img_2(void)
|
||||
lv_obj_align(blue_slider, green_slider, LV_ALIGN_OUT_RIGHT_MID, 25, 0);
|
||||
lv_obj_align(intense_slider, blue_slider, LV_ALIGN_OUT_RIGHT_MID, 25, 0);
|
||||
|
||||
/* Now create the actual image */
|
||||
/*Now create the actual image*/
|
||||
LV_IMG_DECLARE(img_cogwheel_argb)
|
||||
img1 = lv_img_create(lv_scr_act(), NULL);
|
||||
lv_img_set_src(img1, &img_cogwheel_argb);
|
||||
@ -43,7 +43,7 @@ static void slider_event_cb(lv_obj_t * slider, lv_event_t event)
|
||||
LV_UNUSED(slider);
|
||||
|
||||
if(event == LV_EVENT_VALUE_CHANGED) {
|
||||
/* Recolor the image based on the sliders' values */
|
||||
/*Recolor the image based on the sliders' values*/
|
||||
lv_color_t color = lv_color_make(lv_slider_get_value(red_slider), lv_slider_get_value(green_slider), lv_slider_get_value(blue_slider));
|
||||
lv_opa_t intense = lv_slider_get_value(intense_slider);
|
||||
lv_obj_set_style_img_recolor_opa(img1, LV_PART_MAIN, LV_STATE_DEFAULT, intense);
|
||||
|
@ -19,7 +19,7 @@ void lv_example_img_3(void)
|
||||
{
|
||||
LV_IMG_DECLARE(img_cogwheel_argb);
|
||||
|
||||
/* Now create the actual image */
|
||||
/*Now create the actual image*/
|
||||
lv_obj_t * img = lv_img_create(lv_scr_act(), NULL);
|
||||
lv_img_set_src(img, &img_cogwheel_argb);
|
||||
lv_obj_align(img, NULL, LV_ALIGN_CENTER, 50, 50);
|
||||
|
@ -7,7 +7,7 @@ void lv_example_imgbtn_1(void)
|
||||
LV_IMG_DECLARE(imgbtn_right);
|
||||
LV_IMG_DECLARE(imgbtn_mid);
|
||||
|
||||
/* Create a transition animation on width transformation and recolor.*/
|
||||
/*Create a transition animation on width transformation and recolor.*/
|
||||
static lv_style_prop_t tr_prop[] = {LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_IMG_RECOLOR_OPA, 0};
|
||||
static lv_style_transition_dsc_t tr;
|
||||
lv_style_transition_dsc_init(&tr, tr_prop, &lv_anim_path_def, 200, 0);
|
||||
|
@ -6,17 +6,17 @@
|
||||
*/
|
||||
void lv_example_label_2(void)
|
||||
{
|
||||
/* Create a style for the shadow*/
|
||||
/*Create a style for the shadow*/
|
||||
static lv_style_t style_shadow;
|
||||
lv_style_init(&style_shadow);
|
||||
lv_style_set_text_opa(&style_shadow, LV_OPA_30);
|
||||
lv_style_set_text_color(&style_shadow, lv_color_black());
|
||||
|
||||
/*Create a label for the shadow first (it's in the background) */
|
||||
/*Create a label for the shadow first (it's in the background)*/
|
||||
lv_obj_t * shadow_label = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_obj_add_style(shadow_label, LV_PART_MAIN, LV_STATE_DEFAULT, &style_shadow);
|
||||
|
||||
/* Create the main label */
|
||||
/*Create the main label*/
|
||||
lv_obj_t * main_label = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(main_label, "A simple method to create\n"
|
||||
"shadows on a text.\n"
|
||||
@ -26,10 +26,10 @@ void lv_example_label_2(void)
|
||||
/*Set the same text for the shadow label*/
|
||||
lv_label_set_text(shadow_label, lv_label_get_text(main_label));
|
||||
|
||||
/* Position the main label */
|
||||
/*Position the main label*/
|
||||
lv_obj_align(main_label, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
/* Shift the second label down and to the right by 2 pixel */
|
||||
/*Shift the second label down and to the right by 2 pixel*/
|
||||
lv_obj_align(shadow_label, main_label, LV_ALIGN_IN_TOP_LEFT, 2, 2);
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ void lv_example_win_1(void);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EX_WIDGETS_H*/
|
||||
|
@ -23,7 +23,7 @@ void lv_example_meter_1(void)
|
||||
|
||||
lv_meter_indicator_t * indic;
|
||||
|
||||
/*Add a blue arc to the start */
|
||||
/*Add a blue arc to the start*/
|
||||
indic = lv_meter_add_arc(meter, scale, 3, lv_color_blue(), 0);
|
||||
lv_meter_set_indicator_start_value(meter, indic, 0);
|
||||
lv_meter_set_indicator_end_value(meter, indic, 20);
|
||||
@ -33,7 +33,7 @@ void lv_example_meter_1(void)
|
||||
lv_meter_set_indicator_start_value(meter, indic, 0);
|
||||
lv_meter_set_indicator_end_value(meter, indic, 20);
|
||||
|
||||
/*Add a red arc to the end */
|
||||
/*Add a red arc to the end*/
|
||||
indic = lv_meter_add_arc(meter, scale, 3, lv_color_red(), 0);
|
||||
lv_meter_set_indicator_start_value(meter, indic, 80);
|
||||
lv_meter_set_indicator_end_value(meter, indic, 100);
|
||||
|
@ -26,7 +26,7 @@ void lv_example_meter_2(void)
|
||||
lv_meter_set_scale_major_ticks(meter, scale, 1, 2, 30, lv_color_hex3(0xeee), 10);
|
||||
lv_meter_set_scale_range(meter, scale, 0, 100, 270, 90);
|
||||
|
||||
/*Add a three arc indicator */
|
||||
/*Add a three arc indicator*/
|
||||
lv_meter_indicator_t * indic1 = lv_meter_add_arc(meter, scale, 10, lv_color_red(), 0);
|
||||
lv_meter_indicator_t * indic2 = lv_meter_add_arc(meter, scale, 10, lv_color_green(), -10);
|
||||
lv_meter_indicator_t * indic3 = lv_meter_add_arc(meter, scale, 10, lv_color_blue(), -20);
|
||||
|
@ -31,7 +31,7 @@ void lv_example_meter_3(void)
|
||||
|
||||
LV_IMG_DECLARE(img_hand)
|
||||
|
||||
/*Add a the hands from images */
|
||||
/*Add a the hands from images*/
|
||||
lv_meter_indicator_t * indic_min = lv_meter_add_needle_img(meter, scale_min, &img_hand, 5, 5);
|
||||
lv_meter_indicator_t * indic_hour = lv_meter_add_needle_img(meter, scale_min, &img_hand, 5, 5);
|
||||
|
||||
|
@ -18,7 +18,7 @@ void lv_example_meter_4(void)
|
||||
lv_meter_set_scale_ticks(meter, scale, 0, 0, 0, lv_color_black());
|
||||
lv_meter_set_scale_range(meter, scale, 0, 100, 360, 0);
|
||||
|
||||
/*Add a three arc indicator */
|
||||
/*Add a three arc indicator*/
|
||||
lv_coord_t indic_w = lv_obj_get_width(meter) / 2;
|
||||
lv_meter_indicator_t * indic1 = lv_meter_add_arc(meter, scale, indic_w, lv_color_orange(), 0);
|
||||
lv_meter_set_indicator_start_value(meter, indic1, 0);
|
||||
|
@ -9,12 +9,12 @@ static lv_obj_t * slider_label;
|
||||
*/
|
||||
void lv_example_slider_1(void)
|
||||
{
|
||||
/* Create a slider in the center of the display */
|
||||
/*Create a slider in the center of the display*/
|
||||
lv_obj_t * slider = lv_slider_create(lv_scr_act(), NULL);
|
||||
lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_add_event_cb(slider, slider_event_cb, NULL);
|
||||
|
||||
/* Create a label below the slider */
|
||||
/*Create a label below the slider*/
|
||||
slider_label = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(slider_label, "0%");
|
||||
|
||||
|
@ -19,7 +19,7 @@ void lv_example_slider_2(void)
|
||||
lv_style_set_content_opa(&style_pr, LV_OPA_COVER);
|
||||
lv_style_set_content_ofs_y(&style_pr, -15);
|
||||
|
||||
/* Create a slider in the center of the display */
|
||||
/*Create a slider in the center of the display*/
|
||||
lv_obj_t * slider;
|
||||
slider = lv_slider_create(lv_scr_act(), NULL);
|
||||
lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
|
@ -9,7 +9,7 @@ static void slider_event_cb(lv_obj_t * slider, lv_event_t event);
|
||||
*/
|
||||
void lv_example_slider_3(void)
|
||||
{
|
||||
/* Create a slider in the center of the display */
|
||||
/*Create a slider in the center of the display*/
|
||||
lv_obj_t * slider;
|
||||
slider = lv_slider_create(lv_scr_act(), NULL);
|
||||
lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
|
@ -64,7 +64,7 @@ void lv_example_table_2(void)
|
||||
lv_obj_set_size(table, 150, 200);
|
||||
|
||||
lv_table_set_col_width(table, 0, 150);
|
||||
lv_table_set_row_cnt(table, ITEM_CNT); /*Not required but avoids a lot of memory reallocation lv_table_set_set_value */
|
||||
lv_table_set_row_cnt(table, ITEM_CNT); /*Not required but avoids a lot of memory reallocation lv_table_set_set_value*/
|
||||
lv_table_set_col_cnt(table, 1);
|
||||
|
||||
/*Don't make the cell pressed, we will draw something different in the event*/
|
||||
|
@ -7,7 +7,7 @@ static lv_obj_t * kb;
|
||||
|
||||
void lv_example_textarea_2(void)
|
||||
{
|
||||
/* Create the password box */
|
||||
/*Create the password box*/
|
||||
lv_obj_t * pwd_ta = lv_textarea_create(lv_scr_act(), NULL);
|
||||
lv_textarea_set_text(pwd_ta, "");
|
||||
lv_textarea_set_password_mode(pwd_ta, true);
|
||||
@ -16,33 +16,33 @@ void lv_example_textarea_2(void)
|
||||
lv_obj_set_pos(pwd_ta, 5, 20);
|
||||
lv_obj_add_event_cb(pwd_ta, ta_event_cb, NULL);
|
||||
|
||||
/* Create a label and position it above the text box */
|
||||
/*Create a label and position it above the text box*/
|
||||
lv_obj_t * pwd_label = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(pwd_label, "Password:");
|
||||
lv_obj_align(pwd_label, pwd_ta, LV_ALIGN_OUT_TOP_LEFT, 0, 0);
|
||||
|
||||
/* Create the one-line mode text area */
|
||||
/*Create the one-line mode text area*/
|
||||
lv_obj_t * oneline_ta = lv_textarea_create(lv_scr_act(), pwd_ta);
|
||||
lv_textarea_set_password_mode(oneline_ta, false);
|
||||
lv_obj_align(oneline_ta, NULL, LV_ALIGN_IN_TOP_RIGHT, -5, 20);
|
||||
|
||||
|
||||
/* Create a label and position it above the text box */
|
||||
/*Create a label and position it above the text box*/
|
||||
lv_obj_t * oneline_label = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(oneline_label, "Text:");
|
||||
lv_obj_align(oneline_label, oneline_ta, LV_ALIGN_OUT_TOP_LEFT, 0, 0);
|
||||
|
||||
/* Create a keyboard */
|
||||
/*Create a keyboard*/
|
||||
kb = lv_keyboard_create(lv_scr_act());
|
||||
lv_obj_set_size(kb, LV_HOR_RES, LV_VER_RES / 2);
|
||||
|
||||
lv_keyboard_set_textarea(kb, pwd_ta); /* Focus it on one of the text areas to start */
|
||||
lv_keyboard_set_textarea(kb, pwd_ta); /*Focus it on one of the text areas to start*/
|
||||
}
|
||||
|
||||
static void ta_event_cb(lv_obj_t * ta, lv_event_t event)
|
||||
{
|
||||
if(event == LV_EVENT_CLICKED) {
|
||||
/* Focus on the clicked text area */
|
||||
/*Focus on the clicked text area*/
|
||||
if(kb != NULL)
|
||||
lv_keyboard_set_textarea(kb, ta);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ static lv_obj_t * kb;
|
||||
*/
|
||||
void lv_example_textarea_3(void)
|
||||
{
|
||||
/* Create the text area */
|
||||
/*Create the text area*/
|
||||
lv_obj_t * ta = lv_textarea_create(lv_scr_act(), NULL);
|
||||
lv_obj_add_event_cb(ta, ta_event_cb, NULL);
|
||||
lv_textarea_set_accepted_chars(ta, "0123456789:");
|
||||
@ -19,7 +19,7 @@ void lv_example_textarea_3(void)
|
||||
lv_textarea_set_one_line(ta, true);
|
||||
lv_textarea_set_text(ta, "");
|
||||
|
||||
/* Create a keyboard*/
|
||||
/*Create a keyboard*/
|
||||
kb = lv_keyboard_create(lv_scr_act());
|
||||
lv_obj_set_size(kb, LV_HOR_RES, LV_VER_RES / 2);
|
||||
lv_keyboard_set_mode(kb, LV_KEYBOARD_MODE_NUMBER);
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#ifndef LV_CONF_H
|
||||
#define LV_CONF_H
|
||||
/* clang-format off */
|
||||
/*clang-format off*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -20,15 +20,15 @@
|
||||
COLOR SETTINGS
|
||||
*====================*/
|
||||
|
||||
/* Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888) */
|
||||
/*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/
|
||||
#define LV_COLOR_DEPTH 32
|
||||
|
||||
/* Swap the 2 bytes of RGB565 color. Useful if the display has a 8 bit interface (e.g. SPI)*/
|
||||
/*Swap the 2 bytes of RGB565 color. Useful if the display has a 8 bit interface (e.g. SPI)*/
|
||||
#define LV_COLOR_16_SWAP 0
|
||||
|
||||
/* Enable more complex drawing routines to manage screens transparency.
|
||||
* Can be used if the UI is above an other layer, e.g. an OSD menu or video player.
|
||||
* Requires `LV_COLOR_DEPTH = 32` colors and the screen's `bg_opa` should be set to non LV_OPA_COVER value */
|
||||
/*Enable more complex drawing routines to manage screens transparency.
|
||||
*Can be used if the UI is above an other layer, e.g. an OSD menu or video player.
|
||||
*Requires `LV_COLOR_DEPTH = 32` colors and the screen's `bg_opa` should be set to non LV_OPA_COVER value*/
|
||||
#define LV_COLOR_SCREEN_TRANSP 0
|
||||
|
||||
/*Images pixels with this color will not be drawn if they are chroma keyed)*/
|
||||
@ -38,13 +38,13 @@
|
||||
MEMORY SETTINGS
|
||||
*=========================*/
|
||||
|
||||
/* 1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()` */
|
||||
/*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/
|
||||
#define LV_MEM_CUSTOM 0
|
||||
#if LV_MEM_CUSTOM == 0
|
||||
/* Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
|
||||
# define LV_MEM_SIZE (32U * 1024U) /* [bytes] */
|
||||
/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
|
||||
# define LV_MEM_SIZE (32U * 1024U) /*[bytes]*/
|
||||
|
||||
/* Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too. */
|
||||
/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
|
||||
# define LV_MEM_ADR 0 /*0: unused*/
|
||||
#else /*LV_MEM_CUSTOM*/
|
||||
# define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
|
||||
@ -53,29 +53,29 @@
|
||||
# define LV_MEM_CUSTOM_REALLOC realloc
|
||||
#endif /*LV_MEM_CUSTOM*/
|
||||
|
||||
/* Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster). */
|
||||
/*Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster).*/
|
||||
#define LV_MEMCPY_MEMSET_STD 0
|
||||
|
||||
/*====================
|
||||
HAL SETTINGS
|
||||
*====================*/
|
||||
|
||||
/* Default display refresh period. LVG will redraw changed ares with this period time */
|
||||
/*Default display refresh period. LVG will redraw changed ares with this period time*/
|
||||
#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/
|
||||
|
||||
/* Input device read period in milliseconds */
|
||||
/*Input device read period in milliseconds*/
|
||||
#define LV_INDEV_DEF_READ_PERIOD 30 /*[ms]*/
|
||||
|
||||
/* Use a custom tick source that tells the elapsed time in milliseconds.
|
||||
* It removes the need to manually update the tick with `lv_tick_inc()`) */
|
||||
/*Use a custom tick source that tells the elapsed time in milliseconds.
|
||||
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
|
||||
#define LV_TICK_CUSTOM 0
|
||||
#if LV_TICK_CUSTOM
|
||||
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/
|
||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/
|
||||
#endif /*LV_TICK_CUSTOM*/
|
||||
|
||||
/* Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings.
|
||||
* (Not so important, you can adjust it to modify default sizes and spaces)*/
|
||||
/*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings.
|
||||
*(Not so important, you can adjust it to modify default sizes and spaces)*/
|
||||
#define LV_DPI_DEF 130 /*[px/inch]*/
|
||||
|
||||
/*=======================
|
||||
@ -86,25 +86,25 @@
|
||||
* Drawing
|
||||
*-----------*/
|
||||
|
||||
/* Enable complex draw engine.
|
||||
* Required to draw shadow, gradient, rounded corners, circles, arc, skew lines, image transformations or any masks */
|
||||
/*Enable complex draw engine.
|
||||
*Required to draw shadow, gradient, rounded corners, circles, arc, skew lines, image transformations or any masks*/
|
||||
#define LV_DRAW_COMPLEX 1
|
||||
#if LV_DRAW_COMPLEX != 0
|
||||
|
||||
/* Allow buffering some shadow calculation.
|
||||
* LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius`
|
||||
* Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/
|
||||
/*Allow buffering some shadow calculation.
|
||||
*LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius`
|
||||
*Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/
|
||||
#define LV_SHADOW_CACHE_SIZE 0
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
|
||||
/* Default image cache size. Image caching keeps the images opened.
|
||||
* If only the built-in image formats are used there is no real advantage of caching. (I.e. if no new image decoder is added)
|
||||
* With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images.
|
||||
* However the opened images might consume additional RAM.
|
||||
* 0: to disable caching */
|
||||
/*Default image cache size. Image caching keeps the images opened.
|
||||
*If only the built-in image formats are used there is no real advantage of caching. (I.e. if no new image decoder is added)
|
||||
*With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images.
|
||||
*However the opened images might consume additional RAM.
|
||||
*0: to disable caching*/
|
||||
#define LV_IMG_CACHE_DEF_SIZE 0
|
||||
|
||||
/* Maximum buffer size to allocate for rotation. Only used if software rotation is enabled in the display driver. */
|
||||
/*Maximum buffer size to allocate for rotation. Only used if software rotation is enabled in the display driver.*/
|
||||
#define LV_DISP_ROT_MAX_BUF (10*1024)
|
||||
/*-------------
|
||||
* GPU
|
||||
@ -114,22 +114,22 @@
|
||||
#define LV_USE_GPU_STM32_DMA2D 0
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
/*Must be defined to include path of CMSIS header of target processor
|
||||
e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
||||
e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
|
||||
#define LV_GPU_DMA2D_CMSIS_INCLUDE
|
||||
#endif
|
||||
|
||||
/* Use NXP's PXP GPU iMX RTxxx platforms */
|
||||
/*Use NXP's PXP GPU iMX RTxxx platforms*/
|
||||
#define LV_USE_GPU_NXP_PXP 0
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
/*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c)
|
||||
* and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol FSL_RTOS_FREE_RTOS
|
||||
* has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected.
|
||||
*0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init()
|
||||
* */
|
||||
*/
|
||||
#define LV_USE_GPU_NXP_PXP_AUTO_INIT 0
|
||||
#endif
|
||||
|
||||
/* Use NXP's VG-Lite GPU iMX RTxxx platforms */
|
||||
/*Use NXP's VG-Lite GPU iMX RTxxx platforms*/
|
||||
#define LV_USE_GPU_NXP_VG_LITE 0
|
||||
|
||||
/*-------------
|
||||
@ -140,20 +140,20 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
||||
#define LV_USE_LOG 1
|
||||
#if LV_USE_LOG
|
||||
|
||||
/* How important log should be added:
|
||||
* LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
|
||||
* LV_LOG_LEVEL_INFO Log important events
|
||||
* LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
|
||||
* LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
|
||||
* LV_LOG_LEVEL_USER Only logs added by the user
|
||||
* LV_LOG_LEVEL_NONE Do not log anything */
|
||||
/*How important log should be added:
|
||||
*LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
|
||||
*LV_LOG_LEVEL_INFO Log important events
|
||||
*LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
|
||||
*LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
|
||||
*LV_LOG_LEVEL_USER Only logs added by the user
|
||||
*LV_LOG_LEVEL_NONE Do not log anything*/
|
||||
# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
|
||||
|
||||
/* 1: Print the log with 'printf';
|
||||
* 0: User need to register a callback with `lv_log_register_print_cb()`*/
|
||||
/*1: Print the log with 'printf';
|
||||
*0: User need to register a callback with `lv_log_register_print_cb()`*/
|
||||
# define LV_LOG_PRINTF 1
|
||||
|
||||
/*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs */
|
||||
/*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/
|
||||
# define LV_LOG_TRACE_MEM 1
|
||||
# define LV_LOG_TRACE_TIMER 1
|
||||
# define LV_LOG_TRACE_INDEV 1
|
||||
@ -170,13 +170,13 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
||||
* Asserts
|
||||
*-----------*/
|
||||
|
||||
/* Enable asserts if an operation is failed or an invalid data is found.
|
||||
* If LV_USE_LOG is enabled an error message will be printed on failure*/
|
||||
#define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended) */
|
||||
/*Enable asserts if an operation is failed or an invalid data is found.
|
||||
*If LV_USE_LOG is enabled an error message will be printed on failure*/
|
||||
#define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended)*/
|
||||
#define LV_USE_ASSERT_MALLOC 1 /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/
|
||||
#define LV_USE_ASSERT_STYLE 1 /*Check if the styles are properly initialized. (Very fast, recommended)*/
|
||||
#define LV_USE_ASSERT_MEM_INTEGRITY 1 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/
|
||||
#define LV_USE_ASSERT_OBJ 1 /*Check the object's type and existence (e.g. not deleted). (Slow) */
|
||||
#define LV_USE_ASSERT_OBJ 1 /*Check the object's type and existence (e.g. not deleted). (Slow)*/
|
||||
|
||||
/*Add a custom handler when assert happens e.g. to restart the MCU*/
|
||||
#define LV_ASSERT_HANDLER_INCLUDE <stdint.h>
|
||||
@ -208,50 +208,50 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
||||
typedef void * lv_user_data_t;
|
||||
#endif
|
||||
|
||||
/* Garbage Collector settings
|
||||
* Used if lvgl is binded to higher level language and the memory is managed by that language */
|
||||
/*Garbage Collector settings
|
||||
*Used if lvgl is binded to higher level language and the memory is managed by that language*/
|
||||
#define LV_ENABLE_GC 0
|
||||
#if LV_ENABLE_GC != 0
|
||||
# define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/
|
||||
#endif /* LV_ENABLE_GC */
|
||||
#endif /*LV_ENABLE_GC*/
|
||||
|
||||
/*=====================
|
||||
* COMPILER SETTINGS
|
||||
*====================*/
|
||||
|
||||
/* For big endian systems set to 1 */
|
||||
/*For big endian systems set to 1*/
|
||||
#define LV_BIG_ENDIAN_SYSTEM 0
|
||||
|
||||
/* Define a custom attribute to `lv_tick_inc` function */
|
||||
/*Define a custom attribute to `lv_tick_inc` function*/
|
||||
#define LV_ATTRIBUTE_TICK_INC
|
||||
|
||||
/* Define a custom attribute to `lv_timer_handler` function */
|
||||
/*Define a custom attribute to `lv_timer_handler` function*/
|
||||
#define LV_ATTRIBUTE_TIMER_HANDLER
|
||||
|
||||
/* Define a custom attribute to `lv_disp_flush_ready` function */
|
||||
/*Define a custom attribute to `lv_disp_flush_ready` function*/
|
||||
#define LV_ATTRIBUTE_FLUSH_READY
|
||||
|
||||
/* Required alignment size for buffers */
|
||||
/*Required alignment size for buffers*/
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN_SIZE
|
||||
|
||||
/*Will be added where memories needs to be aligned (with -Os data might not be aligned to boundary by default).
|
||||
* E.g. __attribute__((aligned(4)))*/
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN
|
||||
|
||||
/* Attribute to mark large constant arrays for example font's bitmaps */
|
||||
/*Attribute to mark large constant arrays for example font's bitmaps*/
|
||||
#define LV_ATTRIBUTE_LARGE_CONST
|
||||
|
||||
/* Complier prefix for a big array declaration in RAM*/
|
||||
/*Complier prefix for a big array declaration in RAM*/
|
||||
#define LV_ATTRIBUTE_LARGE_RAM_ARRAY
|
||||
|
||||
/* Place performance critical functions into a faster memory (e.g RAM) */
|
||||
/*Place performance critical functions into a faster memory (e.g RAM)*/
|
||||
#define LV_ATTRIBUTE_FAST_MEM
|
||||
|
||||
/* Prefix variables that are used in GPU accelerated operations, often these need to be placed in RAM sections that are DMA accessible */
|
||||
/*Prefix variables that are used in GPU accelerated operations, often these need to be placed in RAM sections that are DMA accessible*/
|
||||
#define LV_ATTRIBUTE_DMA
|
||||
|
||||
/* Export integer constant to binding. This macro is used with constants in the form of LV_<CONST> that
|
||||
* should also appear on LVGL binding API such as Micropython.*/
|
||||
/*Export integer constant to binding. This macro is used with constants in the form of LV_<CONST> that
|
||||
*should also appear on LVGL binding API such as Micropython.*/
|
||||
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /*The default value just prevents GCC warning*/
|
||||
|
||||
/*Extend the default -32k..32k coordinate range to -4M..4M by using int32_t for coordinates instead of int16_t*/
|
||||
@ -261,8 +261,8 @@ typedef void * lv_user_data_t;
|
||||
* FONT USAGE
|
||||
*===================*/
|
||||
|
||||
/* Montserrat fonts with ASCII range and some symbols using bpp = 4
|
||||
* https://fonts.google.com/specimen/Montserrat */
|
||||
/*Montserrat fonts with ASCII range and some symbols using bpp = 4
|
||||
*https://fonts.google.com/specimen/Montserrat*/
|
||||
#define LV_FONT_MONTSERRAT_8 0
|
||||
#define LV_FONT_MONTSERRAT_10 0
|
||||
#define LV_FONT_MONTSERRAT_12 0
|
||||
@ -285,37 +285,37 @@ typedef void * lv_user_data_t;
|
||||
#define LV_FONT_MONTSERRAT_46 0
|
||||
#define LV_FONT_MONTSERRAT_48 0
|
||||
|
||||
/* Demonstrate special features */
|
||||
/*Demonstrate special features*/
|
||||
#define LV_FONT_MONTSERRAT_12_SUBPX 0
|
||||
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/
|
||||
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, Perisan letters and all their forms*/
|
||||
#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/
|
||||
|
||||
/*Pixel perfect monospace fonts
|
||||
* http://pelulamu.net/unscii/ */
|
||||
*http://pelulamu.net/unscii/*/
|
||||
#define LV_FONT_UNSCII_8 0
|
||||
#define LV_FONT_UNSCII_16 0
|
||||
|
||||
/* Optionally declare custom fonts here.
|
||||
* You can use these fonts as default font too and they will be available globally.
|
||||
* E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2) */
|
||||
/*Optionally declare custom fonts here.
|
||||
*You can use these fonts as default font too and they will be available globally.
|
||||
*E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2)*/
|
||||
#define LV_FONT_CUSTOM_DECLARE
|
||||
|
||||
/*Always set a default font*/
|
||||
#define LV_FONT_DEFAULT &lv_font_montserrat_14
|
||||
|
||||
/* Enable handling large font and/or fonts with a lot of characters.
|
||||
* The limit depends on the font size, font face and bpp.
|
||||
* Compiler error will be triggered if a font needs it.*/
|
||||
/*Enable handling large font and/or fonts with a lot of characters.
|
||||
*The limit depends on the font size, font face and bpp.
|
||||
*Compiler error will be triggered if a font needs it.*/
|
||||
#define LV_FONT_FMT_TXT_LARGE 0
|
||||
|
||||
/* Enables/disables support for compressed fonts. */
|
||||
/*Enables/disables support for compressed fonts.*/
|
||||
#define LV_USE_FONT_COMPRESSED 0
|
||||
|
||||
/* Enable subpixel rendering */
|
||||
/*Enable subpixel rendering*/
|
||||
#define LV_USE_FONT_SUBPX 0
|
||||
#if LV_USE_FONT_SUBPX
|
||||
/* Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/
|
||||
/*Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/
|
||||
#define LV_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/
|
||||
#endif
|
||||
|
||||
@ -323,52 +323,53 @@ typedef void * lv_user_data_t;
|
||||
* TEXT SETTINGS
|
||||
*=================*/
|
||||
|
||||
/* Select a character encoding for strings.
|
||||
/**
|
||||
* Select a character encoding for strings.
|
||||
* Your IDE or editor should have the same character encoding
|
||||
* - LV_TXT_ENC_UTF8
|
||||
* - LV_TXT_ENC_ASCII
|
||||
* */
|
||||
*/
|
||||
#define LV_TXT_ENC LV_TXT_ENC_UTF8
|
||||
|
||||
/*Can break (wrap) texts on these chars*/
|
||||
#define LV_TXT_BREAK_CHARS " ,.;:-_"
|
||||
|
||||
/* If a word is at least this long, will break wherever "prettiest"
|
||||
* To disable, set to a value <= 0 */
|
||||
/*If a word is at least this long, will break wherever "prettiest"
|
||||
*To disable, set to a value <= 0*/
|
||||
#define LV_TXT_LINE_BREAK_LONG_LEN 0
|
||||
|
||||
/* Minimum number of characters in a long word to put on a line before a break.
|
||||
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
|
||||
/*Minimum number of characters in a long word to put on a line before a break.
|
||||
*Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/
|
||||
#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3
|
||||
|
||||
/* Minimum number of characters in a long word to put on a line after a break.
|
||||
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
|
||||
/*Minimum number of characters in a long word to put on a line after a break.
|
||||
*Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/
|
||||
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3
|
||||
|
||||
/* The control character to use for signalling text recoloring. */
|
||||
/*The control character to use for signalling text recoloring.*/
|
||||
#define LV_TXT_COLOR_CMD "#"
|
||||
|
||||
/* Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts.
|
||||
* The direction will be processed according to the Unicode Bidirectioanl Algorithm:
|
||||
* https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
|
||||
/*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts.
|
||||
*The direction will be processed according to the Unicode Bidirectioanl Algorithm:
|
||||
*https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
|
||||
#define LV_USE_BIDI 0
|
||||
#if LV_USE_BIDI
|
||||
/* Set the default direction. Supported values:
|
||||
* `LV_BIDI_DIR_LTR` Left-to-Right
|
||||
* `LV_BIDI_DIR_RTL` Right-to-Left
|
||||
* `LV_BIDI_DIR_AUTO` detect texts base direction */
|
||||
/*Set the default direction. Supported values:
|
||||
*`LV_BIDI_DIR_LTR` Left-to-Right
|
||||
*`LV_BIDI_DIR_RTL` Right-to-Left
|
||||
*`LV_BIDI_DIR_AUTO` detect texts base direction*/
|
||||
#define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_AUTO
|
||||
#endif
|
||||
|
||||
/* Enable Arabic/Persian processing
|
||||
* In these languages characters should be replaced with an other form based on their position in the text */
|
||||
/*Enable Arabic/Persian processing
|
||||
*In these languages characters should be replaced with an other form based on their position in the text*/
|
||||
#define LV_USE_ARABIC_PERSIAN_CHARS 0
|
||||
|
||||
/*==================
|
||||
* WIDGET USAGE
|
||||
*================*/
|
||||
|
||||
/* Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html */
|
||||
/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/
|
||||
|
||||
#define LV_USE_ARC 1
|
||||
|
||||
@ -390,7 +391,7 @@ typedef void * lv_user_data_t;
|
||||
|
||||
#define LV_USE_LABEL 1
|
||||
#if LV_USE_LABEL
|
||||
# define LV_LABEL_TEXT_SEL 1 /*Enable selecting text of the label */
|
||||
# define LV_LABEL_TEXT_SEL 1 /*Enable selecting text of the label*/
|
||||
# define LV_LABEL_LONG_TXT_HINT 1 /*Store some extra info in labels to speed up drawing of very long texts*/
|
||||
#endif
|
||||
|
||||
@ -460,14 +461,14 @@ typedef void * lv_user_data_t;
|
||||
/*-----------
|
||||
* Themes
|
||||
*----------*/
|
||||
/* A simple, impressive and very complete theme */
|
||||
/*A simple, impressive and very complete theme*/
|
||||
#define LV_USE_THEME_DEFAULT 1
|
||||
#if LV_USE_THEME_DEFAULT
|
||||
|
||||
/* 1: Light mode; 0: Dark mode*/
|
||||
/*1: Light mode; 0: Dark mode*/
|
||||
# define LV_THEME_DEFAULT_PALETTE_LIGHT 1
|
||||
|
||||
/* 1: Enable grow on press*/
|
||||
/*1: Enable grow on press*/
|
||||
# define LV_THEME_DEFAULT_GROW 1
|
||||
|
||||
/*Default transition time in [ms]*/
|
||||
|
4
lvgl.h
4
lvgl.h
@ -109,7 +109,7 @@ extern "C" {
|
||||
* bugfix_in_v5_3_2();
|
||||
* #endif
|
||||
*
|
||||
* */
|
||||
*/
|
||||
#define LV_VERSION_CHECK(x,y,z) (x == LVGL_VERSION_MAJOR && (y < LVGL_VERSION_MINOR || (y == LVGL_VERSION_MINOR && z <= LVGL_VERSION_PATCH)))
|
||||
|
||||
/**
|
||||
@ -137,7 +137,7 @@ static inline const char *lv_version_info(void)
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LVGL_H*/
|
||||
|
@ -23,18 +23,18 @@ fout.write(
|
||||
|
||||
#ifndef LV_CONF_INTERNAL_H
|
||||
#define LV_CONF_INTERNAL_H
|
||||
/* clang-format off */
|
||||
/*clang-format off*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* Handle special Kconfig options */
|
||||
/*Handle special Kconfig options*/
|
||||
#include "lv_conf_kconfig.h"
|
||||
|
||||
#ifdef CONFIG_LV_CONF_SKIP
|
||||
#define LV_CONF_SKIP
|
||||
#endif
|
||||
|
||||
/* If "lv_conf.h" is available from here try to use it later.*/
|
||||
/*If "lv_conf.h" is available from here try to use it later.*/
|
||||
#if defined __has_include
|
||||
# if __has_include("lv_conf.h")
|
||||
# ifndef LV_CONF_INCLUDE_SIMPLE
|
||||
@ -54,7 +54,7 @@ fout.write(
|
||||
# elif defined(LV_CONF_INCLUDE_SIMPLE) /*Or simply include lv_conf.h is enabled*/
|
||||
# include "lv_conf.h"
|
||||
# else
|
||||
# include "../../lv_conf.h" /*Else assume lv_conf.h is next to the lvgl folder */
|
||||
# include "../../lv_conf.h" /*Else assume lv_conf.h is next to the lvgl folder*/
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -113,7 +113,7 @@ fout.write(
|
||||
typedef void * lv_obj_user_data_t;
|
||||
# endif
|
||||
|
||||
# if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/
|
||||
# if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /*Disable warnings for Visual Studio*/
|
||||
# define _CRT_SECURE_NO_WARNINGS
|
||||
# endif
|
||||
|
||||
|
@ -258,7 +258,7 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t
|
||||
|
||||
switch(anim_type) {
|
||||
case LV_SCR_LOAD_ANIM_NONE:
|
||||
/* Create a dummy animation to apply the delay*/
|
||||
/*Create a dummy animation to apply the delay*/
|
||||
lv_anim_set_exec_cb(&a_new, set_x_anim);
|
||||
lv_anim_set_values(&a_new, 0, 0);
|
||||
break;
|
||||
|
@ -225,7 +225,7 @@ static inline lv_coord_t lv_dpx(lv_coord_t n)
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DISP_H*/
|
||||
|
@ -134,8 +134,8 @@ void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj)
|
||||
if(next == NULL) return;
|
||||
*next = obj;
|
||||
|
||||
/* If the head and the tail is equal then there is only one object in the linked list.
|
||||
* In this case automatically activate it*/
|
||||
/*If the head and the tail is equal then there is only one object in the linked list.
|
||||
*In this case automatically activate it*/
|
||||
if(_lv_ll_get_head(&group->obj_ll) == next) {
|
||||
lv_group_refocus(group);
|
||||
}
|
||||
@ -168,14 +168,14 @@ void lv_group_remove_obj(lv_obj_t * obj)
|
||||
}
|
||||
}
|
||||
|
||||
/* If the focuses object is still the same then it was the only object in the group but it will
|
||||
* be deleted. Set the `obj_focus` to NULL to get back to the initial state of the group with
|
||||
* zero objects*/
|
||||
/*If the focuses object is still the same then it was the only object in the group but it will
|
||||
*be deleted. Set the `obj_focus` to NULL to get back to the initial state of the group with
|
||||
*zero objects*/
|
||||
if(*g->obj_focus == obj) {
|
||||
g->obj_focus = NULL;
|
||||
}
|
||||
|
||||
/*Search the object and remove it from its group */
|
||||
/*Search the object and remove it from its group*/
|
||||
lv_obj_t ** i;
|
||||
_LV_LL_READ(&g->obj_ll, i) {
|
||||
if(*i == obj) {
|
||||
|
@ -55,7 +55,7 @@ typedef void (*lv_group_focus_cb_t)(struct _lv_group_t *);
|
||||
* They are NOT for laying out objects on a screen (try `lv_cont` for that).
|
||||
*/
|
||||
typedef struct _lv_group_t {
|
||||
lv_ll_t obj_ll; /**< Linked list to store the objects in the group */
|
||||
lv_ll_t obj_ll; /**< Linked list to store the objects in the group*/
|
||||
struct _lv_obj_t ** obj_focus; /**< The object in focus*/
|
||||
|
||||
lv_group_focus_cb_t focus_cb; /**< A function to call when a new object is focused (optional)*/
|
||||
@ -66,7 +66,7 @@ typedef struct _lv_group_t {
|
||||
uint8_t frozen : 1; /**< 1: can't focus to new object*/
|
||||
uint8_t editing : 1; /**< 1: Edit mode, 0: Navigate mode*/
|
||||
uint8_t click_focus : 1; /**< 1: If an object in a group is clicked by an indev then it will be
|
||||
focused */
|
||||
focused*/
|
||||
uint8_t refocus_policy : 1; /**< 1: Focus prev if focused on deletion. 0: Focus next if focused on
|
||||
deletion.*/
|
||||
uint8_t wrap : 1; /**< 1: Focus next/prev can wrap at end of list. 0: Focus next/prev stops at end
|
||||
@ -226,7 +226,7 @@ bool lv_group_get_wrap(lv_group_t * group);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_GROUP_H*/
|
||||
|
@ -379,13 +379,13 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
/*Save the last key to compare it with the current latter on RELEASE*/
|
||||
uint32_t prev_key = i->proc.types.keypad.last_key;
|
||||
|
||||
/* Save the last key.
|
||||
* It must be done here else `lv_indev_get_key` will return the last key in events and signals*/
|
||||
/*Save the last key.
|
||||
*It must be done here else `lv_indev_get_key` will return the last key in events and signals*/
|
||||
i->proc.types.keypad.last_key = data->key;
|
||||
|
||||
/* Save the previous state so we can detect state changes below and also set the last state now
|
||||
* so if any signal/event handler on the way returns `LV_RES_INV` the last state is remembered
|
||||
* for the next time*/
|
||||
/*Save the previous state so we can detect state changes below and also set the last state now
|
||||
*so if any signal/event handler on the way returns `LV_RES_INV` the last state is remembered
|
||||
*for the next time*/
|
||||
uint32_t prev_state = i->proc.types.keypad.last_state;
|
||||
i->proc.types.keypad.last_state = data->state;
|
||||
|
||||
@ -524,8 +524,8 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
i->proc.types.keypad.last_state = LV_INDEV_STATE_RELEASED; /*To skip the processing of release*/
|
||||
}
|
||||
|
||||
/* Save the last keys before anything else.
|
||||
* They need to be already saved if the function returns for any reason*/
|
||||
/*Save the last keys before anything else.
|
||||
*They need to be already saved if the function returns for any reason*/
|
||||
lv_indev_state_t last_state = i->proc.types.keypad.last_state;
|
||||
i->proc.types.keypad.last_state = data->state;
|
||||
i->proc.types.keypad.last_key = data->key;
|
||||
@ -584,7 +584,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
}
|
||||
/*Pressing*/
|
||||
else if(data->state == LV_INDEV_STATE_PRESSED && last_state == LV_INDEV_STATE_PRESSED) {
|
||||
/* Long press*/
|
||||
/*Long press*/
|
||||
if(i->proc.long_pr_sent == 0 && lv_tick_elaps(i->proc.pr_timestamp) > i->driver->long_press_time) {
|
||||
|
||||
i->proc.long_pr_sent = 1;
|
||||
@ -659,7 +659,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
}
|
||||
/*An object is being edited and the button is released. */
|
||||
/*An object is being edited and the button is released.*/
|
||||
else if(g->editing) {
|
||||
/*Ignore long pressed enter release because it comes from mode switch*/
|
||||
if(!i->proc.long_pr_sent || _lv_ll_get_len(&g->obj_ll) <= 1) {
|
||||
@ -724,7 +724,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
*/
|
||||
static void indev_button_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
{
|
||||
/* Die gracefully if i->btn_points is NULL */
|
||||
/*Die gracefully if i->btn_points is NULL*/
|
||||
if(i->btn_points == NULL) {
|
||||
LV_LOG_WARN("btn_points is NULL");
|
||||
return;
|
||||
@ -829,7 +829,7 @@ static void indev_proc_press(lv_indev_proc_t * proc)
|
||||
proc->types.pointer.last_obj = indev_obj_act;
|
||||
|
||||
if(indev_obj_act != NULL) {
|
||||
/* Save the time when the obj pressed to count long press time.*/
|
||||
/*Save the time when the obj pressed to count long press time.*/
|
||||
proc->pr_timestamp = lv_tick_get();
|
||||
proc->long_pr_sent = 0;
|
||||
proc->types.pointer.scroll_sum.x = 0;
|
||||
@ -929,7 +929,7 @@ static void indev_proc_release(lv_indev_proc_t * proc)
|
||||
indev_obj_act = proc->types.pointer.act_obj;
|
||||
lv_obj_t * scroll_obj = proc->types.pointer.scroll_obj;
|
||||
|
||||
/*Forget the act obj and send a released signal */
|
||||
/*Forget the act obj and send a released signal*/
|
||||
if(indev_obj_act) {
|
||||
LV_LOG_INFO("released");
|
||||
|
||||
@ -1006,7 +1006,7 @@ static void indev_click_focus(lv_indev_proc_t * proc)
|
||||
lv_group_t * g_act = lv_obj_get_group(obj_to_focus);
|
||||
lv_group_t * g_prev = proc->types.pointer.last_pressed ? lv_obj_get_group(proc->types.pointer.last_pressed) : NULL;
|
||||
|
||||
/*If both the last and act. obj. are in the same group (or no group but it's also the same) */
|
||||
/*If both the last and act. obj. are in the same group (or no group but it's also the same)*/
|
||||
if(g_act == g_prev) {
|
||||
/*The objects are in a group*/
|
||||
if(g_act) {
|
||||
|
@ -170,7 +170,7 @@ lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_INDEV_H*/
|
||||
|
@ -158,7 +158,7 @@ void _lv_indev_scroll_throw_handler(lv_indev_proc_t * proc)
|
||||
}
|
||||
}
|
||||
|
||||
/*Check if the scroll has finished */
|
||||
/*Check if the scroll has finished*/
|
||||
if(proc->types.pointer.scroll_throw_vect.x == 0 && proc->types.pointer.scroll_throw_vect.y == 0) {
|
||||
/*Revert if scrolled in*/
|
||||
/*If vertically scrollable and not controlled by snap*/
|
||||
@ -247,13 +247,13 @@ static lv_obj_t * find_scroll_obj(lv_indev_proc_t * proc)
|
||||
lv_indev_t * indev_act = lv_indev_get_act();
|
||||
lv_coord_t scroll_limit = indev_act->driver->scroll_limit;
|
||||
|
||||
/* Go until find an scrollable object in the current direction
|
||||
* More precisely:
|
||||
* 1. Check the pressed object and all of its ancestors and try to find an object which is scrollable
|
||||
* 2. Scrollable means it has some content out of it's area
|
||||
* 3. If an object can be scrolled into the current direction then use it ("real match"")
|
||||
* 4. If can be scrolled on the current axis (hor/ver) save it as candidate (at least show an elastic scroll effect)
|
||||
* 5. Use the last candidate. Always the "deepest" parent or the object from point 3 */
|
||||
/*Go until find an scrollable object in the current direction
|
||||
*More precisely:
|
||||
* 1. Check the pressed object and all of its ancestors and try to find an object which is scrollable
|
||||
* 2. Scrollable means it has some content out of it's area
|
||||
* 3. If an object can be scrolled into the current direction then use it ("real match"")
|
||||
* 4. If can be scrolled on the current axis (hor/ver) save it as candidate (at least show an elastic scroll effect)
|
||||
* 5. Use the last candidate. Always the "deepest" parent or the object from point 3*/
|
||||
lv_obj_t * obj_act = proc->types.pointer.act_obj;
|
||||
while(obj_act) {
|
||||
if(lv_obj_has_flag(obj_act, LV_OBJ_FLAG_SCROLLABLE) == false) {
|
||||
@ -286,16 +286,16 @@ static lv_obj_t * find_scroll_obj(lv_indev_proc_t * proc)
|
||||
if((scroll_dir & LV_DIR_TOP) == 0) up_en = false;
|
||||
if((scroll_dir & LV_DIR_BOTTOM) == 0) down_en = false;
|
||||
|
||||
/*The object is scrollable to a direction if its content overflow in that direction. */
|
||||
/*The object is scrollable to a direction if its content overflow in that direction.*/
|
||||
lv_coord_t st = lv_obj_get_scroll_top(obj_act);
|
||||
lv_coord_t sb = lv_obj_get_scroll_bottom(obj_act);
|
||||
lv_coord_t sl = lv_obj_get_scroll_left(obj_act);
|
||||
lv_coord_t sr = lv_obj_get_scroll_right(obj_act);
|
||||
|
||||
/* If this object is scrollable into the current scroll direction then save it as a candidate.
|
||||
* It's important only to be scrollable on the current axis (hor/ver) because if the scroll
|
||||
* is propagated to this object it can show at least elastic scroll effect.
|
||||
* But if not hor/ver scrollable do not scroll it at all (so it's not a good candidate) */
|
||||
/*If this object is scrollable into the current scroll direction then save it as a candidate.
|
||||
*It's important only to be scrollable on the current axis (hor/ver) because if the scroll
|
||||
*is propagated to this object it can show at least elastic scroll effect.
|
||||
*But if not hor/ver scrollable do not scroll it at all (so it's not a good candidate)*/
|
||||
if((st > 0 || sb > 0) &&
|
||||
((up_en && proc->types.pointer.scroll_sum.y >= scroll_limit) ||
|
||||
(down_en && proc->types.pointer.scroll_sum.y <= - scroll_limit)))
|
||||
@ -317,7 +317,7 @@ static lv_obj_t * find_scroll_obj(lv_indev_proc_t * proc)
|
||||
if(sl <= 0) left_en = false;
|
||||
if(sr <= 0) right_en = false;
|
||||
|
||||
/*If the object really can be scrolled into the current direction the use it. */
|
||||
/*If the object really can be scrolled into the current direction the use it.*/
|
||||
if((left_en && proc->types.pointer.scroll_sum.x >= scroll_limit) ||
|
||||
(right_en && proc->types.pointer.scroll_sum.x <= - scroll_limit) ||
|
||||
(up_en && proc->types.pointer.scroll_sum.y >= scroll_limit) ||
|
||||
@ -330,7 +330,7 @@ static lv_obj_t * find_scroll_obj(lv_indev_proc_t * proc)
|
||||
/*If this object don't want to chain the scroll ot the parent stop searching*/
|
||||
if(lv_obj_has_flag(obj_act, LV_OBJ_FLAG_SCROLL_CHAIN) == false) break;
|
||||
|
||||
/*Try the parent */
|
||||
/*Try the parent*/
|
||||
obj_act = lv_obj_get_parent(obj_act);
|
||||
}
|
||||
|
||||
@ -563,8 +563,8 @@ static lv_coord_t scroll_throw_predict_x(lv_indev_proc_t * proc)
|
||||
static lv_coord_t elastic_diff(lv_obj_t * scroll_obj, lv_coord_t diff, lv_coord_t scroll_start, lv_coord_t scroll_end, lv_dir_t dir)
|
||||
{
|
||||
if(lv_obj_has_flag(scroll_obj, LV_OBJ_FLAG_SCROLL_ELASTIC)) {
|
||||
/* If there is snapping in the current direction don't use the elastic factor because
|
||||
* it's natural that the first and last items are scrolled (snapped) in. */
|
||||
/*If there is snapping in the current direction don't use the elastic factor because
|
||||
*it's natural that the first and last items are scrolled (snapped) in.*/
|
||||
lv_scroll_snap_t snap;
|
||||
snap = dir == LV_DIR_HOR ? lv_obj_get_scroll_snap_x(scroll_obj) : lv_obj_get_scroll_snap_y(scroll_obj);
|
||||
|
||||
|
@ -59,7 +59,7 @@ void lv_indev_scroll_get_snap_dist(lv_obj_t * obj, lv_point_t * p);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_INDEV_SCROLL_H*/
|
||||
|
@ -106,7 +106,7 @@ const lv_obj_class_t lv_obj_class = {
|
||||
|
||||
void lv_init(void)
|
||||
{
|
||||
/* Do nothing if already initialized */
|
||||
/*Do nothing if already initialized*/
|
||||
if(lv_initialized) {
|
||||
LV_LOG_WARN("lv_init: already inited");
|
||||
return;
|
||||
@ -207,9 +207,9 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, void * param)
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
/* Build a simple linked list from the objects used in the events
|
||||
* It's important to know if an this object was deleted by a nested event
|
||||
* called from this `event_cb`. */
|
||||
/*Build a simple linked list from the objects used in the events
|
||||
*It's important to know if an this object was deleted by a nested event
|
||||
*called from this `event_cb`.*/
|
||||
lv_event_temp_data_t event_temp_data;
|
||||
event_temp_data.obj = obj;
|
||||
event_temp_data.deleted = false;
|
||||
@ -220,8 +220,8 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, void * param)
|
||||
}
|
||||
event_temp_data_head = &event_temp_data;
|
||||
|
||||
/* There could be nested event sending with different param.
|
||||
* It needs to be saved for the current event context because `lv_event_get_data` returns a global param. */
|
||||
/*There could be nested event sending with different param.
|
||||
*It needs to be saved for the current event context because `lv_event_get_data` returns a global param.*/
|
||||
void * event_act_param_save = event_act_param;
|
||||
event_act_param = param;
|
||||
|
||||
@ -437,8 +437,8 @@ void lv_obj_set_base_dir(lv_obj_t * obj, lv_bidi_dir_t dir)
|
||||
obj->spec_attr->base_dir = dir;
|
||||
lv_signal_send(obj, LV_SIGNAL_BASE_DIR_CHG, NULL);
|
||||
|
||||
/* Notify the children about the parent base dir has changed.
|
||||
* (The children might have `LV_BIDI_DIR_INHERIT`)*/
|
||||
/*Notify the children about the parent base dir has changed.
|
||||
*(The children might have `LV_BIDI_DIR_INHERIT`)*/
|
||||
base_dir_refr_children(obj);
|
||||
}
|
||||
|
||||
@ -679,7 +679,7 @@ static void lv_obj_constructor(lv_obj_t * obj, const lv_obj_t * copy)
|
||||
}
|
||||
/*Add to the same group*/
|
||||
if(copy->spec_attr && copy->spec_attr->group_p) {
|
||||
obj->spec_attr->group_p = NULL; /*It was simply copied */
|
||||
obj->spec_attr->group_p = NULL; /*It was simply copied*/
|
||||
lv_group_add_obj(copy->spec_attr->group_p, obj);
|
||||
}
|
||||
|
||||
@ -999,8 +999,8 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_BASE_DIR_CHG) {
|
||||
/* The layout might depend on the base dir.
|
||||
* E.g. the first is element is on the left or right*/
|
||||
/*The layout might depend on the base dir.
|
||||
*E.g. the first is element is on the left or right*/
|
||||
lv_obj_mark_layout_as_dirty(obj);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_SCROLL) {
|
||||
@ -1018,7 +1018,7 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
|
||||
*s = LV_MAX(*s, d);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
/* Padding might have changed so the layout should be recalculated*/
|
||||
/*Padding might have changed so the layout should be recalculated*/
|
||||
lv_obj_mark_layout_as_dirty(obj);
|
||||
|
||||
/*Reposition non grid objects on by one*/
|
||||
|
@ -44,8 +44,8 @@ struct _lv_obj_t;
|
||||
typedef enum {
|
||||
LV_EVENT_PRESSED, /**< The object has been pressed*/
|
||||
LV_EVENT_PRESSING, /**< The object is being pressed (called continuously while pressing)*/
|
||||
LV_EVENT_PRESS_LOST, /**< User is still pressing but slid cursor/finger off of the object */
|
||||
LV_EVENT_SHORT_CLICKED, /**< User pressed object for a short period of time, then released it. Not called if scrolled. */
|
||||
LV_EVENT_PRESS_LOST, /**< User is still pressing but slid cursor/finger off of the object*/
|
||||
LV_EVENT_SHORT_CLICKED, /**< User pressed object for a short period of time, then released it. Not called if scrolled.*/
|
||||
LV_EVENT_LONG_PRESSED, /**< Object has been pressed for at least `LV_INDEV_LONG_PRESS_TIME`. Not called if scrolled.*/
|
||||
LV_EVENT_LONG_PRESSED_REPEAT, /**< Called after `LV_INDEV_LONG_PRESS_TIME` in every
|
||||
`LV_INDEV_LONG_PRESS_REP_TIME` ms. Not called if scrolled.*/
|
||||
@ -59,13 +59,13 @@ typedef enum {
|
||||
LV_EVENT_FOCUSED,
|
||||
LV_EVENT_DEFOCUSED,
|
||||
LV_EVENT_LEAVE,
|
||||
LV_EVENT_VALUE_CHANGED, /**< The object's value has changed (i.e. slider moved) */
|
||||
LV_EVENT_VALUE_CHANGED, /**< The object's value has changed (i.e. slider moved)*/
|
||||
LV_EVENT_INSERT,
|
||||
LV_EVENT_REFRESH,
|
||||
LV_EVENT_DELETE, /**< Object is being deleted */
|
||||
LV_EVENT_DELETE, /**< Object is being deleted*/
|
||||
|
||||
LV_EVENT_COVER_CHECK, /**< Check if the object fully covers the 'mask_p' area */
|
||||
LV_EVENT_REFR_EXT_DRAW_SIZE, /**< Draw extras on the object */
|
||||
LV_EVENT_COVER_CHECK, /**< Check if the object fully covers the 'mask_p' area*/
|
||||
LV_EVENT_REFR_EXT_DRAW_SIZE, /**< Draw extras on the object*/
|
||||
|
||||
LV_EVENT_DRAW_MAIN_BEGIN,
|
||||
LV_EVENT_DRAW_MAIN_END,
|
||||
@ -74,8 +74,8 @@ typedef enum {
|
||||
LV_EVENT_DRAW_PART_BEGIN,
|
||||
LV_EVENT_DRAW_PART_END,
|
||||
|
||||
LV_EVENT_READY, /**< A process has finished */
|
||||
LV_EVENT_CANCEL, /**< A process has been cancelled */
|
||||
LV_EVENT_READY, /**< A process has finished*/
|
||||
LV_EVENT_CANCEL, /**< A process has been cancelled*/
|
||||
|
||||
_LV_EVENT_LAST /** Number of default events*/
|
||||
}lv_event_t;
|
||||
@ -100,32 +100,32 @@ typedef struct {
|
||||
/** Signals are for use by the object itself or to extend the object's functionality.
|
||||
* They determine a widget with a given type should behave.
|
||||
* Applications should use ::lv_obj_set_event_cb to be notified of events that occur
|
||||
* on the object. */
|
||||
* on the object.*/
|
||||
typedef enum {
|
||||
/*General signals*/
|
||||
LV_SIGNAL_CHILD_CHG, /**< Child was removed/added */
|
||||
LV_SIGNAL_COORD_CHG, /**< Object coordinates/size have changed */
|
||||
LV_SIGNAL_STYLE_CHG, /**< Object's style has changed */
|
||||
LV_SIGNAL_CHILD_CHG, /**< Child was removed/added*/
|
||||
LV_SIGNAL_COORD_CHG, /**< Object coordinates/size have changed*/
|
||||
LV_SIGNAL_STYLE_CHG, /**< Object's style has changed*/
|
||||
LV_SIGNAL_BASE_DIR_CHG, /**< The base dir has changed*/
|
||||
LV_SIGNAL_REFR_EXT_DRAW_SIZE, /**< Object's extra padding has changed */
|
||||
LV_SIGNAL_REFR_EXT_DRAW_SIZE, /**< Object's extra padding has changed*/
|
||||
LV_SIGNAL_GET_SELF_SIZE, /**< Get the internal size of a widget*/
|
||||
|
||||
/*Input device related*/
|
||||
LV_SIGNAL_HIT_TEST, /**< Advanced hit-testing */
|
||||
LV_SIGNAL_HIT_TEST, /**< Advanced hit-testing*/
|
||||
LV_SIGNAL_PRESSED, /**< The object has been pressed*/
|
||||
LV_SIGNAL_PRESSING, /**< The object is being pressed (called continuously while pressing)*/
|
||||
LV_SIGNAL_PRESS_LOST, /**< User is still pressing but slid cursor/finger off of the object */
|
||||
LV_SIGNAL_RELEASED, /**< User pressed object for a short period of time, then released it. Not called if scrolled. */
|
||||
LV_SIGNAL_PRESS_LOST, /**< User is still pressing but slid cursor/finger off of the object*/
|
||||
LV_SIGNAL_RELEASED, /**< User pressed object for a short period of time, then released it. Not called if scrolled.*/
|
||||
LV_SIGNAL_LONG_PRESS, /**< Object has been pressed for at least `LV_INDEV_LONG_PRESS_TIME`. Not called if scrolled.*/
|
||||
LV_SIGNAL_LONG_PRESS_REP, /**< Called after `LV_INDEV_LONG_PRESS_TIME` in every `LV_INDEV_LONG_PRESS_REP_TIME` ms. Not called if scrolled.*/
|
||||
LV_SIGNAL_SCROLL_BEGIN, /**< The scrolling has just begun */
|
||||
LV_SIGNAL_SCROLL, /**< The object has been scrolled */
|
||||
LV_SIGNAL_SCROLL_END, /**< The scrolling has ended */
|
||||
LV_SIGNAL_SCROLL_BEGIN, /**< The scrolling has just begun*/
|
||||
LV_SIGNAL_SCROLL, /**< The object has been scrolled*/
|
||||
LV_SIGNAL_SCROLL_END, /**< The scrolling has ended*/
|
||||
LV_SIGNAL_GESTURE, /**< The object has been gesture*/
|
||||
LV_SIGNAL_LEAVE, /**< Another object is clicked or chosen via an input device */
|
||||
LV_SIGNAL_FOCUS, /**< The object was focused */
|
||||
LV_SIGNAL_DEFOCUS, /**< The object was de-focused */
|
||||
LV_SIGNAL_CONTROL, /**< Send a (control) character to the widget */
|
||||
LV_SIGNAL_LEAVE, /**< Another object is clicked or chosen via an input device*/
|
||||
LV_SIGNAL_FOCUS, /**< The object was focused*/
|
||||
LV_SIGNAL_DEFOCUS, /**< The object was de-focused*/
|
||||
LV_SIGNAL_CONTROL, /**< Send a (control) character to the widget*/
|
||||
} lv_signal_t;
|
||||
|
||||
/**
|
||||
@ -155,7 +155,7 @@ enum {
|
||||
LV_STATE_USER_3 = 0x4000,
|
||||
LV_STATE_USER_4 = 0x8000,
|
||||
|
||||
LV_STATE_ANY = 0xFFFF, /**< Special value can be used in some functions to target all states */
|
||||
LV_STATE_ANY = 0xFFFF, /**< Special value can be used in some functions to target all states*/
|
||||
};
|
||||
|
||||
typedef uint16_t lv_state_t;
|
||||
@ -169,8 +169,8 @@ typedef uint16_t lv_state_t;
|
||||
enum {
|
||||
LV_PART_MAIN, /**< A background like rectangle*/
|
||||
LV_PART_SCROLLBAR, /**< The scrollbar(s)*/
|
||||
LV_PART_INDICATOR, /**< Indicator, e.g. for slider, bar, switch, or the tick box of the checkbox */
|
||||
LV_PART_KNOB, /**< Like handle to grab to adjust the value */
|
||||
LV_PART_INDICATOR, /**< Indicator, e.g. for slider, bar, switch, or the tick box of the checkbox*/
|
||||
LV_PART_KNOB, /**< Like handle to grab to adjust the value*/
|
||||
LV_PART_SELECTED, /**< Indicate the currently selected option or section*/
|
||||
LV_PART_ITEMS, /**< Used if the widget has multiple similar elements (e.g. tabel cells)*/
|
||||
LV_PART_TICKS, /**< Ticks on scale e.g. for a chart or meter*/
|
||||
@ -185,7 +185,7 @@ enum {
|
||||
LV_PART_CUSTOM_7, /**< Extension point for custom widgets*/
|
||||
LV_PART_CUSTOM_8, /**< Extension point for custom widgets*/
|
||||
|
||||
LV_PART_ANY = 0xFF, /**< Special value can be used in some functions to target all parts */
|
||||
LV_PART_ANY = 0xFF, /**< Special value can be used in some functions to target all parts*/
|
||||
};
|
||||
|
||||
typedef uint16_t lv_part_t;
|
||||
@ -195,24 +195,24 @@ typedef uint16_t lv_part_t;
|
||||
* OR-ed values are possible
|
||||
*/
|
||||
enum {
|
||||
LV_OBJ_FLAG_HIDDEN = (1 << 0), /**< Make the object hidden. (Like it wasn't there at all) */
|
||||
LV_OBJ_FLAG_CLICKABLE = (1 << 1), /**< Make the object clickable by the input devices */
|
||||
LV_OBJ_FLAG_CLICK_FOCUSABLE = (1 << 2), /**< Add focused state to the object when clicked */
|
||||
LV_OBJ_FLAG_CHECKABLE = (1 << 3), /**< Toggle checked state when the object is clicked */
|
||||
LV_OBJ_FLAG_HIDDEN = (1 << 0), /**< Make the object hidden. (Like it wasn't there at all)*/
|
||||
LV_OBJ_FLAG_CLICKABLE = (1 << 1), /**< Make the object clickable by the input devices*/
|
||||
LV_OBJ_FLAG_CLICK_FOCUSABLE = (1 << 2), /**< Add focused state to the object when clicked*/
|
||||
LV_OBJ_FLAG_CHECKABLE = (1 << 3), /**< Toggle checked state when the object is clicked*/
|
||||
LV_OBJ_FLAG_SCROLLABLE = (1 << 4), /**< Make the object scrollable*/
|
||||
LV_OBJ_FLAG_SCROLL_ELASTIC = (1 << 5), /**< Allow scrolling inside but with slower speed*/
|
||||
LV_OBJ_FLAG_SCROLL_MOMENTUM = (1 << 6), /**< Make the object scroll further when "thrown"*/
|
||||
LV_OBJ_FLAG_SCROLL_ONE = (1 << 7), /**< Allow scrolling only one snapable children*/
|
||||
LV_OBJ_FLAG_SCROLL_CHAIN = (1 << 8), /**< Allow propagating the scroll to a parent */
|
||||
LV_OBJ_FLAG_SCROLL_CHAIN = (1 << 8), /**< Allow propagating the scroll to a parent*/
|
||||
LV_OBJ_FLAG_SCROLL_ON_FOCUS = (1 << 9), /**< Automatically scroll object to make it visible when focused*/
|
||||
LV_OBJ_FLAG_SNAPABLE = (1 << 10), /**< If scroll snap is enabled on the parent it can snap to this object*/
|
||||
LV_OBJ_FLAG_PRESS_LOCK = (1 << 11), /**< Keep the object pressed even if the press slid from the object */
|
||||
LV_OBJ_FLAG_EVENT_BUBBLE = (1 << 12), /**< Propagate the events to the parent too */
|
||||
LV_OBJ_FLAG_GESTURE_BUBBLE = (1 << 13), /**< Propagate the gestures to the parent */
|
||||
LV_OBJ_FLAG_FOCUS_BUBBLE = (1 << 14), /**< Propagate the focus to the parent */
|
||||
LV_OBJ_FLAG_ADV_HITTEST = (1 << 15), /**< Allow performing more accurate hit (click) test. E.g. consider rounded corners. */
|
||||
LV_OBJ_FLAG_IGNORE_LAYOUT = (1 << 16), /**< Make the object position-able by the layouts */
|
||||
LV_OBJ_FLAG_FLOATING = (1 << 17), /**< Do not scroll the object when the parent scrolls and ignore layout */
|
||||
LV_OBJ_FLAG_PRESS_LOCK = (1 << 11), /**< Keep the object pressed even if the press slid from the object*/
|
||||
LV_OBJ_FLAG_EVENT_BUBBLE = (1 << 12), /**< Propagate the events to the parent too*/
|
||||
LV_OBJ_FLAG_GESTURE_BUBBLE = (1 << 13), /**< Propagate the gestures to the parent*/
|
||||
LV_OBJ_FLAG_FOCUS_BUBBLE = (1 << 14), /**< Propagate the focus to the parent*/
|
||||
LV_OBJ_FLAG_ADV_HITTEST = (1 << 15), /**< Allow performing more accurate hit (click) test. E.g. consider rounded corners.*/
|
||||
LV_OBJ_FLAG_IGNORE_LAYOUT = (1 << 16), /**< Make the object position-able by the layouts*/
|
||||
LV_OBJ_FLAG_FLOATING = (1 << 17), /**< Do not scroll the object when the parent scrolls and ignore layout*/
|
||||
|
||||
LV_OBJ_FLAG_LAYOUT_1 = (1 << 23), /** Custom flag, free to use by layouts*/
|
||||
LV_OBJ_FLAG_LAYOUT_2 = (1 << 24), /** Custom flag, free to use by layouts*/
|
||||
@ -246,23 +246,23 @@ extern const lv_obj_class_t lv_obj_class;
|
||||
*/
|
||||
typedef struct {
|
||||
struct _lv_obj_t ** children; /**< Store the pointer of the children in an array.*/
|
||||
uint32_t child_cnt; /**< Number of children */
|
||||
uint32_t child_cnt; /**< Number of children*/
|
||||
lv_group_t * group_p;
|
||||
|
||||
const lv_layout_dsc_t * layout_dsc; /**< Pointer to the layout descriptor*/
|
||||
|
||||
lv_event_dsc_t * event_dsc; /**< Dynamically allocated event callback and user data array */
|
||||
lv_event_dsc_t * event_dsc; /**< Dynamically allocated event callback and user data array*/
|
||||
lv_point_t scroll; /**< The current X/Y scroll offset*/
|
||||
|
||||
uint8_t ext_click_pad; /**< Extra click padding in all direction */
|
||||
lv_coord_t ext_draw_size; /**< EXTend the size in every direction for drawing. */
|
||||
uint8_t ext_click_pad; /**< Extra click padding in all direction*/
|
||||
lv_coord_t ext_draw_size; /**< EXTend the size in every direction for drawing.*/
|
||||
|
||||
lv_scrollbar_mode_t scrollbar_mode :2; /**< How to display scrollbars*/
|
||||
lv_scroll_snap_t scroll_snap_x : 2; /**< Where to align the snapable children horizontally*/
|
||||
lv_scroll_snap_t scroll_snap_y : 2; /**< Where to align the snapable children horizontally*/
|
||||
lv_dir_t scroll_dir :4; /**< The allowed scroll direction(s)*/
|
||||
lv_bidi_dir_t base_dir : 2; /**< Base direction of texts related to this object */
|
||||
uint8_t event_dsc_cnt; /**< Number of event callabcks stored in `event_cb` array */
|
||||
lv_bidi_dir_t base_dir : 2; /**< Base direction of texts related to this object*/
|
||||
uint8_t event_dsc_cnt; /**< Number of event callabcks stored in `event_cb` array*/
|
||||
}lv_obj_spec_attr_t;
|
||||
|
||||
typedef struct _lv_obj_t{
|
||||
@ -554,7 +554,7 @@ bool lv_obj_is_valid(const lv_obj_t * obj);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_H*/
|
||||
|
@ -55,8 +55,8 @@ lv_obj_t * lv_obj_create_from_class(const lv_obj_class_t * class_p, lv_obj_t * p
|
||||
lv_obj_construct(obj, parent, copy);
|
||||
|
||||
if(parent) {
|
||||
/* Send a signal to the parent to notify it about the new child.
|
||||
* Also triggers layout update*/
|
||||
/*Send a signal to the parent to notify it about the new child.
|
||||
*Also triggers layout update*/
|
||||
lv_signal_send(parent, LV_SIGNAL_CHILD_CHG, obj);
|
||||
|
||||
/*Invalidate the area if not screen created*/
|
||||
@ -153,7 +153,7 @@ static uint32_t get_instance_size(const lv_obj_class_t * class_p)
|
||||
const lv_obj_class_t * base = class_p;
|
||||
while(base && base->instance_size == 0) base = base->base_class;
|
||||
|
||||
if(base == NULL) return 0; /*Never happens: set at least in `lv_obj` class */
|
||||
if(base == NULL) return 0; /*Never happens: set at least in `lv_obj` class*/
|
||||
|
||||
return base->instance_size;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ typedef struct _lv_obj_class_t{
|
||||
void (*destructor_cb)(struct _lv_obj_t * obj);
|
||||
lv_signal_cb_t signal_cb; /**< Object type specific signal function*/
|
||||
lv_draw_cb_t draw_cb; /**< Object type specific draw function*/
|
||||
uint32_t editable :2; /**< Value from ::lv_obj_class_editable_t */
|
||||
uint32_t editable :2; /**< Value from ::lv_obj_class_editable_t*/
|
||||
uint32_t instance_size :20;
|
||||
}lv_obj_class_t;
|
||||
|
||||
@ -74,7 +74,7 @@ bool lv_obj_is_editable(struct _lv_obj_t * obj);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_CLASS_H*/
|
||||
|
@ -396,8 +396,8 @@ void lv_obj_refresh_ext_draw_size(lv_obj_t * obj)
|
||||
if(obj->spec_attr) {
|
||||
obj->spec_attr->ext_draw_size = s_new;
|
||||
}
|
||||
/* Allocate spec. attrs. only if the result is not zero.
|
||||
* Zero is the default value if the spec. attr. are not defined. */
|
||||
/*Allocate spec. attrs. only if the result is not zero.
|
||||
*Zero is the default value if the spec. attr. are not defined.*/
|
||||
else if(s_new != 0) {
|
||||
lv_obj_allocate_spec_attr(obj);
|
||||
obj->spec_attr->ext_draw_size = s_new;
|
||||
|
@ -25,9 +25,9 @@ extern "C" {
|
||||
|
||||
struct _lv_obj_t;
|
||||
|
||||
/** Design results */
|
||||
/** Design results*/
|
||||
typedef enum {
|
||||
LV_DRAW_RES_OK, /**< Draw ready */
|
||||
LV_DRAW_RES_OK, /**< Draw ready*/
|
||||
LV_DRAW_RES_COVER, /**< Returned on `LV_DRAW_COVER_CHK` if the areas is fully covered*/
|
||||
LV_DRAW_RES_NOT_COVER, /**< Returned on `LV_DRAW_COVER_CHK` if the areas is not covered*/
|
||||
LV_DRAW_RES_MASKED, /**< Returned on `LV_DRAW_COVER_CHK` if the areas is masked out (children also not cover)*/
|
||||
@ -53,11 +53,11 @@ typedef struct
|
||||
const void * sub_part_ptr;
|
||||
}lv_obj_draw_dsc_t;
|
||||
|
||||
/** Design modes */
|
||||
/** Design modes*/
|
||||
enum {
|
||||
LV_DRAW_MODE_COVER_CHECK, /**< Check if the object fully covers the 'mask_p' area */
|
||||
LV_DRAW_MODE_MAIN_DRAW, /**< Draw the main portion of the object */
|
||||
LV_DRAW_MODE_POST_DRAW, /**< Draw extras on the object */
|
||||
LV_DRAW_MODE_COVER_CHECK, /**< Check if the object fully covers the 'mask_p' area*/
|
||||
LV_DRAW_MODE_MAIN_DRAW, /**< Draw the main portion of the object*/
|
||||
LV_DRAW_MODE_POST_DRAW, /**< Draw extras on the object*/
|
||||
};
|
||||
typedef uint8_t lv_draw_mode_t;
|
||||
|
||||
@ -155,7 +155,7 @@ lv_coord_t _lv_obj_get_ext_draw_size(const struct _lv_obj_t * obj);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_DRAW_H*/
|
||||
|
@ -80,8 +80,8 @@ void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
|
||||
obj->w_set = w;
|
||||
obj->h_set = h;
|
||||
|
||||
/* If the width or height is set to special layout related value save them in w_set and h_set
|
||||
* but use the current size on the object width*/
|
||||
/*If the width or height is set to special layout related value save them in w_set and h_set
|
||||
*but use the current size on the object width*/
|
||||
if(LV_COORD_IS_LAYOUT(w)) w = lv_obj_get_width(obj);
|
||||
if(LV_COORD_IS_LAYOUT(h)) h = lv_obj_get_height(obj);
|
||||
|
||||
@ -187,9 +187,9 @@ void lv_obj_update_layout(lv_obj_t * obj)
|
||||
layout_update_core(obj);
|
||||
}while(scr->layout_inv); /*Repeat until there where layout invalidations*/
|
||||
|
||||
/* Restore the global state because other calls of this function needs this info too.
|
||||
* Other calls might use different start object, but they need to know if there is dirty layout somewhere.
|
||||
* However if the screen was updated it's sure that all layouts are ready. */
|
||||
/*Restore the global state because other calls of this function needs this info too.
|
||||
*Other calls might use different start object, but they need to know if there is dirty layout somewhere.
|
||||
*However if the screen was updated it's sure that all layouts are ready.*/
|
||||
if(obj != scr) scr->layout_inv = 1;
|
||||
|
||||
}
|
||||
@ -472,9 +472,9 @@ void lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, bool notify)
|
||||
diff.x = x - obj->coords.x1;
|
||||
diff.y = y - obj->coords.y1;
|
||||
|
||||
/* Do nothing if the position is not changed */
|
||||
/* It is very important else recursive positioning can
|
||||
* occur without position change*/
|
||||
/*Do nothing if the position is not changed*/
|
||||
/*It is very important else recursive positioning can
|
||||
*occur without position change*/
|
||||
if(diff.x == 0 && diff.y == 0) return;
|
||||
|
||||
/*Invalidate the original area*/
|
||||
@ -490,8 +490,8 @@ void lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, bool notify)
|
||||
if(parent) {
|
||||
lv_obj_get_coords_fit(parent, &parent_fit_area);
|
||||
|
||||
/* If the object is already out of the parent and its position is changes
|
||||
* surely the scrollbars also changes so invalidate them*/
|
||||
/*If the object is already out of the parent and its position is changes
|
||||
*surely the scrollbars also changes so invalidate them*/
|
||||
on1 = _lv_area_is_in(&ori, &parent_fit_area, 0);
|
||||
if(!on1) lv_obj_scrollbar_invalidate(parent);
|
||||
}
|
||||
@ -512,8 +512,8 @@ void lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, bool notify)
|
||||
/*Invalidate the new area*/
|
||||
lv_obj_invalidate(obj);
|
||||
|
||||
/* If the object was out of the parent invalidate the new scrollbar area too.
|
||||
* If it wasn't out of the parent but out now, also invalidate the srollbars*/
|
||||
/*If the object was out of the parent invalidate the new scrollbar area too.
|
||||
*If it wasn't out of the parent but out now, also invalidate the srollbars*/
|
||||
if(parent) {
|
||||
bool on2 = _lv_area_is_in(&obj->coords, &parent_fit_area, 0);
|
||||
if(on1 || (!on1 && on2)) lv_obj_scrollbar_invalidate(parent);
|
||||
@ -677,13 +677,13 @@ static bool refr_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
if(parent == NULL) return false;
|
||||
|
||||
/* If the size is managed by the layout don't let to overwrite it.*/
|
||||
/*If the size is managed by the layout don't let to overwrite it.*/
|
||||
if(obj->w_set == LV_SIZE_LAYOUT) w = lv_obj_get_width(obj);
|
||||
if(obj->h_set == LV_SIZE_LAYOUT) h = lv_obj_get_height(obj);
|
||||
|
||||
/* Do nothing if the size is not changed */
|
||||
/* It is very important else recursive resizing can
|
||||
* occur without size change*/
|
||||
/*Do nothing if the size is not changed*/
|
||||
/*It is very important else recursive resizing can
|
||||
*occur without size change*/
|
||||
if(lv_obj_get_width(obj) == w && lv_obj_get_height(obj) == h) {
|
||||
return false;
|
||||
}
|
||||
@ -698,13 +698,13 @@ static bool refr_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
|
||||
lv_area_t parent_fit_area;
|
||||
lv_obj_get_coords_fit(parent, &parent_fit_area);
|
||||
|
||||
/* If the object is already out of the parent and its position is changes
|
||||
* surely the scrollbars also changes so invalidate them*/
|
||||
/*If the object is already out of the parent and its position is changes
|
||||
*surely the scrollbars also changes so invalidate them*/
|
||||
bool on1 = _lv_area_is_in(&ori, &parent_fit_area, 0);
|
||||
if(!on1) lv_obj_scrollbar_invalidate(parent);
|
||||
|
||||
/* Set the length and height
|
||||
* Be sure the content is not scrolled in an invalid position on the new size*/
|
||||
/*Set the length and height
|
||||
*Be sure the content is not scrolled in an invalid position on the new size*/
|
||||
obj->coords.y2 = obj->coords.y1 + h - 1;
|
||||
if(lv_obj_get_base_dir(obj) == LV_BIDI_DIR_RTL) {
|
||||
obj->coords.x1 = obj->coords.x2 - w + 1;
|
||||
@ -722,8 +722,8 @@ static bool refr_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
|
||||
/*Invalidate the new area*/
|
||||
lv_obj_invalidate(obj);
|
||||
|
||||
/* If the object was out of the parent invalidate the new scrollbar area too.
|
||||
* If it wasn't out of the parent but out now, also invalidate the srollbars*/
|
||||
/*If the object was out of the parent invalidate the new scrollbar area too.
|
||||
*If it wasn't out of the parent but out now, also invalidate the srollbars*/
|
||||
bool on2 = _lv_area_is_in(&obj->coords, &parent_fit_area, 0);
|
||||
if(on1 || (!on1 && on2)) lv_obj_scrollbar_invalidate(parent);
|
||||
return true;
|
||||
|
@ -327,7 +327,7 @@ bool lv_obj_hit_test(struct _lv_obj_t * obj, const lv_point_t * point);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_POS_H*/
|
||||
|
@ -158,8 +158,8 @@ lv_coord_t lv_obj_get_scroll_left(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
/* Normally can't scroll the object out on the left.
|
||||
* So simply use the current scroll position as "left size"*/
|
||||
/*Normally can't scroll the object out on the left.
|
||||
*So simply use the current scroll position as "left size"*/
|
||||
if(lv_obj_get_base_dir(obj) != LV_BIDI_DIR_RTL) {
|
||||
if(obj->spec_attr == NULL) return 0;
|
||||
return -obj->spec_attr->scroll.x;
|
||||
@ -196,8 +196,8 @@ lv_coord_t lv_obj_get_scroll_right(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
/* With RTL base dir can't scroll to the object out on the right.
|
||||
* So simply use the current scroll position as "right size"*/
|
||||
/*With RTL base dir can't scroll to the object out on the right.
|
||||
*So simply use the current scroll position as "right size"*/
|
||||
if(lv_obj_get_base_dir(obj) == LV_BIDI_DIR_RTL) {
|
||||
if(obj->spec_attr == NULL) return 0;
|
||||
return obj->spec_attr->scroll.x;
|
||||
@ -636,7 +636,7 @@ static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_p
|
||||
break;
|
||||
}
|
||||
|
||||
/* Remove any pending scroll animations.*/
|
||||
/*Remove any pending scroll animations.*/
|
||||
lv_anim_del(parent, scroll_x_anim);
|
||||
lv_anim_del(parent, scroll_y_anim);
|
||||
|
||||
|
@ -24,7 +24,7 @@ extern "C" {
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/* Can't include lv_obj.h because it includes this header file */
|
||||
/*Can't include lv_obj.h because it includes this header file*/
|
||||
struct _lv_obj_t;
|
||||
|
||||
/** Scrollbar modes: shows when should the scrollbars be visible*/
|
||||
@ -37,12 +37,12 @@ enum {
|
||||
typedef uint8_t lv_scrollbar_mode_t;
|
||||
|
||||
|
||||
/** Scroll span align options. Tells where to align the snapable children when scroll stops. */
|
||||
/** Scroll span align options. Tells where to align the snapable children when scroll stops.*/
|
||||
enum {
|
||||
LV_SCROLL_SNAP_NONE, /**< Do not align, leave where it is */
|
||||
LV_SCROLL_SNAP_START, /**< Align to to the left/top */
|
||||
LV_SCROLL_SNAP_END, /**< Align to to the right/bottom */
|
||||
LV_SCROLL_SNAP_CENTER /**< Align to to the center */
|
||||
LV_SCROLL_SNAP_NONE, /**< Do not align, leave where it is*/
|
||||
LV_SCROLL_SNAP_START, /**< Align to to the left/top*/
|
||||
LV_SCROLL_SNAP_END, /**< Align to to the right/bottom*/
|
||||
LV_SCROLL_SNAP_CENTER /**< Align to to the center*/
|
||||
};
|
||||
typedef uint8_t lv_scroll_snap_t;
|
||||
|
||||
@ -271,7 +271,7 @@ void lv_obj_scrollbar_invalidate(struct _lv_obj_t * obj);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_SCROLL_H*/
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#if defined(LV_GC_INCLUDE)
|
||||
#include LV_GC_INCLUDE
|
||||
#endif /* LV_ENABLE_GC */
|
||||
#endif /*LV_ENABLE_GC*/
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@ -89,7 +89,7 @@ void lv_obj_add_style(struct _lv_obj_t * obj, uint32_t part, uint32_t state, lv_
|
||||
break;
|
||||
}
|
||||
|
||||
/*Now `i` is at the first normal style. Insert the new style before this */
|
||||
/*Now `i` is at the first normal style. Insert the new style before this*/
|
||||
|
||||
/*Allocate space for the new style and shift the rest of the style to the end*/
|
||||
obj->style_list.style_cnt++;
|
||||
@ -141,8 +141,8 @@ void lv_obj_remove_style(lv_obj_t * obj, uint32_t part, uint32_t state, lv_style
|
||||
obj->style_list.styles = lv_mem_realloc(obj->style_list.styles, obj->style_list.style_cnt * sizeof(lv_obj_style_t));
|
||||
|
||||
deleted = true;
|
||||
/* The style from the current `i` index is removed, so `i` points to the next style.
|
||||
* Therefore it doesn't needs to be incremented*/
|
||||
/*The style from the current `i` index is removed, so `i` points to the next style.
|
||||
*Therefore it doesn't needs to be incremented*/
|
||||
}
|
||||
if(deleted) {
|
||||
lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL);
|
||||
@ -266,7 +266,7 @@ void _lv_obj_style_create_transition(lv_obj_t * obj, lv_style_prop_t prop, uint8
|
||||
obj->state = new_state;
|
||||
|
||||
lv_obj_style_t * style_trans = get_trans_style(obj, part);
|
||||
lv_style_set_prop(style_trans->style, prop, v1); /*Be sure `trans_style` has a valid value */
|
||||
lv_style_set_prop(style_trans->style, prop, v1); /*Be sure `trans_style` has a valid value*/
|
||||
|
||||
if(prop == LV_STYLE_RADIUS) {
|
||||
if(v1.num == LV_RADIUS_CIRCLE || v2.num == LV_RADIUS_CIRCLE) {
|
||||
@ -419,8 +419,8 @@ static lv_style_t * get_local_style(lv_obj_t * obj, uint32_t part, uint32_t stat
|
||||
obj->style_list.styles = lv_mem_realloc(obj->style_list.styles, obj->style_list.style_cnt * sizeof(lv_obj_style_t));
|
||||
|
||||
for(i = obj->style_list.style_cnt - 1; i > 0 ; i--) {
|
||||
/* Copy only normal styles (not local and transition).
|
||||
* The new local style will be added as the last local style*/
|
||||
/*Copy only normal styles (not local and transition).
|
||||
*The new local style will be added as the last local style*/
|
||||
if(obj->style_list.styles[i - 1].is_local || obj->style_list.styles[i - 1].is_trans) break;
|
||||
obj->style_list.styles[i] = obj->style_list.styles[i - 1];
|
||||
}
|
||||
@ -497,8 +497,8 @@ static bool get_prop_core(const lv_obj_t * obj, uint8_t part, lv_style_prop_t pr
|
||||
|
||||
if((obj_style->style->has_group & group) == 0) continue;
|
||||
|
||||
/* Be sure the style not specifies other state than the requested.
|
||||
* E.g. For HOVER+PRESS object state, HOVER style only is OK, but HOVER+FOCUS style is not*/
|
||||
/*Be sure the style not specifies other state than the requested.
|
||||
*E.g. For HOVER+PRESS object state, HOVER style only is OK, but HOVER+FOCUS style is not*/
|
||||
if((obj_style->state & state_inv)) continue;
|
||||
|
||||
/*Check only better candidates*/
|
||||
@ -598,8 +598,8 @@ static bool trans_del(lv_obj_t * obj, uint8_t part, lv_style_prop_t prop, trans_
|
||||
tr_prev = _lv_ll_get_prev(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr);
|
||||
|
||||
if(tr->obj == obj && (part == tr->part || part == LV_PART_ANY) && (prop == tr->prop || prop == LV_STYLE_PROP_ALL)) {
|
||||
/* Remove the transitioned property from trans. style
|
||||
* to allow changing it by normal styles*/
|
||||
/*Remove the transitioned property from trans. style
|
||||
*to allow changing it by normal styles*/
|
||||
uint32_t i;
|
||||
for(i = 0; i < obj->style_list.style_cnt; i++) {
|
||||
if(obj->style_list.styles[i].is_trans && (part == LV_PART_ANY || obj->style_list.styles[i].part == part)) {
|
||||
@ -695,7 +695,7 @@ static void trans_anim_start_cb(lv_anim_t * a)
|
||||
tr->prop = prop_tmp;
|
||||
|
||||
lv_obj_style_t * style_trans = get_trans_style(tr->obj, tr->part);
|
||||
lv_style_set_prop(style_trans->style, tr->prop, tr->start_value); /*Be sure `trans_style` has a valid value */
|
||||
lv_style_set_prop(style_trans->style, tr->prop, tr->start_value); /*Be sure `trans_style` has a valid value*/
|
||||
|
||||
}
|
||||
|
||||
@ -705,9 +705,9 @@ static void trans_anim_ready_cb(lv_anim_t * a)
|
||||
lv_obj_t * obj = tr->obj;
|
||||
lv_style_prop_t prop = tr->prop;
|
||||
|
||||
/* Remove the transitioned property from trans. style
|
||||
* if there no more transitions for this property
|
||||
* It allows changing it by normal styles*/
|
||||
/*Remove the transitioned property from trans. style
|
||||
*if there no more transitions for this property
|
||||
*It allows changing it by normal styles*/
|
||||
bool running = false;
|
||||
trans_t * tr_i;
|
||||
_LV_LL_READ(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr_i) {
|
||||
|
@ -23,7 +23,7 @@ extern "C" {
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
/* Can't include lv_obj.h because it includes this header file */
|
||||
/*Can't include lv_obj.h because it includes this header file*/
|
||||
struct _lv_obj_t;
|
||||
|
||||
typedef enum {
|
||||
@ -212,7 +212,7 @@ static inline void lv_obj_set_style_pad_gap(struct _lv_obj_t * obj, uint32_t par
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_TEMPL_H*/
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#if defined(LV_USER_DATA_FREE_INCLUDE)
|
||||
#include LV_USER_DATA_FREE_INCLUDE
|
||||
#endif /* LV_USE_USER_DATA_FREE */
|
||||
#endif /*LV_USE_USER_DATA_FREE*/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -349,7 +349,7 @@ static void obj_del_core(lv_obj_t * obj)
|
||||
lv_obj_remove_style(obj, LV_PART_ANY, LV_STATE_ANY, NULL);
|
||||
lv_obj_enable_style_refresh(true);
|
||||
|
||||
/* Reset all input devices if the object to delete is used*/
|
||||
/*Reset all input devices if the object to delete is used*/
|
||||
lv_indev_t * indev = lv_indev_get_next(NULL);
|
||||
while(indev) {
|
||||
if(indev->proc.types.pointer.act_obj == obj || indev->proc.types.pointer.last_obj == obj) {
|
||||
@ -365,7 +365,7 @@ static void obj_del_core(lv_obj_t * obj)
|
||||
indev = lv_indev_get_next(indev);
|
||||
}
|
||||
|
||||
/* All children deleted. Now clean up the object specific data*/
|
||||
/*All children deleted. Now clean up the object specific data*/
|
||||
_lv_obj_destruct(obj);
|
||||
|
||||
/*Remove the screen for the screen list*/
|
||||
|
@ -141,7 +141,7 @@ uint32_t lv_obj_get_child_id(const struct _lv_obj_t * obj);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_TREE_H*/
|
||||
|
@ -25,7 +25,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
/* Draw translucent random colored areas on the invalidated (redrawn) areas*/
|
||||
/*Draw translucent random colored areas on the invalidated (redrawn) areas*/
|
||||
#define MASK_AREA_DEBUG 0
|
||||
|
||||
/**********************
|
||||
@ -192,7 +192,8 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
|
||||
disp_refr = tmr->user_data;
|
||||
|
||||
#if LV_USE_PERF_MONITOR == 0
|
||||
/* Ensure the timer does not run again automatically.
|
||||
/**
|
||||
* Ensure the timer does not run again automatically.
|
||||
* This is done before refreshing in case refreshing invalidates something else.
|
||||
*/
|
||||
lv_timer_pause(tmr, true);
|
||||
@ -561,8 +562,8 @@ static void lv_refr_area_part(const lv_area_t * area_p)
|
||||
lv_refr_obj_and_children(lv_disp_get_layer_top(disp_refr), &start_mask);
|
||||
lv_refr_obj_and_children(lv_disp_get_layer_sys(disp_refr), &start_mask);
|
||||
|
||||
/* In true double buffered mode flush only once when all areas were rendered.
|
||||
* In normal mode flush after every area */
|
||||
/*In true double buffered mode flush only once when all areas were rendered.
|
||||
*In normal mode flush after every area*/
|
||||
if(lv_disp_is_true_double_buf(disp_refr) == false) {
|
||||
draw_buf_flush();
|
||||
}
|
||||
@ -578,7 +579,7 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
|
||||
{
|
||||
lv_obj_t * found_p = NULL;
|
||||
|
||||
/*If this object is fully cover the draw area check the children too */
|
||||
/*If this object is fully cover the draw area check the children too*/
|
||||
if(_lv_area_is_in(area_p, &obj->coords, 0) && lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN) == false) {
|
||||
lv_draw_res_t draw_res = call_draw_cb(obj, area_p, LV_DRAW_MODE_COVER_CHECK);
|
||||
if(draw_res == LV_DRAW_RES_MASKED) return NULL;
|
||||
@ -622,16 +623,16 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
|
||||
*/
|
||||
static void lv_refr_obj_and_children(lv_obj_t * top_p, const lv_area_t * mask_p)
|
||||
{
|
||||
/* Normally always will be a top_obj (at least the screen)
|
||||
* but in special cases (e.g. if the screen has alpha) it won't.
|
||||
* In this case use the screen directly */
|
||||
/*Normally always will be a top_obj (at least the screen)
|
||||
*but in special cases (e.g. if the screen has alpha) it won't.
|
||||
*In this case use the screen directly*/
|
||||
if(top_p == NULL) top_p = lv_disp_get_scr_act(disp_refr);
|
||||
if(top_p == NULL) return; /*Shouldn't happen*/
|
||||
|
||||
/*Refresh the top object and its children*/
|
||||
lv_refr_obj(top_p, mask_p);
|
||||
|
||||
/*Draw the 'younger' sibling objects because they can be on top_obj */
|
||||
/*Draw the 'younger' sibling objects because they can be on top_obj*/
|
||||
lv_obj_t * par;
|
||||
lv_obj_t * border_p = top_p;
|
||||
|
||||
@ -674,9 +675,9 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
|
||||
/*Do not refresh hidden objects*/
|
||||
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN)) return;
|
||||
|
||||
bool union_ok; /* Store the return value of area_union */
|
||||
/* Truncate the original mask to the coordinates of the parent
|
||||
* because the parent and its children are visible only here */
|
||||
bool union_ok; /*Store the return value of area_union*/
|
||||
/*Truncate the original mask to the coordinates of the parent
|
||||
*because the parent and its children are visible only here*/
|
||||
lv_area_t obj_mask;
|
||||
lv_area_t obj_ext_mask;
|
||||
lv_area_t obj_area;
|
||||
@ -690,7 +691,7 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
|
||||
|
||||
/*Draw the parent and its children only if they ore on 'mask_parent'*/
|
||||
if(union_ok != false) {
|
||||
/* Redraw the object */
|
||||
/*Redraw the object*/
|
||||
lv_event_send(obj, LV_EVENT_DRAW_MAIN_BEGIN, &obj_ext_mask);
|
||||
call_draw_cb(obj, &obj_ext_mask, LV_DRAW_MODE_MAIN_DRAW);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_MAIN_END, &obj_ext_mask);
|
||||
@ -721,11 +722,11 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
|
||||
child_area.y1 -= ext_size;
|
||||
child_area.x2 += ext_size;
|
||||
child_area.y2 += ext_size;
|
||||
/* Get the union (common parts) of original mask (from obj)
|
||||
* and its child */
|
||||
/*Get the union (common parts) of original mask (from obj)
|
||||
*and its child*/
|
||||
union_ok = _lv_area_intersect(&mask_child, &obj_mask, &child_area);
|
||||
|
||||
/*If the parent and the child has common area then refresh the child */
|
||||
/*If the parent and the child has common area then refresh the child*/
|
||||
if(union_ok) {
|
||||
/*Refresh the next children*/
|
||||
lv_refr_obj(child, &mask_child);
|
||||
@ -733,7 +734,7 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
|
||||
}
|
||||
}
|
||||
|
||||
/* If all the children are redrawn make 'post draw' draw */
|
||||
/*If all the children are redrawn make 'post draw' draw*/
|
||||
lv_event_send(obj, LV_EVENT_DRAW_POST_BEGIN, &obj_ext_mask);
|
||||
call_draw_cb(obj, &obj_ext_mask, LV_DRAW_MODE_POST_DRAW);
|
||||
lv_event_send(obj, LV_EVENT_DRAW_POST_END, &obj_ext_mask);
|
||||
@ -744,7 +745,7 @@ static void draw_buf_rotate_180(lv_disp_drv_t *drv, lv_area_t *area, lv_color_t
|
||||
lv_coord_t area_w = lv_area_get_width(area);
|
||||
lv_coord_t area_h = lv_area_get_height(area);
|
||||
uint32_t total = area_w * area_h;
|
||||
/* Swap the beginning and end values */
|
||||
/*Swap the beginning and end values*/
|
||||
lv_color_t tmp;
|
||||
uint32_t i = total - 1, j = 0;
|
||||
while(i > j) {
|
||||
@ -835,7 +836,7 @@ static void draw_buf_rotate(lv_area_t *area, lv_color_t *color_p) {
|
||||
draw_buf_rotate_180(drv, area, color_p);
|
||||
call_flush_cb(drv, area, color_p);
|
||||
} else if(drv->rotated == LV_DISP_ROT_90 || drv->rotated == LV_DISP_ROT_270) {
|
||||
/*Allocate a temporary buffer to store rotated image */
|
||||
/*Allocate a temporary buffer to store rotated image*/
|
||||
lv_color_t * rot_buf = NULL;
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp_refr);
|
||||
lv_coord_t area_w = lv_area_get_width(area);
|
||||
|
@ -97,7 +97,7 @@ void _lv_disp_refr_timer(lv_timer_t * timer);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_REFR_H*/
|
||||
|
@ -114,7 +114,7 @@ lv_color_t lv_theme_get_color_secondary(lv_obj_t * obj);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_THEME_H*/
|
||||
|
@ -53,7 +53,7 @@ extern "C" {
|
||||
*********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_H*/
|
||||
|
@ -16,7 +16,7 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define SPLIT_RADIUS_LIMIT 10 /*With radius greater then this the arc will drawn in quarters. A quarter is drawn only if there is arc in it */
|
||||
#define SPLIT_RADIUS_LIMIT 10 /*With radius greater then this the arc will drawn in quarters. A quarter is drawn only if there is arc in it*/
|
||||
#define SPLIT_ANGLE_GAP_LIMIT 60 /*With small gaps in the arc don't bother with splitting because there is nothing to skip.*/
|
||||
|
||||
/**********************
|
||||
@ -515,7 +515,7 @@ static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t thickness
|
||||
cir_x = ((radius - thick_half) * lv_trigo_sin(90 - angle)) >> (LV_TRIGO_SHIFT - ps);
|
||||
cir_y = ((radius - thick_half) * lv_trigo_sin(angle)) >> (LV_TRIGO_SHIFT - ps);
|
||||
|
||||
/* Actually the center of the pixel need to be calculated so apply 1/2 px offset*/
|
||||
/*Actually the center of the pixel need to be calculated so apply 1/2 px offset*/
|
||||
if(cir_x > 0) {
|
||||
cir_x = (cir_x - pa) >> ps;
|
||||
res_area->x1 = cir_x - thick_half + thick_corr;
|
||||
|
@ -70,7 +70,7 @@ void lv_draw_arc_get_area(lv_coord_t x, lv_coord_t y, uint16_t radius, uint16_t
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_ARC*/
|
||||
|
@ -138,15 +138,15 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_fill(const lv_area_t * clip_area, const lv_
|
||||
|
||||
if(disp->driver->gpu_wait_cb) disp->driver->gpu_wait_cb(disp->driver);
|
||||
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
/*Get clipped fill area which is the real draw area.
|
||||
*It is always the same or inside `fill_area`*/
|
||||
lv_area_t draw_area;
|
||||
bool is_common;
|
||||
is_common = _lv_area_intersect(&draw_area, clip_area, fill_area);
|
||||
if(!is_common) return;
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
/*Now `draw_area` has absolute coordinates.
|
||||
*Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
draw_area.y1 -= disp_area->y1;
|
||||
draw_area.x2 -= disp_area->x1;
|
||||
@ -194,8 +194,8 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_a
|
||||
if(opa < LV_OPA_MIN) return;
|
||||
if(mask_res == LV_DRAW_MASK_RES_TRANSP) return;
|
||||
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
/*Get clipped fill area which is the real draw area.
|
||||
*It is always the same or inside `fill_area`*/
|
||||
lv_area_t draw_area;
|
||||
bool is_common;
|
||||
is_common = _lv_area_intersect(&draw_area, clip_area, map_area);
|
||||
@ -208,8 +208,8 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_a
|
||||
|
||||
if(disp->driver->gpu_wait_cb) disp->driver->gpu_wait_cb(disp->driver);
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
/*Now `draw_area` has absolute coordinates.
|
||||
*Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
draw_area.y1 -= disp_area->y1;
|
||||
draw_area.x2 -= disp_area->x1;
|
||||
@ -260,9 +260,9 @@ static void fill_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, con
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* The mask is relative to the clipped area.
|
||||
* In the cycles below mask will be indexed from `draw_area.x1`
|
||||
* but it corresponds to zero index. So prepare `mask_tmp` accordingly. */
|
||||
/*The mask is relative to the clipped area.
|
||||
*In the cycles below mask will be indexed from `draw_area.x1`
|
||||
*but it corresponds to zero index. So prepare `mask_tmp` accordingly.*/
|
||||
const lv_opa_t * mask_tmp = mask - draw_area->x1;
|
||||
|
||||
/*Get the width of the `draw_area` it will be used to go to the next line of the mask*/
|
||||
@ -326,7 +326,7 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
|
||||
if(lv_gpu_nxp_vglite_fill(disp_buf, disp_w, lv_area_get_height(disp_area), draw_area, color, opa) == LV_RES_OK) {
|
||||
return;
|
||||
}
|
||||
/* Fall down to SW render in case of error */
|
||||
/*Fall down to SW render in case of error*/
|
||||
}
|
||||
#elif LV_USE_GPU_STM32_DMA2D
|
||||
if(lv_area_get_size(draw_area) >= 240) {
|
||||
@ -358,7 +358,7 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
|
||||
if(lv_gpu_nxp_vglite_fill(disp_buf, disp_w, lv_area_get_height(disp_area), draw_area, color, opa) == LV_RES_OK) {
|
||||
return;
|
||||
}
|
||||
/* Fall down to SW render in case of error */
|
||||
/*Fall down to SW render in case of error*/
|
||||
}
|
||||
#endif
|
||||
lv_color_t last_dest_color = lv_color_black();
|
||||
@ -558,9 +558,9 @@ static void fill_blended(const lv_area_t * disp_area, lv_color_t * disp_buf, co
|
||||
/*Get the width of the `draw_area` it will be used to go to the next line of the mask*/
|
||||
int32_t draw_area_w = lv_area_get_width(draw_area);
|
||||
|
||||
/* The mask is relative to the clipped area.
|
||||
* In the cycles below mask will be indexed from `draw_area.x1`
|
||||
* but it corresponds to zero index. So prepare `mask_tmp` accordingly. */
|
||||
/*The mask is relative to the clipped area.
|
||||
*In the cycles below mask will be indexed from `draw_area.x1`
|
||||
*but it corresponds to zero index. So prepare `mask_tmp` accordingly.*/
|
||||
const lv_opa_t * mask_tmp = mask - draw_area->x1;
|
||||
|
||||
/*Buffer the result color to avoid recalculating the same color*/
|
||||
@ -622,9 +622,9 @@ static void map_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, cons
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* The mask is relative to the clipped area.
|
||||
* In the cycles below mask will be indexed from `draw_area.x1`
|
||||
* but it corresponds to zero index. So prepare `mask_tmp` accordingly. */
|
||||
/*The mask is relative to the clipped area.
|
||||
*In the cycles below mask will be indexed from `draw_area.x1`
|
||||
*but it corresponds to zero index. So prepare `mask_tmp` accordingly.*/
|
||||
const lv_opa_t * mask_tmp = mask - draw_area->x1;
|
||||
|
||||
for(y = draw_area->y1; y <= draw_area->y2; y++) {
|
||||
@ -718,7 +718,7 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
|
||||
if(lv_gpu_nxp_vglite_blit(&blit) == LV_RES_OK) {
|
||||
return;
|
||||
}
|
||||
/* Fall down to SW render in case of error */
|
||||
/*Fall down to SW render in case of error*/
|
||||
}
|
||||
#elif LV_USE_GPU_STM32_DMA2D
|
||||
if(lv_area_get_size(draw_area) >= 240) {
|
||||
@ -768,7 +768,7 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
|
||||
if(lv_gpu_nxp_vglite_blit(&blit) == LV_RES_OK) {
|
||||
return;
|
||||
}
|
||||
/* Fall down to SW render in case of error */
|
||||
/*Fall down to SW render in case of error*/
|
||||
}
|
||||
#elif LV_USE_GPU_STM32_DMA2D
|
||||
if(lv_area_get_size(draw_area) >= 240) {
|
||||
@ -801,7 +801,7 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
|
||||
else {
|
||||
/*Only the mask matters*/
|
||||
if(opa > LV_OPA_MAX) {
|
||||
/*Go to the first pixel of the row */
|
||||
/*Go to the first pixel of the row*/
|
||||
|
||||
int32_t x_end4 = draw_area_w - 4;
|
||||
|
||||
@ -941,9 +941,9 @@ static void map_blended(const lv_area_t * disp_area, lv_color_t * disp_buf, con
|
||||
}
|
||||
/*Masked*/
|
||||
else {
|
||||
/* The mask is relative to the clipped area.
|
||||
* In the cycles below mask will be indexed from `draw_area.x1`
|
||||
* but it corresponds to zero index. So prepare `mask_tmp` accordingly. */
|
||||
/*The mask is relative to the clipped area.
|
||||
*In the cycles below mask will be indexed from `draw_area.x1`
|
||||
*but it corresponds to zero index. So prepare `mask_tmp` accordingly.*/
|
||||
const lv_opa_t * mask_tmp = mask - draw_area->x1;
|
||||
|
||||
map_buf_tmp -= draw_area->x1;
|
||||
|
@ -44,7 +44,7 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_a
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_BLEND_H*/
|
||||
|
@ -248,8 +248,8 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
||||
|
||||
show_error(coords, clip_area, cdsc->dec_dsc.error_msg);
|
||||
}
|
||||
/* The decoder could open the image and gave the entire uncompressed image.
|
||||
* Just draw it!*/
|
||||
/*The decoder could open the image and gave the entire uncompressed image.
|
||||
*Just draw it!*/
|
||||
else if(cdsc->dec_dsc.img_data) {
|
||||
lv_area_t map_area_rot;
|
||||
lv_area_copy(&map_area_rot, coords);
|
||||
@ -276,7 +276,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
||||
|
||||
lv_draw_map(coords, &mask_com, cdsc->dec_dsc.img_data, draw_dsc, chroma_keyed, alpha_byte);
|
||||
}
|
||||
/* The whole uncompressed image is not available. Try to read it line-by-line*/
|
||||
/*The whole uncompressed image is not available. Try to read it line-by-line*/
|
||||
else {
|
||||
lv_area_t mask_com; /*Common area of mask and coords*/
|
||||
bool union_ok;
|
||||
@ -339,7 +339,7 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
const lv_draw_img_dsc_t * draw_dsc,
|
||||
bool chroma_key, bool alpha_byte)
|
||||
{
|
||||
/* Use the clip area as draw area*/
|
||||
/*Use the clip area as draw area*/
|
||||
lv_area_t draw_area;
|
||||
lv_area_copy(&draw_area, clip_area);
|
||||
|
||||
@ -347,8 +347,8 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp);
|
||||
const lv_area_t * disp_area = &draw_buf->area;
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
/*Now `draw_area` has absolute coordinates.
|
||||
*Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
draw_area.y1 -= disp_area->y1;
|
||||
draw_area.x2 -= disp_area->x1;
|
||||
@ -365,16 +365,16 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
#if LV_DRAW_COMPLEX
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
/* Simple case without masking and transformations */
|
||||
/*Simple case without masking and transformations*/
|
||||
else if(other_mask_cnt == 0 && draw_dsc->angle == 0 && draw_dsc->zoom == LV_IMG_ZOOM_NONE && alpha_byte == false &&
|
||||
chroma_key == true && draw_dsc->recolor_opa == LV_OPA_TRANSP) { /* copy with color keying (+ alpha) */
|
||||
chroma_key == true && draw_dsc->recolor_opa == LV_OPA_TRANSP) { /*copy with color keying (+ alpha)*/
|
||||
lv_gpu_nxp_pxp_enable_color_key();
|
||||
_lv_blend_map(clip_area, map_area, (lv_color_t *)map_p, NULL, LV_DRAW_MASK_RES_FULL_COVER, draw_dsc->opa,
|
||||
draw_dsc->blend_mode);
|
||||
lv_gpu_nxp_pxp_disable_color_key();
|
||||
}
|
||||
else if(other_mask_cnt == 0 && draw_dsc->angle == 0 && draw_dsc->zoom == LV_IMG_ZOOM_NONE && alpha_byte == false &&
|
||||
chroma_key == false && draw_dsc->recolor_opa != LV_OPA_TRANSP) { /* copy with recolor (+ alpha) */
|
||||
chroma_key == false && draw_dsc->recolor_opa != LV_OPA_TRANSP) { /*copy with recolor (+ alpha)*/
|
||||
lv_gpu_nxp_pxp_enable_recolor(draw_dsc->recolor, draw_dsc->recolor_opa);
|
||||
_lv_blend_map(clip_area, map_area, (lv_color_t *)map_p, NULL, LV_DRAW_MASK_RES_FULL_COVER, draw_dsc->opa,
|
||||
draw_dsc->blend_mode);
|
||||
|
@ -90,7 +90,7 @@ bool lv_img_cf_is_chroma_keyed(lv_img_cf_t cf);
|
||||
bool lv_img_cf_has_alpha(lv_img_cf_t cf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_IMG_H*/
|
||||
|
@ -274,10 +274,10 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
||||
cmd_state = CMD_STATE_PAR;
|
||||
continue;
|
||||
}
|
||||
else if(cmd_state == CMD_STATE_PAR) { /*Other start char in parameter escaped cmd. char */
|
||||
else if(cmd_state == CMD_STATE_PAR) { /*Other start char in parameter escaped cmd. char*/
|
||||
cmd_state = CMD_STATE_WAIT;
|
||||
}
|
||||
else if(cmd_state == CMD_STATE_IN) { /*Command end */
|
||||
else if(cmd_state == CMD_STATE_IN) { /*Command end*/
|
||||
cmd_state = CMD_STATE_WAIT;
|
||||
continue;
|
||||
}
|
||||
@ -413,21 +413,21 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_letter(const lv_point_t * pos_p, const
|
||||
lv_font_glyph_dsc_t g;
|
||||
bool g_ret = lv_font_get_glyph_dsc(font_p, &g, letter, '\0');
|
||||
if(g_ret == false) {
|
||||
/* Add warning if the dsc is not found
|
||||
* but do not print warning for non printable ASCII chars (e.g. '\n')*/
|
||||
/*Add warning if the dsc is not found
|
||||
*but do not print warning for non printable ASCII chars (e.g. '\n')*/
|
||||
if(letter >= 0x20) {
|
||||
LV_LOG_WARN("lv_draw_letter: glyph dsc. not found");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* Don't draw anything if the character is empty. E.g. space */
|
||||
/*Don't draw anything if the character is empty. E.g. space*/
|
||||
if((g.box_h == 0) || (g.box_w == 0)) return;
|
||||
|
||||
int32_t pos_x = pos_p->x + g.ofs_x;
|
||||
int32_t pos_y = pos_p->y + (font_p->line_height - font_p->base_line) - g.box_h - g.ofs_y;
|
||||
|
||||
/*If the letter is completely out of mask don't draw it */
|
||||
/*If the letter is completely out of mask don't draw it*/
|
||||
if(pos_x + g.box_w < clip_area->x1 ||
|
||||
pos_x > clip_area->x2 ||
|
||||
pos_y + g.box_h < clip_area->y1 ||
|
||||
@ -509,7 +509,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_
|
||||
int32_t box_h = g->box_h;
|
||||
int32_t width_bit = box_w * bpp; /*Letter width in bits*/
|
||||
|
||||
/* Calculate the col/row start/end on the map*/
|
||||
/*Calculate the col/row start/end on the map*/
|
||||
int32_t col_start = pos_x >= clip_area->x1 ? 0 : clip_area->x1 - pos_x;
|
||||
int32_t col_end = pos_x + box_w <= clip_area->x2 ? box_w : clip_area->x2 - pos_x + 1;
|
||||
int32_t row_start = pos_y >= clip_area->y1 ? 0 : clip_area->y1 - pos_y;
|
||||
@ -521,7 +521,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_
|
||||
|
||||
uint8_t letter_px;
|
||||
uint32_t col_bit;
|
||||
col_bit = bit_ofs & 0x7; /* "& 0x7" equals to "% 8" just faster */
|
||||
col_bit = bit_ofs & 0x7; /*"& 0x7" equals to "% 8" just faster*/
|
||||
|
||||
lv_coord_t hor_res = lv_disp_get_hor_res(_lv_refr_get_disp_refreshing());
|
||||
uint32_t mask_buf_size = box_w * box_h > hor_res ? hor_res : box_w * box_h;
|
||||
@ -649,7 +649,7 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
|
||||
int32_t box_h = g->box_h;
|
||||
int32_t width_bit = box_w * bpp; /*Letter width in bits*/
|
||||
|
||||
/* Calculate the col/row start/end on the map*/
|
||||
/*Calculate the col/row start/end on the map*/
|
||||
int32_t col_start = pos_x >= clip_area->x1 ? 0 : (clip_area->x1 - pos_x) * 3;
|
||||
int32_t col_end = pos_x + box_w / 3 <= clip_area->x2 ? box_w : (clip_area->x2 - pos_x + 1) * 3;
|
||||
int32_t row_start = pos_y >= clip_area->y1 ? 0 : clip_area->y1 - pos_y;
|
||||
@ -662,7 +662,7 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
|
||||
uint8_t letter_px;
|
||||
lv_opa_t px_opa;
|
||||
int32_t col_bit;
|
||||
col_bit = bit_ofs & 0x7; /* "& 0x7" equals to "% 8" just faster */
|
||||
col_bit = bit_ofs & 0x7; /*"& 0x7" equals to "% 8" just faster*/
|
||||
|
||||
int32_t mask_buf_size = box_w * box_h > _LV_MASK_BUF_MAX_SIZE ? _LV_MASK_BUF_MAX_SIZE : g->box_w * g->box_h;
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(mask_buf_size);
|
||||
|
@ -59,7 +59,7 @@ typedef struct {
|
||||
int32_t y;
|
||||
|
||||
/** The 'y1' coordinate of the label when the hint was saved.
|
||||
* Used to invalidate the hint if the label has moved too much. */
|
||||
* Used to invalidate the hint if the label has moved too much.*/
|
||||
int32_t coord_y;
|
||||
} lv_draw_label_hint_t;
|
||||
|
||||
@ -99,7 +99,7 @@ extern const uint8_t _lv_bpp8_opa_table[];
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_LABEL_H*/
|
||||
|
@ -152,14 +152,14 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp);
|
||||
const lv_area_t * disp_area = &draw_buf->area;
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
/*Get clipped fill area which is the real draw area.
|
||||
*It is always the same or inside `fill_area`*/
|
||||
bool is_common;
|
||||
is_common = _lv_area_intersect(&draw_area, clip, &draw_area);
|
||||
if(!is_common) return;
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
/*Now `draw_area` has absolute coordinates.
|
||||
*Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
draw_area.y1 -= disp_area->y1;
|
||||
draw_area.x2 -= disp_area->x1;
|
||||
@ -253,14 +253,14 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp);
|
||||
const lv_area_t * disp_area = &draw_buf->area;
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
/*Get clipped fill area which is the real draw area.
|
||||
*It is always the same or inside `fill_area`*/
|
||||
bool is_common;
|
||||
is_common = _lv_area_intersect(&draw_area, clip, &draw_area);
|
||||
if(!is_common) return;
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
/*Now `draw_area` has absolute coordinates.
|
||||
*Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= draw_buf->area.x1;
|
||||
draw_area.y1 -= draw_buf->area.y1;
|
||||
draw_area.x2 -= draw_buf->area.x1;
|
||||
@ -361,9 +361,9 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, cons
|
||||
draw_area.y1 = LV_MIN(p1.y, p2.y) - w;
|
||||
draw_area.y2 = LV_MAX(p1.y, p2.y) + w;
|
||||
|
||||
/* Get the union of `coords` and `clip`*/
|
||||
/* `clip` is already truncated to the `draw_buf` size
|
||||
* in 'lv_refr_area' function */
|
||||
/*Get the union of `coords` and `clip`*/
|
||||
/*`clip` is already truncated to the `draw_buf` size
|
||||
*in 'lv_refr_area' function*/
|
||||
bool is_common = _lv_area_intersect(&draw_area, &draw_area, clip);
|
||||
if(is_common == false) return;
|
||||
|
||||
@ -412,15 +412,15 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, cons
|
||||
|
||||
const lv_area_t * disp_area = &draw_buf->area;
|
||||
|
||||
/*Store the coordinates of the `draw_a` relative to the draw_buf */
|
||||
/*Store the coordinates of the `draw_a` relative to the draw_buf*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
draw_area.y1 -= disp_area->y1;
|
||||
draw_area.x2 -= disp_area->x1;
|
||||
draw_area.y2 -= disp_area->y1;
|
||||
|
||||
/* The real draw area is around the line.
|
||||
* It's easy to calculate with steep lines, but the area can be very wide with very flat lines.
|
||||
* So deal with it only with steep lines. */
|
||||
/*The real draw area is around the line.
|
||||
*It's easy to calculate with steep lines, but the area can be very wide with very flat lines.
|
||||
*So deal with it only with steep lines.*/
|
||||
int32_t draw_area_w = lv_area_get_width(&draw_area);
|
||||
|
||||
/*Draw the background line by line*/
|
||||
|
@ -58,7 +58,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_LINE_H*/
|
||||
|
@ -282,10 +282,10 @@ void lv_draw_mask_line_points_init(lv_draw_mask_line_param_t * param, lv_coord_t
|
||||
void lv_draw_mask_line_angle_init(lv_draw_mask_line_param_t * param, lv_coord_t p1x, lv_coord_t py, int16_t angle,
|
||||
lv_draw_mask_line_side_t side)
|
||||
{
|
||||
/* Find an optimal degree.
|
||||
* lv_mask_line_points_init will swap the points to keep the smaller y in p1
|
||||
* Theoretically a line with `angle` or `angle+180` is the same only the points are swapped
|
||||
* Find the degree which keeps the origo in place */
|
||||
/*Find an optimal degree.
|
||||
*lv_mask_line_points_init will swap the points to keep the smaller y in p1
|
||||
*Theoretically a line with `angle` or `angle+180` is the same only the points are swapped
|
||||
*Find the degree which keeps the origo in place*/
|
||||
if(angle > 180) angle -= 180; /*> 180 will swap the origo*/
|
||||
|
||||
int32_t p2x;
|
||||
@ -311,7 +311,7 @@ void lv_draw_mask_angle_init(lv_draw_mask_angle_param_t * param, lv_coord_t vert
|
||||
lv_draw_mask_line_side_t start_side;
|
||||
lv_draw_mask_line_side_t end_side;
|
||||
|
||||
/* Constrain the input angles */
|
||||
/*Constrain the input angles*/
|
||||
if(start_angle < 0)
|
||||
start_angle = 0;
|
||||
else if(start_angle > 359)
|
||||
@ -345,7 +345,7 @@ void lv_draw_mask_angle_init(lv_draw_mask_angle_param_t * param, lv_coord_t vert
|
||||
start_side = LV_DRAW_MASK_LINE_SIDE_RIGHT;
|
||||
}
|
||||
else
|
||||
start_side = LV_DRAW_MASK_LINE_SIDE_RIGHT; /* silence compiler */
|
||||
start_side = LV_DRAW_MASK_LINE_SIDE_RIGHT; /*silence compiler*/
|
||||
|
||||
LV_ASSERT_MSG(end_angle >= 0 && start_angle <= 360, "Unexpected end angle");
|
||||
|
||||
@ -356,7 +356,7 @@ void lv_draw_mask_angle_init(lv_draw_mask_angle_param_t * param, lv_coord_t vert
|
||||
end_side = LV_DRAW_MASK_LINE_SIDE_LEFT;
|
||||
}
|
||||
else
|
||||
end_side = LV_DRAW_MASK_LINE_SIDE_RIGHT; /* silence compiler */
|
||||
end_side = LV_DRAW_MASK_LINE_SIDE_RIGHT; /*silence compiler*/
|
||||
|
||||
lv_draw_mask_line_angle_init(¶m->start_line, vertex_x, vertex_y, start_angle, start_side);
|
||||
lv_draw_mask_line_angle_init(¶m->end_line, vertex_x, vertex_y, end_angle, end_side);
|
||||
@ -514,8 +514,8 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_b
|
||||
}
|
||||
}
|
||||
|
||||
/* At the end of the mask if the limit line is smaller then the mask's y.
|
||||
* Then the mask is in the "good" area*/
|
||||
/*At the end of the mask if the limit line is smaller then the mask's y.
|
||||
*Then the mask is in the "good" area*/
|
||||
y_at_x = (int32_t)((int32_t)p->yx_steep * (abs_x + len)) >> 10;
|
||||
if(p->yx_steep > 0) {
|
||||
if(y_at_x < abs_y) {
|
||||
@ -607,8 +607,8 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_
|
||||
{
|
||||
int32_t k;
|
||||
int32_t x_at_y;
|
||||
/* At the beginning of the mask if the limit line is greater then the mask's y.
|
||||
* Then the mask is in the "wrong" area*/
|
||||
/*At the beginning of the mask if the limit line is greater then the mask's y.
|
||||
*Then the mask is in the "wrong" area*/
|
||||
x_at_y = (int32_t)((int32_t)p->xy_steep * abs_y) >> 10;
|
||||
if(p->xy_steep > 0) x_at_y++;
|
||||
if(x_at_y < abs_x) {
|
||||
@ -620,8 +620,8 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_
|
||||
}
|
||||
}
|
||||
|
||||
/* At the end of the mask if the limit line is smaller then the mask's y.
|
||||
* Then the mask is in the "good" area*/
|
||||
/*At the end of the mask if the limit line is smaller then the mask's y.
|
||||
*Then the mask is in the "good" area*/
|
||||
x_at_y = (int32_t)((int32_t)p->xy_steep * (abs_y)) >> 10;
|
||||
if(x_at_y > abs_x + len) {
|
||||
if(p->inv) {
|
||||
@ -758,7 +758,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * ma
|
||||
return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
}
|
||||
|
||||
/*Start angle mask can work only from the end of end angle mask */
|
||||
/*Start angle mask can work only from the end of end angle mask*/
|
||||
int32_t end_angle_first = (rel_y * p->end_line.xy_steep) >> 10;
|
||||
int32_t start_angle_last = ((rel_y + 1) * p->start_line.xy_steep) >> 10;
|
||||
|
||||
@ -800,7 +800,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * ma
|
||||
return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
}
|
||||
|
||||
/*Start angle mask can work only from the end of end angle mask */
|
||||
/*Start angle mask can work only from the end of end angle mask*/
|
||||
int32_t end_angle_first = (rel_y * p->end_line.xy_steep) >> 10;
|
||||
int32_t start_angle_last = ((rel_y + 1) * p->start_line.xy_steep) >> 10;
|
||||
|
||||
@ -950,14 +950,14 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
|
||||
lv_sqrt_res_t x0;
|
||||
lv_sqrt_res_t x1;
|
||||
/* y = 0 should mean the top of the circle */
|
||||
/*y = 0 should mean the top of the circle*/
|
||||
int32_t y;
|
||||
if(abs_y < radius) {
|
||||
y = radius - abs_y;
|
||||
|
||||
/* Get the x intersection points for `abs_y` and `abs_y-1`
|
||||
* Use the circle's equation x = sqrt(r^2 - y^2)
|
||||
* Try to use the values from the previous run*/
|
||||
/*Get the x intersection points for `abs_y` and `abs_y-1`
|
||||
*Use the circle's equation x = sqrt(r^2 - y^2)
|
||||
*Try to use the values from the previous run*/
|
||||
if(y == p->y_prev) {
|
||||
x0.f = p->y_prev_x.f;
|
||||
x0.i = p->y_prev_x.i;
|
||||
@ -973,9 +973,9 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
else {
|
||||
y = radius - (h - abs_y) + 1;
|
||||
|
||||
/* Get the x intersection points for `abs_y` and `abs_y-1`
|
||||
* Use the circle's equation x = sqrt(r^2 - y^2)
|
||||
* Try to use the values from the previous run*/
|
||||
/*Get the x intersection points for `abs_y` and `abs_y-1`
|
||||
*Use the circle's equation x = sqrt(r^2 - y^2)
|
||||
*Try to use the values from the previous run*/
|
||||
if((y - 1) == p->y_prev) {
|
||||
x1.f = p->y_prev_x.f;
|
||||
x1.i = p->y_prev_x.i;
|
||||
@ -990,8 +990,8 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
p->y_prev_x.i = x0.i;
|
||||
}
|
||||
|
||||
/* If x1 is on the next round coordinate (e.g. x0: 3.5, x1:4.0)
|
||||
* then treat x1 as x1: 3.99 to handle them as they were on the same pixel*/
|
||||
/*If x1 is on the next round coordinate (e.g. x0: 3.5, x1:4.0)
|
||||
*then treat x1 as x1: 3.99 to handle them as they were on the same pixel*/
|
||||
if(x0.i == x1.i - 1 && x1.f == 0) {
|
||||
x1.i--;
|
||||
x1.f = 0xFF;
|
||||
@ -1089,8 +1089,8 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
|
||||
/*Set all points which are crossed by the circle*/
|
||||
for(; i <= x1.i; i++) {
|
||||
/* These values are very close to each other. It's enough to approximate sqrt
|
||||
* The non-approximated version is lv_sqrt(r2 - (i * i), &y_next, sqrt_mask); */
|
||||
/*These values are very close to each other. It's enough to approximate sqrt
|
||||
*The non-approximated version is lv_sqrt(r2 - (i * i), &y_next, sqrt_mask);*/
|
||||
sqrt_approx(&y_next, &y_prev, r2 - (i * i));
|
||||
|
||||
m = (y_prev.f + y_next.f) >> 1;
|
||||
|
@ -99,7 +99,7 @@ typedef struct {
|
||||
lv_draw_mask_common_dsc_t dsc;
|
||||
|
||||
struct {
|
||||
/*First point */
|
||||
/*First point*/
|
||||
lv_point_t p1;
|
||||
|
||||
/*Second point*/
|
||||
@ -112,23 +112,23 @@ typedef struct {
|
||||
/*A point of the line*/
|
||||
lv_point_t origo;
|
||||
|
||||
/* X / (1024*Y) steepness (X is 0..1023 range). What is the change of X in 1024 Y?*/
|
||||
/*X / (1024*Y) steepness (X is 0..1023 range). What is the change of X in 1024 Y?*/
|
||||
int32_t xy_steep;
|
||||
|
||||
/* Y / (1024*X) steepness (Y is 0..1023 range). What is the change of Y in 1024 X?*/
|
||||
/*Y / (1024*X) steepness (Y is 0..1023 range). What is the change of Y in 1024 X?*/
|
||||
int32_t yx_steep;
|
||||
|
||||
/*Helper which stores yx_steep for flat lines and xy_steep for steep (non flat) lines */
|
||||
/*Helper which stores yx_steep for flat lines and xy_steep for steep (non flat) lines*/
|
||||
int32_t steep;
|
||||
|
||||
/*Steepness in 1 px in 0..255 range. Used only by flat lines. */
|
||||
/*Steepness in 1 px in 0..255 range. Used only by flat lines.*/
|
||||
int32_t spx;
|
||||
|
||||
/*1: It's a flat line? (Near to horizontal)*/
|
||||
uint8_t flat : 1;
|
||||
|
||||
/* Invert the mask. The default is: Keep the left part.
|
||||
* It is used to select left/right/top/bottom*/
|
||||
/*Invert the mask. The default is: Keep the left part.
|
||||
*It is used to select left/right/top/bottom*/
|
||||
uint8_t inv: 1;
|
||||
} lv_draw_mask_line_param_t;
|
||||
|
||||
@ -154,7 +154,7 @@ typedef struct {
|
||||
struct {
|
||||
lv_area_t rect;
|
||||
lv_coord_t radius;
|
||||
/* Invert the mask. 0: Keep the pixels inside.*/
|
||||
/*Invert the mask. 0: Keep the pixels inside.*/
|
||||
uint8_t outer: 1;
|
||||
} cfg;
|
||||
int32_t y_prev;
|
||||
@ -318,7 +318,7 @@ void lv_draw_mask_map_init(lv_draw_mask_map_param_t * param, const lv_area_t * c
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_MASK_H*/
|
||||
|
@ -142,8 +142,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp);
|
||||
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
/*Get clipped fill area which is the real draw area.
|
||||
*It is always the same or inside `fill_area`*/
|
||||
lv_area_t draw_area;
|
||||
bool is_common;
|
||||
is_common = _lv_area_intersect(&draw_area, &coords_bg, clip);
|
||||
@ -151,8 +151,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
|
||||
const lv_area_t * disp_area = &draw_buf->area;
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
/*Now `draw_area` has absolute coordinates.
|
||||
*Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
draw_area.y1 -= disp_area->y1;
|
||||
draw_area.x2 -= disp_area->x1;
|
||||
@ -251,8 +251,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
grad_color = grad_get(dsc, lv_area_get_height(&coords_bg), y - coords_bg.y1);
|
||||
}
|
||||
|
||||
/* If there is not other mask and drawing the corner area split the drawing to corner and middle areas
|
||||
* because it the middle mask shouldn't be taken into account (therefore its faster)*/
|
||||
/*If there is not other mask and drawing the corner area split the drawing to corner and middle areas
|
||||
*because it the middle mask shouldn't be taken into account (therefore its faster)*/
|
||||
if(simple_mode && split &&
|
||||
(y < coords_bg.y1 + rout + 1 ||
|
||||
y > coords_bg.y2 - rout - 1)) {
|
||||
@ -423,8 +423,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp);
|
||||
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
/*Get clipped fill area which is the real draw area.
|
||||
*It is always the same or inside `fill_area`*/
|
||||
lv_area_t draw_area;
|
||||
bool is_common;
|
||||
is_common = _lv_area_intersect(&draw_area, coords, clip);
|
||||
@ -432,8 +432,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
|
||||
|
||||
const lv_area_t * disp_area = &draw_buf->area;
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
/*Now `draw_area` has absolute coordinates.
|
||||
*Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
draw_area.y1 -= disp_area->y1;
|
||||
draw_area.x2 -= disp_area->x1;
|
||||
@ -554,8 +554,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp);
|
||||
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
/*Get clipped fill area which is the real draw area.
|
||||
*It is always the same or inside `fill_area`*/
|
||||
lv_area_t draw_area;
|
||||
bool is_common;
|
||||
is_common = _lv_area_intersect(&draw_area, &sh_area, clip);
|
||||
@ -563,8 +563,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
|
||||
const lv_area_t * disp_area = &draw_buf->area;
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
/*Now `draw_area` has absolute coordinates.
|
||||
*Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
draw_area.y1 -= disp_area->y1;
|
||||
draw_area.x2 -= disp_area->x1;
|
||||
@ -598,7 +598,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
lv_memcpy(sh_buf, sh_cache, corner_size * corner_size);
|
||||
}
|
||||
else {
|
||||
/*A larger buffer is required for calculation */
|
||||
/*A larger buffer is required for calculation*/
|
||||
sh_buf = lv_mem_buf_get(corner_size * corner_size * sizeof(uint16_t));
|
||||
shadow_draw_corner_buf(&sh_rect_area, (uint16_t *)sh_buf, dsc->shadow_width, r_sh);
|
||||
|
||||
@ -1288,8 +1288,8 @@ static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * are
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp);
|
||||
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
/*Get clipped fill area which is the real draw area.
|
||||
*It is always the same or inside `fill_area`*/
|
||||
lv_area_t draw_area;
|
||||
bool is_common;
|
||||
is_common = _lv_area_intersect(&draw_area, area_outer, clip);
|
||||
@ -1297,8 +1297,8 @@ static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * are
|
||||
|
||||
const lv_area_t * disp_area = &draw_buf->area;
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
* Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
/*Now `draw_area` has absolute coordinates.
|
||||
*Make it relative to `disp_area` to simplify draw to `disp_buf`*/
|
||||
draw_area.x1 -= disp_area->x1;
|
||||
draw_area.y1 -= disp_area->y1;
|
||||
draw_area.x2 -= disp_area->x1;
|
||||
@ -1364,7 +1364,7 @@ static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * are
|
||||
fill_area.y2++;
|
||||
}
|
||||
|
||||
/*Draw the lower corner area */
|
||||
/*Draw the lower corner area*/
|
||||
int32_t lower_corner_end = area_outer->y2 - disp_area->y1 - corner_size;
|
||||
if(lower_corner_end <= upper_corner_end) lower_corner_end = upper_corner_end + 1;
|
||||
fill_area.y1 = disp_area->y1 + lower_corner_end;
|
||||
|
@ -50,7 +50,7 @@ typedef struct {
|
||||
lv_color_t border_color;
|
||||
lv_coord_t border_width;
|
||||
lv_opa_t border_opa;
|
||||
uint8_t border_post : 1; /*There is a border it will be drawn later. */
|
||||
uint8_t border_post : 1; /*There is a border it will be drawn later.*/
|
||||
lv_border_side_t border_side :5;
|
||||
|
||||
/*Outline*/
|
||||
@ -109,7 +109,7 @@ void lv_draw_rect(const lv_area_t * coords, const lv_area_t * mask, const lv_dra
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_RECT_H*/
|
||||
|
@ -78,7 +78,7 @@ void lv_draw_polygon(const lv_point_t points[], uint16_t point_cnt, const lv_are
|
||||
pcnt++;
|
||||
}
|
||||
}
|
||||
/*The first and the last points are also adjacent */
|
||||
/*The first and the last points are also adjacent*/
|
||||
if(points[0].x != points[point_cnt - 1].x || points[0].y != points[point_cnt - 1].y) {
|
||||
p[pcnt] = points[point_cnt - 1];
|
||||
pcnt++;
|
||||
@ -133,7 +133,8 @@ void lv_draw_polygon(const lv_point_t points[], uint16_t point_cnt, const lv_are
|
||||
i_next_right = y_min_i + 1;
|
||||
if(i_next_right > point_cnt - 1) i_next_right = 0;
|
||||
|
||||
/* Check if the order of points is inverted or not.
|
||||
/**
|
||||
* Check if the order of points is inverted or not.
|
||||
* The normal case is when the left point is on `y_min_i - 1`
|
||||
* Explanation:
|
||||
* if angle(p_left) < angle(p_right) -> inverted
|
||||
|
@ -50,7 +50,7 @@ void lv_draw_polygon(const lv_point_t points[], uint16_t point_cnt, const lv_are
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_TRIANGLE_H*/
|
||||
|
@ -67,9 +67,9 @@ lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t
|
||||
uint8_t bit = x & 0x7;
|
||||
x = x >> 3;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
|
||||
* so the possible real width are 8, 16, 24 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
|
||||
*so the possible real width are 8, 16, 24 ...*/
|
||||
uint32_t px = ((dsc->header.w + 7) >> 3) * y + x;
|
||||
p_color.full = (buf_u8[px] & (1 << (7 - bit))) >> (7 - bit);
|
||||
}
|
||||
@ -78,9 +78,9 @@ lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t
|
||||
uint8_t bit = (x & 0x3) * 2;
|
||||
x = x >> 2;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 3 means rounding up to 4 because the lines are byte aligned
|
||||
* so the possible real width are 4, 8, 12 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 3 means rounding up to 4 because the lines are byte aligned
|
||||
*so the possible real width are 4, 8, 12 ...*/
|
||||
uint32_t px = ((dsc->header.w + 3) >> 2) * y + x;
|
||||
p_color.full = (buf_u8[px] & (3 << (6 - bit))) >> (6 - bit);
|
||||
}
|
||||
@ -89,9 +89,9 @@ lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t
|
||||
uint8_t bit = (x & 0x1) * 4;
|
||||
x = x >> 1;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 1 means rounding up to 2 because the lines are byte aligned
|
||||
* so the possible real width are 2, 4, 6 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 1 means rounding up to 2 because the lines are byte aligned
|
||||
*so the possible real width are 2, 4, 6 ...*/
|
||||
uint32_t px = ((dsc->header.w + 1) >> 1) * y + x;
|
||||
p_color.full = (buf_u8[px] & (0xF << (4 - bit))) >> (4 - bit);
|
||||
}
|
||||
@ -127,9 +127,9 @@ lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y)
|
||||
uint8_t bit = x & 0x7;
|
||||
x = x >> 3;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
|
||||
* so the possible real width are 8 ,16, 24 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
|
||||
*so the possible real width are 8 ,16, 24 ...*/
|
||||
uint32_t px = ((dsc->header.w + 7) >> 3) * y + x;
|
||||
uint8_t px_opa = (buf_u8[px] & (1 << (7 - bit))) >> (7 - bit);
|
||||
return px_opa ? LV_OPA_TRANSP : LV_OPA_COVER;
|
||||
@ -140,9 +140,9 @@ lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y)
|
||||
uint8_t bit = (x & 0x3) * 2;
|
||||
x = x >> 2;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 4 means rounding up to 8 because the lines are byte aligned
|
||||
* so the possible real width are 4 ,8, 12 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 4 means rounding up to 8 because the lines are byte aligned
|
||||
*so the possible real width are 4 ,8, 12 ...*/
|
||||
uint32_t px = ((dsc->header.w + 3) >> 2) * y + x;
|
||||
uint8_t px_opa = (buf_u8[px] & (3 << (6 - bit))) >> (6 - bit);
|
||||
return opa_table[px_opa];
|
||||
@ -155,9 +155,9 @@ lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y)
|
||||
uint8_t bit = (x & 0x1) * 4;
|
||||
x = x >> 1;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 1 means rounding up to 8 because the lines are byte aligned
|
||||
* so the possible real width are 2 ,4, 6 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 1 means rounding up to 8 because the lines are byte aligned
|
||||
*so the possible real width are 2 ,4, 6 ...*/
|
||||
uint32_t px = ((dsc->header.w + 1) >> 1) * y + x;
|
||||
uint8_t px_opa = (buf_u8[px] & (0xF << (4 - bit))) >> (4 - bit);
|
||||
return opa_table[px_opa];
|
||||
@ -192,9 +192,9 @@ void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
|
||||
uint8_t bit = x & 0x7;
|
||||
x = x >> 3;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
|
||||
* so the possible real width are 8 ,16, 24 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
|
||||
*so the possible real width are 8 ,16, 24 ...*/
|
||||
uint32_t px = ((dsc->header.w + 7) >> 3) * y + x;
|
||||
buf_u8[px] = buf_u8[px] & ~(1 << (7 - bit));
|
||||
buf_u8[px] = buf_u8[px] | ((opa & 0x1) << (7 - bit));
|
||||
@ -204,9 +204,9 @@ void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
|
||||
uint8_t bit = (x & 0x3) * 2;
|
||||
x = x >> 2;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 4 means rounding up to 8 because the lines are byte aligned
|
||||
* so the possible real width are 4 ,8, 12 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 4 means rounding up to 8 because the lines are byte aligned
|
||||
*so the possible real width are 4 ,8, 12 ...*/
|
||||
uint32_t px = ((dsc->header.w + 3) >> 2) * y + x;
|
||||
buf_u8[px] = buf_u8[px] & ~(3 << (6 - bit));
|
||||
buf_u8[px] = buf_u8[px] | ((opa & 0x3) << (6 - bit));
|
||||
@ -216,9 +216,9 @@ void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
|
||||
uint8_t bit = (x & 0x1) * 4;
|
||||
x = x >> 1;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 1 means rounding up to 8 because the lines are byte aligned
|
||||
* so the possible real width are 2 ,4, 6 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 1 means rounding up to 8 because the lines are byte aligned
|
||||
*so the possible real width are 2 ,4, 6 ...*/
|
||||
uint32_t px = ((dsc->header.w + 1) >> 1) * y + x;
|
||||
buf_u8[px] = buf_u8[px] & ~(0xF << (4 - bit));
|
||||
buf_u8[px] = buf_u8[px] | ((opa & 0xF) << (4 - bit));
|
||||
@ -257,9 +257,9 @@ void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
|
||||
uint8_t bit = x & 0x7;
|
||||
x = x >> 3;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
|
||||
* so the possible real width are 8 ,16, 24 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 7 means rounding up to 8 because the lines are byte aligned
|
||||
*so the possible real width are 8 ,16, 24 ...*/
|
||||
uint32_t px = ((dsc->header.w + 7) >> 3) * y + x;
|
||||
buf_u8[px] = buf_u8[px] & ~(1 << (7 - bit));
|
||||
buf_u8[px] = buf_u8[px] | ((c.full & 0x1) << (7 - bit));
|
||||
@ -269,9 +269,9 @@ void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
|
||||
uint8_t bit = (x & 0x3) * 2;
|
||||
x = x >> 2;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 3 means rounding up to 4 because the lines are byte aligned
|
||||
* so the possible real width are 4, 8 ,12 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 3 means rounding up to 4 because the lines are byte aligned
|
||||
*so the possible real width are 4, 8 ,12 ...*/
|
||||
uint32_t px = ((dsc->header.w + 3) >> 2) * y + x;
|
||||
|
||||
buf_u8[px] = buf_u8[px] & ~(3 << (6 - bit));
|
||||
@ -282,9 +282,9 @@ void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
|
||||
uint8_t bit = (x & 0x1) * 4;
|
||||
x = x >> 1;
|
||||
|
||||
/* Get the current pixel.
|
||||
* dsc->header.w + 1 means rounding up to 2 because the lines are byte aligned
|
||||
* so the possible real width are 2 ,4, 6 ...*/
|
||||
/*Get the current pixel.
|
||||
*dsc->header.w + 1 means rounding up to 2 because the lines are byte aligned
|
||||
*so the possible real width are 2 ,4, 6 ...*/
|
||||
uint32_t px = ((dsc->header.w + 1) >> 1) * y + x;
|
||||
buf_u8[px] = buf_u8[px] & ~(0xF << (4 - bit));
|
||||
buf_u8[px] = buf_u8[px] | ((c.full & 0xF) << (4 - bit));
|
||||
@ -329,21 +329,21 @@ void lv_img_buf_set_palette(lv_img_dsc_t * dsc, uint8_t id, lv_color_t c)
|
||||
*/
|
||||
lv_img_dsc_t * lv_img_buf_alloc(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)
|
||||
{
|
||||
/* Allocate image descriptor */
|
||||
/*Allocate image descriptor*/
|
||||
lv_img_dsc_t * dsc = lv_mem_alloc(sizeof(lv_img_dsc_t));
|
||||
if(dsc == NULL)
|
||||
return NULL;
|
||||
|
||||
lv_memset_00(dsc, sizeof(lv_img_dsc_t));
|
||||
|
||||
/* Get image data size */
|
||||
/*Get image data size*/
|
||||
dsc->data_size = lv_img_buf_get_img_size(w, h, cf);
|
||||
if(dsc->data_size == 0) {
|
||||
lv_mem_free(dsc);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Allocate raw buffer */
|
||||
/*Allocate raw buffer*/
|
||||
dsc->data = lv_mem_alloc(dsc->data_size);
|
||||
if(dsc->data == NULL) {
|
||||
lv_mem_free(dsc);
|
||||
@ -351,7 +351,7 @@ lv_img_dsc_t * lv_img_buf_alloc(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)
|
||||
}
|
||||
lv_memset_00((uint8_t *)dsc->data, dsc->data_size);
|
||||
|
||||
/* Fill in header */
|
||||
/*Fill in header*/
|
||||
dsc->header.always_zero = 0;
|
||||
dsc->header.w = w;
|
||||
dsc->header.h = h;
|
||||
@ -453,8 +453,8 @@ void _lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc)
|
||||
dsc->tmp.img_dsc.header.w = dsc->cfg.src_w;
|
||||
dsc->tmp.img_dsc.header.h = dsc->cfg.src_h;
|
||||
|
||||
/* The inverse of the zoom will be sued during the transformation
|
||||
* + dsc->cfg.zoom / 2 for rounding*/
|
||||
/*The inverse of the zoom will be sued during the transformation
|
||||
* + dsc->cfg.zoom / 2 for rounding*/
|
||||
dsc->tmp.zoom_inv = (((256 * 256) << _LV_ZOOM_INV_UPSCALE) + dsc->cfg.zoom / 2) / dsc->cfg.zoom;
|
||||
|
||||
dsc->res.opa = LV_OPA_COVER;
|
||||
|
@ -77,35 +77,36 @@ enum {
|
||||
LV_IMG_CF_ALPHA_4BIT, /**< Can have one color but 16 different alpha value*/
|
||||
LV_IMG_CF_ALPHA_8BIT, /**< Can have one color but 256 different alpha value*/
|
||||
|
||||
LV_IMG_CF_RESERVED_15, /**< Reserved for further use. */
|
||||
LV_IMG_CF_RESERVED_16, /**< Reserved for further use. */
|
||||
LV_IMG_CF_RESERVED_17, /**< Reserved for further use. */
|
||||
LV_IMG_CF_RESERVED_18, /**< Reserved for further use. */
|
||||
LV_IMG_CF_RESERVED_19, /**< Reserved for further use. */
|
||||
LV_IMG_CF_RESERVED_20, /**< Reserved for further use. */
|
||||
LV_IMG_CF_RESERVED_21, /**< Reserved for further use. */
|
||||
LV_IMG_CF_RESERVED_22, /**< Reserved for further use. */
|
||||
LV_IMG_CF_RESERVED_23, /**< Reserved for further use. */
|
||||
LV_IMG_CF_RESERVED_15, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_16, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_17, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_18, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_19, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_20, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_21, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_22, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_23, /**< Reserved for further use.*/
|
||||
|
||||
LV_IMG_CF_USER_ENCODED_0, /**< User holder encoding format. */
|
||||
LV_IMG_CF_USER_ENCODED_1, /**< User holder encoding format. */
|
||||
LV_IMG_CF_USER_ENCODED_2, /**< User holder encoding format. */
|
||||
LV_IMG_CF_USER_ENCODED_3, /**< User holder encoding format. */
|
||||
LV_IMG_CF_USER_ENCODED_4, /**< User holder encoding format. */
|
||||
LV_IMG_CF_USER_ENCODED_5, /**< User holder encoding format. */
|
||||
LV_IMG_CF_USER_ENCODED_6, /**< User holder encoding format. */
|
||||
LV_IMG_CF_USER_ENCODED_7, /**< User holder encoding format. */
|
||||
LV_IMG_CF_USER_ENCODED_0, /**< User holder encoding format.*/
|
||||
LV_IMG_CF_USER_ENCODED_1, /**< User holder encoding format.*/
|
||||
LV_IMG_CF_USER_ENCODED_2, /**< User holder encoding format.*/
|
||||
LV_IMG_CF_USER_ENCODED_3, /**< User holder encoding format.*/
|
||||
LV_IMG_CF_USER_ENCODED_4, /**< User holder encoding format.*/
|
||||
LV_IMG_CF_USER_ENCODED_5, /**< User holder encoding format.*/
|
||||
LV_IMG_CF_USER_ENCODED_6, /**< User holder encoding format.*/
|
||||
LV_IMG_CF_USER_ENCODED_7, /**< User holder encoding format.*/
|
||||
};
|
||||
typedef uint8_t lv_img_cf_t;
|
||||
|
||||
/**
|
||||
* LVGL image header
|
||||
*/
|
||||
/* The first 8 bit is very important to distinguish the different source types.
|
||||
/**
|
||||
* The first 8 bit is very important to distinguish the different source types.
|
||||
* For more info see `lv_img_get_src_type()` in lv_img.c
|
||||
* On big endian systems the order is reversed so cf and always_zero must be at
|
||||
* the end of the struct.
|
||||
* */
|
||||
*/
|
||||
#if LV_BIG_ENDIAN_SYSTEM
|
||||
typedef struct {
|
||||
|
||||
@ -114,13 +115,13 @@ typedef struct {
|
||||
uint32_t reserved : 2; /*Reserved to be used later*/
|
||||
uint32_t always_zero : 3; /*It the upper bits of the first byte. Always zero to look like a
|
||||
non-printable character*/
|
||||
uint32_t cf : 5; /* Color format: See `lv_img_color_format_t`*/
|
||||
uint32_t cf : 5; /*Color format: See `lv_img_color_format_t`*/
|
||||
|
||||
} lv_img_header_t;
|
||||
#else
|
||||
typedef struct {
|
||||
|
||||
uint32_t cf : 5; /* Color format: See `lv_img_color_format_t`*/
|
||||
uint32_t cf : 5; /*Color format: See `lv_img_color_format_t`*/
|
||||
uint32_t always_zero : 3; /*It the upper bits of the first byte. Always zero to look like a
|
||||
non-printable character*/
|
||||
|
||||
@ -145,7 +146,7 @@ typedef struct {
|
||||
lv_coord_t src_w; /*width of the image source*/
|
||||
lv_coord_t src_h; /*height of the image source*/
|
||||
lv_coord_t pivot_x; /*pivot x*/
|
||||
lv_coord_t pivot_y; /* pivot y*/
|
||||
lv_coord_t pivot_y; /*pivot y*/
|
||||
int16_t angle; /*angle to rotate*/
|
||||
uint16_t zoom; /*256 no zoom, 128 half size, 512 double size*/
|
||||
lv_color_t color; /*a color used for `LV_IMG_CF_INDEXED_1/2/4/8BIT` color formats*/
|
||||
@ -304,7 +305,7 @@ void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_IMG_BUF_H*/
|
||||
|
@ -23,7 +23,7 @@
|
||||
#define LV_IMG_CACHE_LIFE_GAIN 1
|
||||
|
||||
/*Don't let life to be greater than this limit because it would require a lot of time to
|
||||
* "die" from very high values */
|
||||
* "die" from very high values*/
|
||||
#define LV_IMG_CACHE_LIFE_LIMIT 1000
|
||||
|
||||
/**********************
|
||||
@ -84,9 +84,9 @@ lv_img_cache_entry_t * _lv_img_cache_open(const void * src, lv_color_t color)
|
||||
for(i = 0; i < entry_cnt; i++) {
|
||||
if(color.full == cache[i].dec_dsc.color.full &&
|
||||
lv_img_cache_match(src, cache[i].dec_dsc.src)) {
|
||||
/* If opened increment its life.
|
||||
* Image difficult to open should live longer to keep avoid frequent their recaching.
|
||||
* Therefore increase `life` with `time_to_open`*/
|
||||
/*If opened increment its life.
|
||||
*Image difficult to open should live longer to keep avoid frequent their recaching.
|
||||
*Therefore increase `life` with `time_to_open`*/
|
||||
cached_src = &cache[i];
|
||||
cached_src->life += cached_src->dec_dsc.time_to_open * LV_IMG_CACHE_LIFE_GAIN;
|
||||
if(cached_src->life > LV_IMG_CACHE_LIFE_LIMIT) cached_src->life = LV_IMG_CACHE_LIFE_LIMIT;
|
||||
@ -123,7 +123,7 @@ lv_img_cache_entry_t * _lv_img_cache_open(const void * src, lv_color_t color)
|
||||
if(open_res == LV_RES_INV) {
|
||||
LV_LOG_WARN("Image draw cannot open the image resource");
|
||||
lv_memset_00(cached_src, sizeof(lv_img_cache_entry_t));
|
||||
cached_src->life = INT32_MIN; /*Make the empty entry very "weak" to force its use */
|
||||
cached_src->life = INT32_MIN; /*Make the empty entry very "weak" to force its us*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -29,11 +29,11 @@ extern "C" {
|
||||
* To avoid repeating this heavy load images can be cached.
|
||||
*/
|
||||
typedef struct {
|
||||
lv_img_decoder_dsc_t dec_dsc; /**< Image information */
|
||||
lv_img_decoder_dsc_t dec_dsc; /**< Image information*/
|
||||
|
||||
/** Count the cache entries's life. Add `time_to_open` to `life` when the entry is used.
|
||||
* Decrement all lifes by one every in every ::lv_img_cache_open.
|
||||
* If life == 0 the entry can be reused */
|
||||
* If life == 0 the entry can be reused*/
|
||||
int32_t life;
|
||||
} lv_img_cache_entry_t;
|
||||
|
||||
@ -71,7 +71,7 @@ void lv_img_cache_invalidate_src(const void * src);
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_IMG_CACHE_H*/
|
||||
|
@ -51,7 +51,7 @@ static lv_res_t lv_img_decoder_built_in_line_indexed(lv_img_decoder_dsc_t * dsc,
|
||||
|
||||
/**
|
||||
* Initialize the image decoder module
|
||||
* */
|
||||
*/
|
||||
void _lv_img_decoder_init(void)
|
||||
{
|
||||
_lv_ll_init(&LV_GC_ROOT(_lv_img_decoder_ll), sizeof(lv_img_decoder_t));
|
||||
@ -298,11 +298,11 @@ lv_res_t lv_img_decoder_built_in_info(lv_img_decoder_t * decoder, const void * s
|
||||
}
|
||||
else if(src_type == LV_IMG_SRC_SYMBOL) {
|
||||
/*The size depend on the font but it is unknown here. It should be handled outside of the
|
||||
* function*/
|
||||
*function*/
|
||||
header->w = 1;
|
||||
header->h = 1;
|
||||
/* Symbols always have transparent parts. Important because of cover check in the draw
|
||||
* function. The actual value doesn't matter because lv_draw_label will draw it*/
|
||||
/*Symbols always have transparent parts. Important because of cover check in the draw
|
||||
*function. The actual value doesn't matter because lv_draw_label will draw it*/
|
||||
header->cf = LV_IMG_CF_ALPHA_1BIT;
|
||||
}
|
||||
else {
|
||||
@ -358,8 +358,8 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder
|
||||
/*Process true color formats*/
|
||||
if(cf == LV_IMG_CF_TRUE_COLOR || cf == LV_IMG_CF_TRUE_COLOR_ALPHA || cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED) {
|
||||
if(dsc->src_type == LV_IMG_SRC_VARIABLE) {
|
||||
/* In case of uncompressed formats the image stored in the ROM/RAM.
|
||||
* So simply give its pointer*/
|
||||
/*In case of uncompressed formats the image stored in the ROM/RAM.
|
||||
*So simply give its pointer*/
|
||||
dsc->img_data = ((lv_img_dsc_t *)dsc->src)->data;
|
||||
return LV_RES_OK;
|
||||
}
|
||||
@ -420,7 +420,7 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
/*Alpha indexed images. */
|
||||
/*Alpha indexed images.*/
|
||||
else if(cf == LV_IMG_CF_ALPHA_1BIT || cf == LV_IMG_CF_ALPHA_2BIT || cf == LV_IMG_CF_ALPHA_4BIT ||
|
||||
cf == LV_IMG_CF_ALPHA_8BIT) {
|
||||
return LV_RES_OK; /*Nothing to process*/
|
||||
@ -455,8 +455,8 @@ lv_res_t lv_img_decoder_built_in_read_line(lv_img_decoder_t * decoder, lv_img_de
|
||||
|
||||
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR || dsc->header.cf == LV_IMG_CF_TRUE_COLOR_ALPHA ||
|
||||
dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED) {
|
||||
/* For TRUE_COLOR images read line required only for files.
|
||||
* For variables the image data was returned in `open`*/
|
||||
/*For TRUE_COLOR images read line required only for files.
|
||||
*For variables the image data was returned in `open`*/
|
||||
if(dsc->src_type == LV_IMG_SRC_FILE) {
|
||||
res = lv_img_decoder_built_in_line_true_color(dsc, x, y, len, buf);
|
||||
}
|
||||
|
@ -30,17 +30,17 @@ extern "C" {
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Source of image. */
|
||||
* Source of image.*/
|
||||
enum {
|
||||
LV_IMG_SRC_VARIABLE, /** Binary/C variable */
|
||||
LV_IMG_SRC_FILE, /** File in filesystem */
|
||||
LV_IMG_SRC_SYMBOL, /** Symbol (@ref lv_symbol_def.h) */
|
||||
LV_IMG_SRC_UNKNOWN, /** Unknown source */
|
||||
LV_IMG_SRC_VARIABLE, /** Binary/C variable*/
|
||||
LV_IMG_SRC_FILE, /** File in filesystem*/
|
||||
LV_IMG_SRC_SYMBOL, /** Symbol (@ref lv_symbol_def.h)*/
|
||||
LV_IMG_SRC_UNKNOWN, /** Unknown source*/
|
||||
};
|
||||
|
||||
typedef uint8_t lv_img_src_t;
|
||||
|
||||
/* Decoder function definitions */
|
||||
/*Decoder function definitions*/
|
||||
|
||||
struct _lv_img_decoder;
|
||||
struct _lv_img_decoder_dsc;
|
||||
@ -120,7 +120,7 @@ typedef struct _lv_img_decoder_dsc {
|
||||
uint32_t time_to_open;
|
||||
|
||||
/**A text to display instead of the image when the image can't be opened.
|
||||
* Can be set in `open` function or set NULL. */
|
||||
* Can be set in `open` function or set NULL.*/
|
||||
const char * error_msg;
|
||||
|
||||
/**Store any custom data here is required*/
|
||||
@ -263,7 +263,7 @@ void lv_img_decoder_built_in_close(lv_img_decoder_t * decoder, lv_img_decoder_ds
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_IMG_DECODER_H*/
|
||||
|
@ -191,7 +191,7 @@ static void flex_update(lv_obj_t * cont)
|
||||
track_first_item = f->rev ? cont->spec_attr->child_cnt - 1 : 0;
|
||||
track_t t;
|
||||
while(track_first_item < (int32_t)cont->spec_attr->child_cnt && track_first_item >= 0) {
|
||||
/*Search the first item of the next row */
|
||||
/*Search the first item of the next row*/
|
||||
next_track_first_item = find_track_end(cont, track_first_item, max_main_size, item_gap, &t);
|
||||
total_track_cross_size += t.track_cross_size + track_gap;
|
||||
track_cnt++;
|
||||
@ -200,7 +200,7 @@ static void flex_update(lv_obj_t * cont)
|
||||
|
||||
if(track_cnt) total_track_cross_size -= track_gap; /*No gap after the last track*/
|
||||
|
||||
/* Place the tracks to get the start position */
|
||||
/*Place the tracks to get the start position*/
|
||||
lv_coord_t max_cross_size = (row ? lv_obj_get_height_fit(cont) : lv_obj_get_width_fit(cont));
|
||||
place_content(track_cross_place, max_cross_size, total_track_cross_size, track_cnt, cross_pos, &gap);
|
||||
}
|
||||
@ -213,7 +213,7 @@ static void flex_update(lv_obj_t * cont)
|
||||
|
||||
while(track_first_item < (int32_t)cont->spec_attr->child_cnt && track_first_item >= 0) {
|
||||
track_t t;
|
||||
/*Search the first item of the next row */
|
||||
/*Search the first item of the next row*/
|
||||
next_track_first_item = find_track_end(cont, track_first_item, max_main_size, item_gap, &t);
|
||||
|
||||
if(rtl && !row) {
|
||||
@ -357,8 +357,8 @@ static void children_repos(lv_obj_t * cont, int32_t item_first_id, int32_t item_
|
||||
lv_coord_t cross_pos = 0;
|
||||
switch(f->cross_place) {
|
||||
case LV_FLEX_PLACE_CENTER:
|
||||
/* Round up the cross size to avoid rounding error when dividing by 2
|
||||
* The issue comes up e,g, with column direction with center cross direction if an element's width changes*/
|
||||
/*Round up the cross size to avoid rounding error when dividing by 2
|
||||
*The issue comes up e,g, with column direction with center cross direction if an element's width changes*/
|
||||
cross_pos = (((t->track_cross_size + 1) & (~1)) - area_get_cross_size(&item->coords)) / 2;
|
||||
break;
|
||||
case LV_FLEX_PLACE_END:
|
||||
|
@ -31,7 +31,7 @@ LV_EXPORT_CONST_INT(LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/* Can't include lv_obj.h because it includes this header file */
|
||||
/*Can't include lv_obj.h because it includes this header file*/
|
||||
struct _lv_obj_t;
|
||||
|
||||
typedef enum {
|
||||
@ -119,7 +119,7 @@ extern const lv_flex_t lv_flex_row_even; /**< Place the items evenly
|
||||
#endif /*LV_USE_FLEX*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_FLEX_H*/
|
||||
|
@ -15,7 +15,7 @@
|
||||
*********************/
|
||||
/**
|
||||
* Some helper defines
|
||||
* */
|
||||
*/
|
||||
#define CELL_SHIFT 4
|
||||
#define CELL_POS_MASK ((1 << CELL_SHIFT) - 1)
|
||||
#define CELL_SPAN_MASK (CELL_POS_MASK << CELL_SHIFT)
|
||||
@ -145,8 +145,8 @@ static void full_refresh(lv_obj_t * cont)
|
||||
item_repos_hint_t hint;
|
||||
lv_memset_00(&hint, sizeof(hint));
|
||||
|
||||
/* Calculate the grids absolute x and y coordinates.
|
||||
* It will be used as helper during item repositioning to avoid calculating this value for every children*/
|
||||
/*Calculate the grids absolute x and y coordinates.
|
||||
*It will be used as helper during item repositioning to avoid calculating this value for every children*/
|
||||
lv_coord_t pad_left = lv_obj_get_style_pad_left(cont, LV_PART_MAIN);
|
||||
lv_coord_t pad_top = lv_obj_get_style_pad_top(cont, LV_PART_MAIN);
|
||||
hint.grid_abs.x = pad_left + cont->coords.x1 - lv_obj_get_scroll_x(cont);
|
||||
|
@ -24,7 +24,7 @@ extern "C" {
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/* Can't include lv_obj.h because it includes this header file */
|
||||
/*Can't include lv_obj.h because it includes this header file*/
|
||||
struct _lv_obj_t;
|
||||
|
||||
typedef enum {
|
||||
@ -129,7 +129,7 @@ extern const lv_grid_t grid_12;
|
||||
#endif /*LV_USE_GRID*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_GRID_H*/
|
||||
|
@ -38,7 +38,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_LAYOUTS_H*/
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#if defined(LV_GC_INCLUDE)
|
||||
#include LV_GC_INCLUDE
|
||||
#endif /* LV_ENABLE_GC */
|
||||
#endif /*LV_ENABLE_GC*/
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@ -523,9 +523,9 @@ lv_theme_t * lv_theme_default_init(lv_disp_t * disp, lv_color_palette_t palette_
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_large)
|
||||
{
|
||||
|
||||
/* This trick is required only to avoid the garbage collection of
|
||||
* styles' data if LVGL is used in a binding (e.g. Micropython)
|
||||
* In a general case styles could be in simple `static lv_style_t my_style...` variables*/
|
||||
/*This trick is required only to avoid the garbage collection of
|
||||
*styles' data if LVGL is used in a binding (e.g. Micropython)
|
||||
*In a general case styles could be in simple `static lv_style_t my_style...` variables*/
|
||||
if(!inited) {
|
||||
LV_GC_ROOT(_lv_theme_default_styles) = lv_mem_alloc(sizeof(my_theme_styles_t));
|
||||
styles = (my_theme_styles_t *)LV_GC_ROOT(_lv_theme_default_styles);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user