diff --git a/src/lv_core/lv_obj.c b/src/lv_core/lv_obj.c index c944f9b5a..84317ca19 100644 --- a/src/lv_core/lv_obj.c +++ b/src/lv_core/lv_obj.c @@ -2929,6 +2929,7 @@ void * lv_obj_get_group(const lv_obj_t * obj) #if LV_USE_GROUP return obj->group_p; #else + LV_UNUSED(obj); return NULL; #endif } @@ -2948,6 +2949,7 @@ bool lv_obj_is_focused(const lv_obj_t * obj) } return false; #else + LV_UNUSED(obj); return false; #endif } diff --git a/src/lv_draw/lv_draw_label.c b/src/lv_draw/lv_draw_label.c index f371c2c49..c3eb35db7 100644 --- a/src/lv_draw/lv_draw_label.c +++ b/src/lv_draw/lv_draw_label.c @@ -758,7 +758,7 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_ } /*Go to the next column*/ - if(col_bit < 8 - bpp) { + if(col_bit < (int32_t) (8 - bpp)) { col_bit += bpp; bitmask = bitmask >> bpp; } @@ -778,7 +778,7 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_ } } - if((uint32_t) mask_p + (col_end - col_start) < mask_buf_size) { + if((int32_t) mask_p + (col_end - col_start) < mask_buf_size) { map_area.y2 ++; } else { diff --git a/src/lv_draw/lv_draw_line.c b/src/lv_draw/lv_draw_line.c index 430310af2..1482cb1e0 100644 --- a/src/lv_draw/lv_draw_line.c +++ b/src/lv_draw/lv_draw_line.c @@ -188,7 +188,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const if(dashed) { if(mask_res != LV_DRAW_MASK_RES_TRANSP) { lv_style_int_t dash_cnt = dash_start; - uint32_t i; + lv_coord_t i; for(i = 0; i < draw_area_w; i++, dash_cnt++) { if(dash_cnt <= dsc->dash_width) { int16_t diff = dsc->dash_width - dash_cnt; diff --git a/src/lv_draw/lv_draw_rect.c b/src/lv_draw/lv_draw_rect.c index 4e70becb0..63ec1de5d 100644 --- a/src/lv_draw/lv_draw_rect.c +++ b/src/lv_draw/lv_draw_rect.c @@ -112,6 +112,9 @@ void lv_draw_rect(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect */ void lv_draw_px(const lv_point_t * point, const lv_area_t * clip_area, const lv_style_t * style) { + LV_UNUSED(point); + LV_UNUSED(clip_area); + LV_UNUSED(style); // lv_opa_t opa = style->body.opa; // if(opa_scale != LV_OPA_COVER) opa = (opa * opa_scale) >> 8; // @@ -811,7 +814,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv /*Invert the shadow corner buffer and draw the corners on the left*/ sh_buf_tmp = sh_buf ; for(y = 0; y < corner_size; y++) { - uint32_t x; + int32_t x; for(x = 0; x < corner_size / 2; x++) { lv_opa_t tmp = sh_buf_tmp[x]; sh_buf_tmp[x] = sh_buf_tmp[corner_size - x - 1]; diff --git a/src/lv_draw/lv_img_buf.c b/src/lv_draw/lv_img_buf.c index c4034b611..d5d4cf940 100644 --- a/src/lv_draw/lv_img_buf.c +++ b/src/lv_draw/lv_img_buf.c @@ -523,6 +523,9 @@ void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t res->y1 = LV_MATH_MIN4(lb.y, lt.y, rb.y, rt.y); res->y2 = LV_MATH_MAX4(lb.y, lt.y, rb.y, rt.y); #else + LV_UNUSED(angle); + LV_UNUSED(zoom); + LV_UNUSED(pivot); res->x1 = 0; res->y1 = 0; res->x2 = w; diff --git a/src/lv_draw/lv_img_decoder.c b/src/lv_draw/lv_img_decoder.c index a5b38449d..c0fbf78bf 100644 --- a/src/lv_draw/lv_img_decoder.c +++ b/src/lv_draw/lv_img_decoder.c @@ -568,6 +568,11 @@ static lv_res_t lv_img_decoder_built_in_line_true_color(lv_img_decoder_dsc_t * d return LV_RES_OK; #else + LV_UNUSED(dsc); + LV_UNUSED(x); + LV_UNUSED(y); + LV_UNUSED(len); + LV_UNUSED(buf); LV_LOG_WARN("Image built-in decoder cannot read file because LV_USE_FILESYSTEM = 0"); return LV_RES_INV; #endif diff --git a/src/lv_hal/lv_hal_disp.c b/src/lv_hal/lv_hal_disp.c index 6643d0a6b..b14f901e5 100644 --- a/src/lv_hal/lv_hal_disp.c +++ b/src/lv_hal/lv_hal_disp.c @@ -257,6 +257,7 @@ lv_coord_t lv_disp_get_ver_res(lv_disp_t * disp) bool lv_disp_get_antialiasing(lv_disp_t * disp) { #if LV_ANTIALIAS == 0 + LV_UNUSED(disp); return false; #else if(disp == NULL) disp = lv_disp_get_default(); @@ -271,7 +272,7 @@ bool lv_disp_get_antialiasing(lv_disp_t * disp) * @param disp pointer to a display (NULL to use the default display) * @return dpi of the display */ -uint32_t lv_disp_get_dpi(lv_disp_t * disp) +lv_coord_t lv_disp_get_dpi(lv_disp_t * disp) { if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) return LV_DPI; /*Do not return 0 because it might be a divider*/ diff --git a/src/lv_hal/lv_hal_disp.h b/src/lv_hal/lv_hal_disp.h index 7a33eddd2..97c78c80f 100644 --- a/src/lv_hal/lv_hal_disp.h +++ b/src/lv_hal/lv_hal_disp.h @@ -255,7 +255,7 @@ bool lv_disp_get_antialiasing(lv_disp_t * disp); * @param disp pointer to a display (NULL to use the default display) * @return dpi of the display */ -uint32_t lv_disp_get_dpi(lv_disp_t * disp); +lv_coord_t lv_disp_get_dpi(lv_disp_t * disp); /** * Get the size category of the display based on it's hor. res. and dpi. diff --git a/src/lv_misc/lv_anim.c b/src/lv_misc/lv_anim.c index b0c3af81e..7f5be923f 100644 --- a/src/lv_misc/lv_anim.c +++ b/src/lv_misc/lv_anim.c @@ -224,6 +224,8 @@ void lv_anim_refr_now(void) */ lv_anim_value_t lv_anim_path_linear(const lv_anim_path_t * path, const lv_anim_t * a) { + LV_UNUSED(path); + /*Calculate the current step*/ uint32_t step; if(a->time == a->act_time) { @@ -250,6 +252,8 @@ lv_anim_value_t lv_anim_path_linear(const lv_anim_path_t * path, const lv_anim_t */ lv_anim_value_t lv_anim_path_ease_in(const lv_anim_path_t * path, const lv_anim_t * a) { + LV_UNUSED(path); + /*Calculate the current step*/ uint32_t t; if(a->time == a->act_time) @@ -274,6 +278,8 @@ lv_anim_value_t lv_anim_path_ease_in(const lv_anim_path_t * path, const lv_anim_ */ lv_anim_value_t lv_anim_path_ease_out(const lv_anim_path_t * path, const lv_anim_t * a) { + LV_UNUSED(path); + /*Calculate the current step*/ uint32_t t; @@ -299,6 +305,8 @@ lv_anim_value_t lv_anim_path_ease_out(const lv_anim_path_t * path, const lv_anim */ lv_anim_value_t lv_anim_path_ease_in_out(const lv_anim_path_t * path, const lv_anim_t * a) { + LV_UNUSED(path); + /*Calculate the current step*/ uint32_t t; @@ -324,6 +332,8 @@ lv_anim_value_t lv_anim_path_ease_in_out(const lv_anim_path_t * path, const lv_a */ lv_anim_value_t lv_anim_path_overshoot(const lv_anim_path_t * path, const lv_anim_t * a) { + LV_UNUSED(path); + /*Calculate the current step*/ uint32_t t; @@ -350,6 +360,8 @@ lv_anim_value_t lv_anim_path_overshoot(const lv_anim_path_t * path, const lv_ani */ lv_anim_value_t lv_anim_path_bounce(const lv_anim_path_t * path, const lv_anim_t * a) { + LV_UNUSED(path); + /*Calculate the current step*/ uint32_t t; if(a->time == a->act_time) @@ -412,6 +424,8 @@ lv_anim_value_t lv_anim_path_bounce(const lv_anim_path_t * path, const lv_anim_t */ lv_anim_value_t lv_anim_path_step(const lv_anim_path_t * path, const lv_anim_t * a) { + LV_UNUSED(path); + if(a->act_time >= a->time) return a->end; else diff --git a/src/lv_misc/lv_anim.h b/src/lv_misc/lv_anim.h index e02b7b9b9..a73434c6f 100644 --- a/src/lv_misc/lv_anim.h +++ b/src/lv_misc/lv_anim.h @@ -83,7 +83,7 @@ typedef struct _lv_anim_t { lv_anim_path_t path; /**< Describe the path (curve) of animations*/ int32_t start; /**< Start value*/ int32_t end; /**< End value*/ - uint32_t time; /**< Animation time in ms*/ + int32_t time; /**< Animation time in ms*/ int32_t act_time; /**< Current time in animation. Set to negative to make delay.*/ uint32_t playback_delay; /**< Wait before play back*/ uint32_t playback_time; /**< Duration of playback animation*/ diff --git a/src/lv_misc/lv_color.h b/src/lv_misc/lv_color.h index 2279eacb8..ba637266b 100644 --- a/src/lv_misc/lv_color.h +++ b/src/lv_misc/lv_color.h @@ -459,6 +459,7 @@ LV_ATTRIBUTE_FAST_MEM static inline void lv_color_premult(lv_color_t c, uint8_t out[1] = (uint16_t) LV_COLOR_GET_G(c) * mix; out[2] = (uint16_t) LV_COLOR_GET_B(c) * mix; #else + (void) mix; /*Pre-multiplication can't be used with 1 bpp*/ out[0] = LV_COLOR_GET_R(c); out[1] = LV_COLOR_GET_G(c); diff --git a/src/lv_misc/lv_types.h b/src/lv_misc/lv_types.h index aa4e43f4a..a277d57eb 100644 --- a/src/lv_misc/lv_types.h +++ b/src/lv_misc/lv_types.h @@ -77,6 +77,8 @@ typedef uint32_t lv_uintptr_t; * MACROS **********************/ +#define LV_UNUSED(x) ((void) x) + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/lv_widgets/lv_bar.c b/src/lv_widgets/lv_bar.c index 1baad09c4..9cc3503c1 100644 --- a/src/lv_widgets/lv_bar.c +++ b/src/lv_widgets/lv_bar.c @@ -163,6 +163,7 @@ void lv_bar_set_value(lv_obj_t * bar, int16_t value, lv_anim_enable_t anim) if(ext->cur_value == new_value) return; #if LV_USE_ANIMATION == 0 + LV_UNUSED(anim); ext->cur_value = new_value; lv_obj_invalidate(bar); #else @@ -189,6 +190,7 @@ void lv_bar_set_start_value(lv_obj_t * bar, int16_t start_value, lv_anim_enable_ if(ext->start_value == new_value) return; #if LV_USE_ANIMATION == 0 + LV_UNUSED(anim); ext->start_value = new_value; #else lv_bar_set_value_with_anim(bar, new_value, &ext->start_value, &ext->start_value_anim, anim); diff --git a/src/lv_widgets/lv_canvas.c b/src/lv_widgets/lv_canvas.c index 68cd7d2f5..dd3b5d2de 100644 --- a/src/lv_widgets/lv_canvas.c +++ b/src/lv_widgets/lv_canvas.c @@ -364,6 +364,15 @@ void lv_canvas_transform(lv_obj_t * canvas, lv_img_dsc_t * img, int16_t angle, u lv_obj_invalidate(canvas); #else + LV_UNUSED(canvas); + LV_UNUSED(img); + LV_UNUSED(angle); + LV_UNUSED(zoom); + LV_UNUSED(offset_x); + LV_UNUSED(offset_y); + LV_UNUSED(pivot_x); + LV_UNUSED(pivot_y); + LV_UNUSED(antialias); LV_LOG_WARN("LV_USE_IMG_TRANSFORM is disabled in lv_conf.h"); #endif } @@ -1009,7 +1018,7 @@ void lv_canvas_draw_polygon(lv_obj_t * canvas, const lv_point_t points[], uint32 lv_disp_t * refr_ori = _lv_refr_get_disp_refreshing(); _lv_refr_set_disp_refreshing(&disp); - // lv_draw_polygon(points, point_cnt, &mask, poly_draw_dsc); + lv_draw_polygon(points, point_cnt, &mask, poly_draw_dsc); _lv_refr_set_disp_refreshing(refr_ori); diff --git a/src/lv_widgets/lv_gauge.c b/src/lv_widgets/lv_gauge.c index 247014a2b..5c61c4e18 100644 --- a/src/lv_widgets/lv_gauge.c +++ b/src/lv_widgets/lv_gauge.c @@ -359,7 +359,7 @@ uint8_t lv_gauge_get_label_count(const lv_obj_t * gauge) * @return pointer to an `lv_img_dsc_t` variable or a path to an image * (not an `lv_img` object). `NULL` if not used. */ -const void * lv_gauge_get_needle_img(lv_obj_t * gauge, const void * img, lv_coord_t pivot_x, lv_coord_t pivot_y) +const void * lv_gauge_get_needle_img(lv_obj_t * gauge) { LV_ASSERT_OBJ(gauge, LV_OBJX_NAME); diff --git a/src/lv_widgets/lv_gauge.h b/src/lv_widgets/lv_gauge.h index 5ed74b529..c2293dd81 100644 --- a/src/lv_widgets/lv_gauge.h +++ b/src/lv_widgets/lv_gauge.h @@ -246,7 +246,7 @@ static inline uint16_t lv_gauge_get_angle_offset(lv_obj_t * gauge) * @return pointer to an `lv_img_dsc_t` variable or a path to an image * (not an `lv_img` object). `NULL` if not used. */ -const void * lv_gauge_get_needle_img(lv_obj_t * gauge, const void * img, lv_coord_t pivot_x, lv_coord_t pivot_y); +const void * lv_gauge_get_needle_img(lv_obj_t * gauge); /** * Get the X coordinate of the rotation center of the needle image diff --git a/src/lv_widgets/lv_label.c b/src/lv_widgets/lv_label.c index e61a972a9..d1144d4ac 100644 --- a/src/lv_widgets/lv_label.c +++ b/src/lv_widgets/lv_label.c @@ -1233,7 +1233,7 @@ static void lv_label_refr_text(lv_obj_t * label) lv_anim_set_playback_time(&a, a.time); lv_anim_t * anim_cur = lv_anim_get(label, (lv_anim_exec_xcb_t)lv_label_set_offset_x); - uint32_t act_time = 0; + int32_t act_time = 0; bool playback_now = false; if(anim_cur) { act_time = anim_cur->act_time; @@ -1268,7 +1268,7 @@ static void lv_label_refr_text(lv_obj_t * label) lv_anim_set_playback_time(&a, a.time); lv_anim_t * anim_cur = lv_anim_get(label, (lv_anim_exec_xcb_t)lv_label_set_offset_y); - uint32_t act_time = 0; + int32_t act_time = 0; bool playback_now = false; if(anim_cur) { act_time = anim_cur->act_time; @@ -1311,7 +1311,7 @@ static void lv_label_refr_text(lv_obj_t * label) lv_anim_set_time(&a, lv_anim_speed_to_time(ext->anim_speed, a.start, a.end)); lv_anim_t * anim_cur = lv_anim_get(label, (lv_anim_exec_xcb_t)lv_label_set_offset_x); - uint32_t act_time = anim_cur ? anim_cur->act_time : 0; + int32_t act_time = anim_cur ? anim_cur->act_time : 0; if(act_time < a.time) { a.act_time = act_time; /*To keep the old position*/ a.early_apply = 0; @@ -1332,7 +1332,7 @@ static void lv_label_refr_text(lv_obj_t * label) lv_anim_set_time(&a, lv_anim_speed_to_time(ext->anim_speed, a.start, a.end)); lv_anim_t * anim_cur = lv_anim_get(label, (lv_anim_exec_xcb_t)lv_label_set_offset_y); - uint32_t act_time = anim_cur ? anim_cur->act_time : 0; + int32_t act_time = anim_cur ? anim_cur->act_time : 0; if(act_time < a.time) { a.act_time = act_time; /*To keep the old position*/ a.early_apply = 0; diff --git a/src/lv_widgets/lv_page.c b/src/lv_widgets/lv_page.c index 6ad65fe8f..eb3b8f6a0 100644 --- a/src/lv_widgets/lv_page.c +++ b/src/lv_widgets/lv_page.c @@ -654,7 +654,8 @@ void lv_page_start_edge_flash(lv_obj_t * page, lv_page_edge_t edge) } #else - (void)page; /*Unused*/ + LV_UNUSED(page); + LV_UNUSED(edge); #endif } diff --git a/src/lv_widgets/lv_spinbox.c b/src/lv_widgets/lv_spinbox.c index 5abe1d45a..a2661d9d5 100644 --- a/src/lv_widgets/lv_spinbox.c +++ b/src/lv_widgets/lv_spinbox.c @@ -174,7 +174,7 @@ void lv_spinbox_set_digit_format(lv_obj_t * spinbox, uint8_t digit_count, uint8_ if(separator_position > LV_SPINBOX_MAX_DIGIT_COUNT) separator_position = LV_SPINBOX_MAX_DIGIT_COUNT; if(digit_count < LV_SPINBOX_MAX_DIGIT_COUNT) { - uint64_t max_val = _lv_pow(10, digit_count); + int64_t max_val = _lv_pow(10, digit_count); if(ext->range_max > max_val - 1) ext->range_max = max_val - 1; if(ext->range_min < - max_val + 1) ext->range_min = - max_val + 1; } diff --git a/src/lv_widgets/lv_tileview.c b/src/lv_widgets/lv_tileview.c index ccc220074..ced35aee7 100644 --- a/src/lv_widgets/lv_tileview.c +++ b/src/lv_widgets/lv_tileview.c @@ -152,6 +152,7 @@ lv_obj_t * lv_tileview_create(lv_obj_t * par, const lv_obj_t * copy) */ void lv_tileview_add_element(lv_obj_t * tileview, lv_obj_t * element) { + LV_UNUSED(tileview); LV_ASSERT_OBJ(tileview, LV_OBJX_NAME); LV_ASSERT_NULL(tileview); diff --git a/tests/Makefile b/tests/Makefile index 3564acaeb..59919858b 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -5,13 +5,11 @@ CC ?= gcc LVGL_DIR ?= ${shell pwd}/../.. LVGL_DIR_NAME ?= lvgl -WARNINGS ?= -Werror -Wall -Wextra \ - -Wshadow -Wundef -Wmaybe-uninitialized -Wmissing-prototypes -Wno-discarded-qualifiers \ - -Wno-unused-function -Wno-error=strict-prototypes -Wpointer-arith -fno-strict-aliasing -Wno-error=cpp -Wuninitialized \ - -Wno-unused-parameter -Wno-missing-field-initializers -Wno-format-nonliteral -Wno-cast-qual -Wunreachable-code -Wno-switch-default \ - -Wreturn-type -Wmultichar -Wformat-security -Wno-ignored-qualifiers -Wno-error=pedantic -Wno-sign-compare -Wno-error=missing-prototypes -Wdouble-promotion -Wclobbered -Wdeprecated \ +WARNINGS = -Werror -Wall -Wextra \ + -Wshadow -Wundef -Wmaybe-uninitialized -Wmissing-prototypes -Wpointer-arith -Wuninitialized \ + -Wunreachable-code -Wreturn-type -Wmultichar -Wformat-security -Wdouble-promotion -Wclobbered -Wdeprecated \ -Wempty-body -Wshift-negative-value -Wstack-usage=2048 \ - -Wtype-limits -Wsizeof-pointer-memaccess -Wpointer-arith + -Wtype-limits -Wsizeof-pointer-memaccess #-Wno-unused-value -Wno-unused-parameter OPTIMIZATION ?= -O3 -g0 diff --git a/tests/build.py b/tests/build.py index 804d56396..73a06148f 100755 --- a/tests/build.py +++ b/tests/build.py @@ -11,7 +11,7 @@ optimization = '"-O3 -g0"' def build(name, defines): - global warnings, base_defines, optimization + global base_defines, optimization print("=============================") print(name) diff --git a/tests/lv_test_assert.c b/tests/lv_test_assert.c index 9b2e69a14..a72ac16f3 100644 --- a/tests/lv_test_assert.c +++ b/tests/lv_test_assert.c @@ -48,9 +48,9 @@ typedef struct { * STATIC PROTOTYPES **********************/ static void read_png_file(png_img_t * p, const char* file_name); -static void write_png_file(png_img_t * p, const char* file_name); +//static void write_png_file(png_img_t * p, const char* file_name); static void png_release(png_img_t * p); -static void process_file(png_img_t * p); +//static void process_file(png_img_t * p); /********************** * STATIC VARIABLES @@ -254,59 +254,59 @@ static void read_png_file(png_img_t * p, const char* file_name) fclose(fp); } - - -static void write_png_file(png_img_t * p, const char* file_name) -{ - /* create file */ - FILE *fp = fopen(file_name, "wb"); - if (!fp) - lv_test_exit("[write_png_file] File %s could not be opened for writing", file_name); - - - /* initialize stuff */ - p->png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - - if (!p->png_ptr) - lv_test_exit("[write_png_file] png_create_write_struct failed"); - - p->info_ptr = png_create_info_struct(p->png_ptr); - if (!p->info_ptr) - lv_test_exit("[write_png_file] png_create_info_struct failed"); - - if (setjmp(png_jmpbuf(p->png_ptr))) - lv_test_exit("[write_png_file] Error during init_io"); - - png_init_io(p->png_ptr, fp); - - - /* write header */ - if (setjmp(png_jmpbuf(p->png_ptr))) - lv_test_exit("[write_png_file] Error during writing header"); - - png_set_IHDR(p->png_ptr, p->info_ptr, p->width, p->height, - p->bit_depth, p->color_type, PNG_INTERLACE_NONE, - PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); - - png_write_info(p->png_ptr, p->info_ptr); - - - /* write bytes */ - if (setjmp(png_jmpbuf(p->png_ptr))) - lv_test_exit("[write_png_file] Error during writing bytes"); - - png_write_image(p->png_ptr, p->row_pointers); - - - /* end write */ - if (setjmp(png_jmpbuf(p->png_ptr))) - lv_test_exit("[write_png_file] Error during end of write"); - - png_write_end(p->png_ptr, NULL); - - fclose(fp); -} - +// +// +//static void write_png_file(png_img_t * p, const char* file_name) +//{ +// /* create file */ +// FILE *fp = fopen(file_name, "wb"); +// if (!fp) +// lv_test_exit("[write_png_file] File %s could not be opened for writing", file_name); +// +// +// /* initialize stuff */ +// p->png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); +// +// if (!p->png_ptr) +// lv_test_exit("[write_png_file] png_create_write_struct failed"); +// +// p->info_ptr = png_create_info_struct(p->png_ptr); +// if (!p->info_ptr) +// lv_test_exit("[write_png_file] png_create_info_struct failed"); +// +// if (setjmp(png_jmpbuf(p->png_ptr))) +// lv_test_exit("[write_png_file] Error during init_io"); +// +// png_init_io(p->png_ptr, fp); +// +// +// /* write header */ +// if (setjmp(png_jmpbuf(p->png_ptr))) +// lv_test_exit("[write_png_file] Error during writing header"); +// +// png_set_IHDR(p->png_ptr, p->info_ptr, p->width, p->height, +// p->bit_depth, p->color_type, PNG_INTERLACE_NONE, +// PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); +// +// png_write_info(p->png_ptr, p->info_ptr); +// +// +// /* write bytes */ +// if (setjmp(png_jmpbuf(p->png_ptr))) +// lv_test_exit("[write_png_file] Error during writing bytes"); +// +// png_write_image(p->png_ptr, p->row_pointers); +// +// +// /* end write */ +// if (setjmp(png_jmpbuf(p->png_ptr))) +// lv_test_exit("[write_png_file] Error during end of write"); +// +// png_write_end(p->png_ptr, NULL); +// +// fclose(fp); +//} +// static void png_release(png_img_t * p) { int y; @@ -314,30 +314,30 @@ static void png_release(png_img_t * p) free(p->row_pointers[y]); free(p->row_pointers); } - -static void process_file(png_img_t * p) -{ - if (png_get_color_type(p->png_ptr, p->info_ptr) == PNG_COLOR_TYPE_RGB) - lv_test_exit("[process_file] input file is PNG_COLOR_TYPE_RGB but must be PNG_COLOR_TYPE_RGBA " - "(lacks the alpha channel)"); - - if (png_get_color_type(p->png_ptr, p->info_ptr) != PNG_COLOR_TYPE_RGBA) - lv_test_exit("[process_file] color_type of input file must be PNG_COLOR_TYPE_RGBA (%d) (is %d)", - PNG_COLOR_TYPE_RGBA, png_get_color_type(p->png_ptr, p->info_ptr)); - - int x, y; - for (y=0; yheight; y++) { - png_byte* row = p->row_pointers[y]; - for (x=0; xwidth; x++) { - png_byte* ptr = &(row[x*4]); - printf("Pixel at position [ %d - %d ] has RGBA values: %d - %d - %d - %d\n", - x, y, ptr[0], ptr[1], ptr[2], ptr[3]); - - /* set red value to 0 and green value to the blue one */ - ptr[0] = 0; - ptr[1] = ptr[2]; - } - } -} +// +//static void process_file(png_img_t * p) +//{ +// if (png_get_color_type(p->png_ptr, p->info_ptr) == PNG_COLOR_TYPE_RGB) +// lv_test_exit("[process_file] input file is PNG_COLOR_TYPE_RGB but must be PNG_COLOR_TYPE_RGBA " +// "(lacks the alpha channel)"); +// +// if (png_get_color_type(p->png_ptr, p->info_ptr) != PNG_COLOR_TYPE_RGBA) +// lv_test_exit("[process_file] color_type of input file must be PNG_COLOR_TYPE_RGBA (%d) (is %d)", +// PNG_COLOR_TYPE_RGBA, png_get_color_type(p->png_ptr, p->info_ptr)); +// +// int x, y; +// for (y=0; yheight; y++) { +// png_byte* row = p->row_pointers[y]; +// for (x=0; xwidth; x++) { +// png_byte* ptr = &(row[x*4]); +// printf("Pixel at position [ %d - %d ] has RGBA values: %d - %d - %d - %d\n", +// x, y, ptr[0], ptr[1], ptr[2], ptr[3]); +// +// /* set red value to 0 and green value to the blue one */ +// ptr[0] = 0; +// ptr[1] = ptr[2]; +// } +// } +//} #endif diff --git a/tests/lv_test_main.c b/tests/lv_test_main.c index d145208f8..8c69a98df 100644 --- a/tests/lv_test_main.c +++ b/tests/lv_test_main.c @@ -40,6 +40,8 @@ static void hal_init(void) static void dummy_flush_cb(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p) { + LV_UNUSED(area); + LV_UNUSED(color_p); lv_disp_flush_ready(disp_drv); }