1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

fix(vg_lite): fix compile warnings (#5268)

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
This commit is contained in:
Neo Xu 2024-01-10 23:59:58 +08:00 committed by GitHub
parent bbeef5a3d0
commit 11c3be1ce4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 81 additions and 19 deletions

View File

@ -109,7 +109,7 @@ vg_lite_error_t vg_lite_scale(vg_lite_float_t scale_x, vg_lite_float_t scale_y,
vg_lite_error_t vg_lite_rotate(vg_lite_float_t degrees, vg_lite_matrix_t * matrix)
{
/* Convert degrees into radians. */
vg_lite_float_t angle = degrees / 180.0f * M_PI;
vg_lite_float_t angle = (vg_lite_float_t)(degrees / 180.0f * M_PI);
/* Compuet cosine and sine values. */
vg_lite_float_t cos_angle = cosf(angle);

View File

@ -487,16 +487,23 @@ extern "C" {
vg_lite_error_t vg_lite_upload_buffer(vg_lite_buffer_t * buffer, uint8_t * data[3], uint32_t stride[3])
{
LV_UNUSED(buffer);
LV_UNUSED(data);
LV_UNUSED(stride);
return VG_LITE_NOT_SUPPORT;
}
vg_lite_error_t vg_lite_map(vg_lite_buffer_t * buffer, vg_lite_map_flag_t flag, int32_t fd)
{
LV_UNUSED(buffer);
LV_UNUSED(flag);
LV_UNUSED(fd);
return VG_LITE_NOT_SUPPORT;
}
vg_lite_error_t vg_lite_unmap(vg_lite_buffer_t * buffer)
{
LV_UNUSED(buffer);
return VG_LITE_NOT_SUPPORT;
}
@ -520,6 +527,7 @@ extern "C" {
vg_lite_color_t color,
vg_lite_filter_t filter)
{
LV_UNUSED(filter);
auto ctx = vg_lite_ctx::get_instance();
canvas_set_target(ctx, target);
@ -561,6 +569,7 @@ extern "C" {
vg_lite_color_t color,
vg_lite_filter_t filter)
{
LV_UNUSED(filter);
auto ctx = vg_lite_ctx::get_instance();
TVG_CHECK_RETURN_VG_ERROR(canvas_set_target(ctx, target));
@ -580,6 +589,8 @@ extern "C" {
vg_lite_error_t vg_lite_init(int32_t tessellation_width, int32_t tessellation_height)
{
LV_UNUSED(tessellation_width);
LV_UNUSED(tessellation_height);
#ifdef LV_VG_LITE_THORVG_THREAD_RENDER
/* Threads Count */
auto threads = std::thread::hardware_concurrency();
@ -690,6 +701,8 @@ extern "C" {
vg_lite_error_t vg_lite_get_register(uint32_t address, uint32_t * result)
{
LV_UNUSED(address);
LV_UNUSED(result);
return VG_LITE_NOT_SUPPORT;
}
@ -782,11 +795,21 @@ extern "C" {
vg_lite_float_t min_x, vg_lite_float_t min_y,
vg_lite_float_t max_x, vg_lite_float_t max_y)
{
LV_UNUSED(path);
LV_UNUSED(data_format);
LV_UNUSED(quality);
LV_UNUSED(path_length);
LV_UNUSED(path_data);
LV_UNUSED(min_x);
LV_UNUSED(min_y);
LV_UNUSED(max_x);
LV_UNUSED(max_y);
return VG_LITE_NOT_SUPPORT;
}
vg_lite_error_t vg_lite_clear_path(vg_lite_path_t * path)
{
LV_UNUSED(path);
return VG_LITE_NOT_SUPPORT;
}
@ -794,6 +817,9 @@ extern "C" {
vg_lite_uint32_t count,
vg_lite_format_t format)
{
LV_UNUSED(opcode);
LV_UNUSED(count);
LV_UNUSED(format);
return 0;
}
@ -802,11 +828,16 @@ extern "C" {
void * data,
uint32_t seg_count)
{
LV_UNUSED(path);
LV_UNUSED(cmd);
LV_UNUSED(data);
LV_UNUSED(seg_count);
return VG_LITE_NOT_SUPPORT;
}
vg_lite_error_t vg_lite_upload_path(vg_lite_path_t * path)
{
LV_UNUSED(path);
return VG_LITE_NOT_SUPPORT;
}
@ -835,6 +866,10 @@ extern "C" {
vg_lite_color_t color,
vg_lite_filter_t filter)
{
LV_UNUSED(pattern_mode);
LV_UNUSED(pattern_color);
LV_UNUSED(filter);
auto ctx = vg_lite_ctx::get_instance();
TVG_CHECK_RETURN_VG_ERROR(canvas_set_target(ctx, target));
@ -1669,16 +1704,29 @@ Empty_sequence_handler:
vg_lite_blend_t blend,
vg_lite_filter_t filter)
{
LV_UNUSED(target);
LV_UNUSED(path);
LV_UNUSED(fill_rule);
LV_UNUSED(path_matrix);
LV_UNUSED(grad);
LV_UNUSED(paint_color);
LV_UNUSED(blend);
LV_UNUSED(filter);
return VG_LITE_NOT_SUPPORT;
}
vg_lite_error_t vg_lite_set_command_buffer_size(uint32_t size)
{
LV_UNUSED(size);
return VG_LITE_NOT_SUPPORT;
}
vg_lite_error_t vg_lite_set_scissor(int32_t x, int32_t y, int32_t right, int32_t bottom)
{
LV_UNUSED(x);
LV_UNUSED(y);
LV_UNUSED(right);
LV_UNUSED(bottom);
return VG_LITE_NOT_SUPPORT;
}
@ -1700,21 +1748,27 @@ Empty_sequence_handler:
vg_lite_error_t vg_lite_source_global_alpha(vg_lite_global_alpha_t alpha_mode, uint8_t alpha_value)
{
LV_UNUSED(alpha_mode);
LV_UNUSED(alpha_value);
return VG_LITE_NOT_SUPPORT;
}
vg_lite_error_t vg_lite_dest_global_alpha(vg_lite_global_alpha_t alpha_mode, uint8_t alpha_value)
{
LV_UNUSED(alpha_mode);
LV_UNUSED(alpha_value);
return VG_LITE_NOT_SUPPORT;
}
vg_lite_error_t vg_lite_set_color_key(vg_lite_color_key4_t colorkey)
{
LV_UNUSED(colorkey);
return VG_LITE_NOT_SUPPORT;
}
vg_lite_error_t vg_lite_set_flexa_stream_id(uint8_t stream_id)
{
LV_UNUSED(stream_id);
return VG_LITE_NOT_SUPPORT;
}
@ -1723,6 +1777,10 @@ Empty_sequence_handler:
uint32_t background_segment_count,
uint32_t background_segment_size)
{
LV_UNUSED(stream_id);
LV_UNUSED(buffer);
LV_UNUSED(background_segment_count);
LV_UNUSED(background_segment_size);
return VG_LITE_NOT_SUPPORT;
}
@ -1753,11 +1811,15 @@ Empty_sequence_handler:
vg_lite_error_t vg_lite_set_tess_buffer(uint32_t physical, uint32_t size)
{
LV_UNUSED(physical);
LV_UNUSED(size);
return VG_LITE_NOT_SUPPORT;
}
vg_lite_error_t vg_lite_set_command_buffer(uint32_t physical, uint32_t size)
{
LV_UNUSED(physical);
LV_UNUSED(size);
return VG_LITE_NOT_SUPPORT;
}
} /* extern "C" */

View File

@ -21,10 +21,10 @@
* DEFINES
*********************/
#define PI 3.1415926535897932384626433832795
#define TWO_PI 6.283185307179586476925286766559
#define DEG_TO_RAD 0.017453292519943295769236907684886
#define RAD_TO_DEG 57.295779513082320876798154814105
#define PI 3.1415926535897932384626433832795f
#define TWO_PI 6.283185307179586476925286766559f
#define DEG_TO_RAD 0.017453292519943295769236907684886f
#define RAD_TO_DEG 57.295779513082320876798154814105f
#define radians(deg) ((deg) * DEG_TO_RAD)
#define degrees(rad) ((rad) * RAD_TO_DEG)

View File

@ -60,10 +60,10 @@ void lv_draw_vg_lite_line(lv_draw_unit_t * draw_unit, const lv_draw_line_dsc_t *
float half_w = dsc->width * 0.5f;
lv_area_t rel_clip_area;
rel_clip_area.x1 = LV_MIN(p1_x, p2_x) - half_w;
rel_clip_area.x2 = LV_MAX(p1_x, p2_x) + half_w;
rel_clip_area.y1 = LV_MIN(p1_y, p2_y) - half_w;
rel_clip_area.y2 = LV_MAX(p1_y, p2_y) + half_w;
rel_clip_area.x1 = (int32_t)(LV_MIN(p1_x, p2_x) - half_w);
rel_clip_area.x2 = (int32_t)(LV_MAX(p1_x, p2_x) + half_w);
rel_clip_area.y1 = (int32_t)(LV_MIN(p1_y, p2_y) - half_w);
rel_clip_area.y2 = (int32_t)(LV_MAX(p1_y, p2_y) + half_w);
if(!_lv_area_intersect(&rel_clip_area, &rel_clip_area, draw_unit->clip_area)) {
return; /*Fully clipped, nothing to do*/
@ -85,7 +85,7 @@ void lv_draw_vg_lite_line(lv_draw_unit_t * draw_unit, const lv_draw_line_dsc_t *
int32_t ndash = 0;
if(dash_width && dash_l * inv_dl < 1.0f) {
ndash = (1.0f / inv_dl + dash_l - 1) / dash_l;
ndash = (int32_t)((1.0f / inv_dl + dash_l - 1) / dash_l);
}
lv_vg_lite_path_t * path = lv_vg_lite_path_get(u, VG_LITE_FP32);

View File

@ -270,8 +270,8 @@ static lv_result_t decoder_open_file(lv_image_decoder_t * decoder, lv_image_deco
LV_UNUSED(decoder); /*Unused*/
lv_color_format_t cf = dsc->header.cf;
int32_t width = dsc->header.w;
int32_t height = dsc->header.h;
uint32_t width = dsc->header.w;
uint32_t height = dsc->header.h;
const char * path = dsc->src;
lv_fs_file_t file;

View File

@ -29,8 +29,8 @@ extern "C" {
#define MATH_PI 3.14159265358979323846f
#define MATH_HALF_PI 1.57079632679489661923f
#define MATH_TWO_PI 6.28318530717958647692f
#define DEG_TO_RAD 0.017453292519943295769236907684886
#define RAD_TO_DEG 57.295779513082320876798154814105
#define DEG_TO_RAD 0.017453292519943295769236907684886f
#define RAD_TO_DEG 57.295779513082320876798154814105f
#define MATH_TANF(x) tanf(x)
#define MATH_SINF(x) sinf(x)

View File

@ -447,7 +447,7 @@ void lv_vg_lite_path_append_arc(lv_vg_lite_path_t * path,
start_angle = MATH_RADIANS(start_angle);
sweep = MATH_RADIANS(sweep);
int n_curves = ceil(MATH_FABSF(sweep / MATH_HALF_PI));
int n_curves = (int)ceil(MATH_FABSF(sweep / MATH_HALF_PI));
int sweep_sign = (sweep < 0 ? -1 : 1);
float fract = fmodf(sweep, MATH_HALF_PI);
fract = (math_zero(fract)) ? MATH_HALF_PI * sweep_sign : fract;

View File

@ -713,7 +713,7 @@ bool lv_vg_lite_buffer_check(const vg_lite_buffer_t * buffer, bool is_src)
uint32_t mul;
uint32_t div;
uint32_t align;
uint32_t stride;
int32_t stride;
if(!buffer) {
LV_LOG_ERROR("buffer is NULL");
@ -751,7 +751,7 @@ bool lv_vg_lite_buffer_check(const vg_lite_buffer_t * buffer, bool is_src)
return false;
}
if(is_src && buffer->width != lv_vg_lite_width_align(buffer->width)) {
if(is_src && buffer->width != (vg_lite_int32_t)lv_vg_lite_width_align(buffer->width)) {
LV_LOG_ERROR("buffer width(%d) is not aligned", (int)buffer->width);
return false;
}
@ -988,8 +988,8 @@ bool lv_vg_lite_matrix_inverse(vg_lite_matrix_t * result, const vg_lite_matrix_t
lv_point_precise_t lv_vg_lite_matrix_transform_point(const vg_lite_matrix_t * matrix, const lv_point_precise_t * point)
{
lv_point_precise_t p;
p.x = point->x * matrix->m[0][0] + point->y * matrix->m[0][1] + matrix->m[0][2];
p.y = point->x * matrix->m[1][0] + point->y * matrix->m[1][1] + matrix->m[1][2];
p.x = (lv_value_precise_t)(point->x * matrix->m[0][0] + point->y * matrix->m[0][1] + matrix->m[0][2]);
p.y = (lv_value_precise_t)(point->x * matrix->m[1][0] + point->y * matrix->m[1][1] + matrix->m[1][2]);
return p;
}