mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-02 03:58:33 +08:00
fix compile warnings
This commit is contained in:
parent
797e9117fd
commit
d27b3fc618
@ -192,7 +192,7 @@ static ret_t on_change_locale(void* ctx, event_t* e) {
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t install_one(void* ctx, void* iter) {
|
||||
static ret_t install_one(void* ctx, const void* iter) {
|
||||
widget_t* widget = WIDGET(iter);
|
||||
|
||||
if (widget->name != NULL) {
|
||||
|
@ -25,12 +25,9 @@
|
||||
#include "base/image_manager.h"
|
||||
|
||||
static ret_t on_paint_rect(void* ctx, event_t* e) {
|
||||
rect_t r;
|
||||
bitmap_t img;
|
||||
paint_event_t* evt = (paint_event_t*)e;
|
||||
canvas_t* c = evt->c;
|
||||
canvas_set_fill_color(c, color_init(0, 0, 0xff, 0));
|
||||
// canvas_set_fill_color(c, color_init(0, 0, 0, 0xff));
|
||||
canvas_fill_rect(c, 10, 10, 100, 100);
|
||||
|
||||
return RET_OK;
|
||||
|
@ -203,10 +203,10 @@ ret_t canvas_set_text_align(canvas_t* c, align_h_t align_h, align_v_t align_v) {
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static float_t canvas_measure_text_default(canvas_t* c, wchar_t* str, int32_t nr) {
|
||||
static float_t canvas_measure_text_default(canvas_t* c, wchar_t* str, uint32_t nr) {
|
||||
glyph_t g;
|
||||
float_t w = 0;
|
||||
int32_t i = 0;
|
||||
uint32_t i = 0;
|
||||
return_value_if_fail(c != NULL && str != NULL && c->font != NULL, 0);
|
||||
|
||||
if (nr < 0) {
|
||||
@ -225,7 +225,7 @@ static float_t canvas_measure_text_default(canvas_t* c, wchar_t* str, int32_t nr
|
||||
return w;
|
||||
}
|
||||
|
||||
float_t canvas_measure_text(canvas_t* c, wchar_t* str, int32_t nr) {
|
||||
float_t canvas_measure_text(canvas_t* c, wchar_t* str, uint32_t nr) {
|
||||
return_value_if_fail(c != NULL && c->lcd != NULL && str != NULL, 0);
|
||||
|
||||
if (c->lcd->measure_text) {
|
||||
@ -339,10 +339,10 @@ static ret_t canvas_do_draw_points(canvas_t* c, point_t* points, uint32_t nr) {
|
||||
}
|
||||
|
||||
static ret_t canvas_draw_points_impl(canvas_t* c, point_t* points, uint32_t nr) {
|
||||
int32_t i = 0;
|
||||
uint32_t i = 0;
|
||||
point_t* p = points;
|
||||
int32_t n = (nr / MAX_POINTS_PER_DRAW);
|
||||
int32_t r = (nr % MAX_POINTS_PER_DRAW);
|
||||
uint32_t n = (nr / MAX_POINTS_PER_DRAW);
|
||||
uint32_t r = (nr % MAX_POINTS_PER_DRAW);
|
||||
|
||||
for (i = 0; i <= n; i++) {
|
||||
if (i == n) {
|
||||
@ -469,9 +469,9 @@ ret_t canvas_draw_char(canvas_t* c, wchar_t chr, xy_t x, xy_t y) {
|
||||
return canvas_draw_char_impl(c, chr, c->ox + x, c->oy + y);
|
||||
}
|
||||
|
||||
static ret_t canvas_draw_text_impl(canvas_t* c, wchar_t* str, int32_t nr, xy_t x, xy_t y) {
|
||||
static ret_t canvas_draw_text_impl(canvas_t* c, wchar_t* str, uint32_t nr, xy_t x, xy_t y) {
|
||||
glyph_t g;
|
||||
int32_t i = 0;
|
||||
uint32_t i = 0;
|
||||
xy_t left = x;
|
||||
uint32_t start_time = time_now_ms();
|
||||
uint16_t font_size = c->font_size;
|
||||
@ -509,7 +509,7 @@ static ret_t canvas_draw_text_impl(canvas_t* c, wchar_t* str, int32_t nr, xy_t x
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
ret_t canvas_draw_text(canvas_t* c, wchar_t* str, int32_t nr, xy_t x, xy_t y) {
|
||||
ret_t canvas_draw_text(canvas_t* c, wchar_t* str, uint32_t nr, xy_t x, xy_t y) {
|
||||
return_value_if_fail(c != NULL && c->lcd != NULL && str != NULL, RET_BAD_PARAMS);
|
||||
if (c->lcd->draw_text != NULL) {
|
||||
return lcd_draw_text(c->lcd, str, nr, c->ox + x, c->oy + y);
|
||||
@ -1185,12 +1185,12 @@ static ret_t canvas_draw_fps(canvas_t* c) {
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
ret_t canvas_draw_text_in_rect(canvas_t* c, wchar_t* str, int32_t nr, const rect_t* r) {
|
||||
ret_t canvas_draw_text_in_rect(canvas_t* c, wchar_t* str, uint32_t nr, const rect_t* r) {
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int32_t text_w = 0;
|
||||
int32_t baseline = 0;
|
||||
int32_t font_size = 0;
|
||||
uint32_t text_w = 0;
|
||||
uint32_t baseline = 0;
|
||||
uint32_t font_size = 0;
|
||||
return_value_if_fail(c != NULL && str != NULL && r != NULL, RET_BAD_PARAMS);
|
||||
|
||||
font_size = c->font_size;
|
||||
|
@ -72,7 +72,7 @@ ret_t canvas_set_global_alpha(canvas_t* c, uint8_t alpha);
|
||||
ret_t canvas_set_font(canvas_t* c, const char* name, uint16_t size);
|
||||
ret_t canvas_set_text_align(canvas_t* c, align_h_t align_h, align_v_t align_v);
|
||||
|
||||
float_t canvas_measure_text(canvas_t* c, wchar_t* str, int32_t nr);
|
||||
float_t canvas_measure_text(canvas_t* c, wchar_t* str, uint32_t nr);
|
||||
|
||||
ret_t canvas_begin_frame(canvas_t* c, rect_t* dirty_rect, lcd_draw_mode_t draw_mode);
|
||||
|
||||
@ -88,8 +88,8 @@ ret_t canvas_fill_rect(canvas_t* c, xy_t x, xy_t y, wh_t w, wh_t h);
|
||||
ret_t canvas_stroke_rect(canvas_t* c, xy_t x, xy_t y, wh_t w, wh_t h);
|
||||
|
||||
ret_t canvas_draw_char(canvas_t* c, wchar_t chr, xy_t x, xy_t y);
|
||||
ret_t canvas_draw_text(canvas_t* c, wchar_t* str, int32_t nr, xy_t x, xy_t y);
|
||||
ret_t canvas_draw_text_in_rect(canvas_t* c, wchar_t* str, int32_t nr, const rect_t* r);
|
||||
ret_t canvas_draw_text(canvas_t* c, wchar_t* str, uint32_t nr, xy_t x, xy_t y);
|
||||
ret_t canvas_draw_text_in_rect(canvas_t* c, wchar_t* str, uint32_t nr, const rect_t* r);
|
||||
ret_t canvas_draw_image(canvas_t* c, bitmap_t* img, rect_t* src, rect_t* dst);
|
||||
|
||||
ret_t canvas_draw_image_at(canvas_t* c, bitmap_t* img, xy_t x, xy_t y);
|
||||
|
@ -170,7 +170,7 @@ static ret_t combo_box_on_item_click(void* ctx, event_t* e) {
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t combo_box_visit_item(void* ctx, void* data) {
|
||||
static ret_t combo_box_visit_item(void* ctx, const void* data) {
|
||||
widget_t* iter = WIDGET(data);
|
||||
combo_box_t* combo_box = COMBO_BOX(ctx);
|
||||
|
||||
|
@ -176,13 +176,15 @@ ret_t lcd_draw_glyph(lcd_t* lcd, glyph_t* glyph, rect_t* src, xy_t x, xy_t y) {
|
||||
return lcd->draw_glyph(lcd, glyph, src, x, y);
|
||||
}
|
||||
|
||||
float lcd_measure_text(lcd_t* lcd, wchar_t* str, int32_t nr) {
|
||||
float lcd_measure_text(lcd_t* lcd, wchar_t* str, uint32_t nr) {
|
||||
return_value_if_fail(nr < 10240, 0.0f);
|
||||
return_value_if_fail(lcd != NULL && lcd->measure_text != NULL && str != NULL, 0.0f);
|
||||
|
||||
return lcd->measure_text(lcd, str, nr);
|
||||
}
|
||||
|
||||
ret_t lcd_draw_text(lcd_t* lcd, wchar_t* str, int32_t nr, xy_t x, xy_t y) {
|
||||
ret_t lcd_draw_text(lcd_t* lcd, wchar_t* str, uint32_t nr, xy_t x, xy_t y) {
|
||||
return_value_if_fail(nr < 10240, 0.0f);
|
||||
return_value_if_fail(lcd != NULL && lcd->draw_text != NULL && str != NULL, RET_OK);
|
||||
|
||||
return lcd->draw_text(lcd, str, nr, x, y);
|
||||
|
@ -61,8 +61,8 @@ typedef ret_t (*lcd_fill_rect_t)(lcd_t* lcd, xy_t x, xy_t y, wh_t w, wh_t h);
|
||||
typedef ret_t (*lcd_stroke_rect_t)(lcd_t* lcd, xy_t x, xy_t y, wh_t w, wh_t h);
|
||||
|
||||
typedef ret_t (*lcd_draw_glyph_t)(lcd_t* lcd, glyph_t* glyph, rect_t* src, xy_t x, xy_t y);
|
||||
typedef float (*lcd_measure_text_t)(lcd_t* lcd, wchar_t* str, int32_t nr);
|
||||
typedef ret_t (*lcd_draw_text_t)(lcd_t* lcd, wchar_t* str, int32_t nr, xy_t x, xy_t y);
|
||||
typedef float (*lcd_measure_text_t)(lcd_t* lcd, wchar_t* str, uint32_t nr);
|
||||
typedef ret_t (*lcd_draw_text_t)(lcd_t* lcd, wchar_t* str, uint32_t nr, xy_t x, xy_t y);
|
||||
|
||||
typedef ret_t (*lcd_draw_image_t)(lcd_t* lcd, bitmap_t* img, rect_t* src, rect_t* dst);
|
||||
typedef ret_t (*lcd_draw_image_matrix_t)(lcd_t* lcd, draw_image_info_t* info);
|
||||
@ -433,24 +433,24 @@ ret_t lcd_draw_glyph(lcd_t* lcd, glyph_t* glyph, rect_t* src, xy_t x, xy_t y);
|
||||
* 测量字符串占用的宽度。
|
||||
* @param {lcd_t*} lcd lcd对象。
|
||||
* @param {wchar_t*} str 字符串。
|
||||
* @param {int32_t} nr 字符数。
|
||||
* @param {uint32_t} nr 字符数。
|
||||
*
|
||||
* @return {float_t} 返回字符串占用的宽度。
|
||||
*/
|
||||
float_t lcd_measure_text(lcd_t* lcd, wchar_t* str, int32_t nr);
|
||||
float_t lcd_measure_text(lcd_t* lcd, wchar_t* str, uint32_t nr);
|
||||
|
||||
/**
|
||||
* @method lcd_draw_text
|
||||
* 绘制字符。
|
||||
* @param {lcd_t*} lcd lcd对象。
|
||||
* @param {wchar_t*} str 字符串。
|
||||
* @param {int32_t} nr 字符数。
|
||||
* @param {uint32_t} nr 字符数。
|
||||
* @param {xy_t} x x坐标。
|
||||
* @param {xy_t} y y坐标。
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*/
|
||||
ret_t lcd_draw_text(lcd_t* lcd, wchar_t* str, int32_t nr, xy_t x, xy_t y);
|
||||
ret_t lcd_draw_text(lcd_t* lcd, wchar_t* str, uint32_t nr, xy_t x, xy_t y);
|
||||
|
||||
/**
|
||||
* @method lcd_draw_image
|
||||
|
@ -56,7 +56,7 @@ static const widget_vtable_t s_color_picker_vtable = {.size = sizeof(color_picke
|
||||
.get_prop = color_picker_get_prop,
|
||||
.create = color_picker_create};
|
||||
|
||||
static ret_t color_picker_update_child(void* ctx, void* iter) {
|
||||
static ret_t color_picker_update_child(void* ctx, const void* iter) {
|
||||
float h = 0;
|
||||
float s = 0;
|
||||
float v = 0;
|
||||
@ -294,7 +294,7 @@ static ret_t color_picker_on_child_value_changing(void* ctx, event_t* e) {
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t color_picker_hook_children(void* ctx, void* iter) {
|
||||
static ret_t color_picker_hook_children(void* ctx, const void* iter) {
|
||||
widget_t* child = WIDGET(iter);
|
||||
const char* name = child->name;
|
||||
const char* type = child->vt->type;
|
||||
|
@ -150,7 +150,7 @@ static ret_t keyboard_on_action_info(void* ctx, event_t* e) {
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t keyboard_hook_buttons(void* ctx, void* iter) {
|
||||
static ret_t keyboard_hook_buttons(void* ctx, const void* iter) {
|
||||
widget_t* widget = WIDGET(iter);
|
||||
input_method_t* im = input_method();
|
||||
keyboard_t* keyboard = KEYBOARD(ctx);
|
||||
|
@ -155,7 +155,7 @@ static ret_t lcd_vgcanvas_draw_image_matrix(lcd_t* lcd, draw_image_info_t* info)
|
||||
}
|
||||
|
||||
#define MAX_CHARS 256
|
||||
float_t lcd_vgcanvas_measure_text(lcd_t* lcd, wchar_t* str, int32_t nr) {
|
||||
float_t lcd_vgcanvas_measure_text(lcd_t* lcd, wchar_t* str, uint32_t nr) {
|
||||
wchar_t temp[MAX_CHARS + 1];
|
||||
char text[2 * MAX_CHARS + 1];
|
||||
vgcanvas_t* canvas = LCD(lcd)->canvas;
|
||||
@ -171,7 +171,7 @@ float_t lcd_vgcanvas_measure_text(lcd_t* lcd, wchar_t* str, int32_t nr) {
|
||||
return vgcanvas_measure_text(LCD(lcd)->canvas, text);
|
||||
}
|
||||
|
||||
static ret_t lcd_vgcanvas_draw_text(lcd_t* lcd, wchar_t* str, int32_t nr, xy_t x, xy_t y) {
|
||||
static ret_t lcd_vgcanvas_draw_text(lcd_t* lcd, wchar_t* str, uint32_t nr, xy_t x, xy_t y) {
|
||||
wchar_t temp[MAX_CHARS + 1];
|
||||
char text[2 * MAX_CHARS + 1];
|
||||
vgcanvas_t* canvas = LCD(lcd)->canvas;
|
||||
|
@ -52,8 +52,6 @@ static int image_to_rgb565(const char* ifilename, const char* ofilename) {
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
int ow = 0;
|
||||
int oh = 0;
|
||||
const char* ifilename = argv[1];
|
||||
const char* ofilename = argv[2];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user