merge master

This commit is contained in:
lixianjing 2021-07-05 17:47:28 +08:00
commit 24f6526b3a
40 changed files with 253 additions and 95 deletions

View File

@ -15,7 +15,7 @@ namespace agge
public:
using vector_rasterizer::_1_shift;
using vector_rasterizer::scanline_cells;
rasterizer() : _start_x(), _start_y() {};
public:
using vector_rasterizer::reset;

View File

@ -37,7 +37,6 @@ static ret_t on_fullscreen(void* ctx, event_t* e) {
}
static ret_t on_click_enlarge(void* ctx, event_t* e) {
window_manager_resize(window_manager(), 840, 800);
return RET_OK;

View File

@ -1,5 +1,21 @@
# 最新动态
2021/07/05
* 完善release脚本感谢朝泽提供补丁
* 完善csv file感谢雨欣提供补丁
* 修复圆角矩形编译警告(感谢智明提供补丁)
2021/07/02
* 修复延迟动画刷新的问题(感谢智明提供补丁)
* 修复agge的ras初始化的值不正常的问题感谢智明提供补丁
* 修复linux-fb无法修改lcd分辨率问题感谢智明提供补丁
2021/07/01
* 增加rectf\_t。
* 完善switch。
* 修复部分源文件的UTF-8 BOM标志感谢陈谭提供补丁
* 完善canvas。如果图片缩放而且只是绘制部分为了避免取整出现坐标异位使用vgcanvas绘制。
2021/06/30
* 将fps计算放到fps.h中。
* 还原vg资源管理器的宏 (感谢智明提供补丁)

View File

@ -98,19 +98,35 @@ def copyFiles(src_root_dir, src, dst_root_dir, dst, ignore_files=[]):
print('!!! copyFiles src NOT EXISTS: ' + s)
def copySharedLib(src, dst):
if not os.path.exists(src):
print('copy shared lib: ' + src + ' is not exists.')
else:
files = os.listdir(src)
for file in files:
srcFilename = joinPath(src, file)
dstFilename = joinPath(dst, file)
if os.path.isdir(srcFilename):
if not os.path.exists(dstFilename):
os.makedirs(dstFilename)
copySharedLib(srcFilename, dstFilename)
else:
ext = '.' + getShareLibExt()
if file.endswith(ext):
print('copy shared lib: ' + srcFilename + ' ==> ' + dstFilename)
shutil.copy(srcFilename, dst)
os.chmod(dstFilename, 0o755)
def copyExe():
output_bin_dir = joinPath(OUTPUT_DIR, 'bin')
copyFile(BIN_DIR, EXE_NAME, output_bin_dir, EXE_NAME)
copySharedLib(BIN_DIR, output_bin_dir)
os.chmod(joinPath(output_bin_dir, EXE_NAME), 0o755)
sharelibs = glob.glob(BIN_DIR + "/*."+getShareLibExt());
for filename in sharelibs:
basename = os.path.basename(filename)
copyFile(BIN_DIR, basename, output_bin_dir, basename)
os.chmod(joinPath(output_bin_dir, basename), 0o755)
def copyAssets():
copyFiles(ASSETS_DIR, '', OUTPUT_DIR, 'assets/')
copyFiles(ASSETS_DIR, '', OUTPUT_DIR, 'assets/')
def cleanFiles():
d = joinPath(OUTPUT_DIR, 'assets/default/inc')

View File

@ -180,7 +180,7 @@ static inline ret_t bidi_log2vis(bidi_t* bidi, const wchar_t* str, uint32_t size
return RET_OK;
}
static bidi_type_t bidi_type_from_name(const char* name) {
static inline bidi_type_t bidi_type_from_name(const char* name) {
return BIDI_TYPE_AUTO;
}

View File

@ -688,13 +688,14 @@ ret_t canvas_draw_utf8(canvas_t* c, const char* str, xy_t x, xy_t y) {
}
static ret_t canvas_do_draw_image(canvas_t* c, bitmap_t* img, const rect_t* s, const rect_t* d) {
rect_t src;
rect_t dst;
rectf_t src;
rectf_t dst;
xy_t x = d->x;
xy_t y = d->y;
xy_t x2 = d->x + d->w - 1;
xy_t y2 = d->y + d->h - 1;
vgcanvas_t* vg = canvas_get_vgcanvas(c);
if (d->w <= 0 || d->h <= 0 || s->w <= 0 || s->h <= 0 || x > c->clip_right || x2 < c->clip_left ||
y > c->clip_bottom || y2 < c->clip_top) {
@ -722,7 +723,14 @@ static ret_t canvas_do_draw_image(canvas_t* c, bitmap_t* img, const rect_t* s, c
return RET_OK;
}
return lcd_draw_image(c->lcd, img, &src, &dst);
if ((src.w == dst.w && src.h == dst.h) || (src.w == img->w && src.h == img->h) || vg == NULL) {
rect_t isrc = rect_init(src.x, src.y, src.w, src.h);
rect_t idst = rect_init(dst.x, dst.y, dst.w, dst.h);
return lcd_draw_image(c->lcd, img, &isrc, &idst);
} else {
/*如果图片缩放而且只是绘制部分为了避免取整出现坐标异位使用vgcanvas绘制。*/
return vgcanvas_draw_image(vg, img, src.x, src.y, src.w, src.h, dst.x, dst.y, dst.w, dst.h);
}
}
ret_t canvas_draw_image(canvas_t* c, bitmap_t* img, const rect_t* src, const rect_t* dst_in) {

View File

@ -722,7 +722,19 @@ ret_t canvas_draw_image_scale_down(canvas_t* c, bitmap_t* img, const rect_t* src
ret_t canvas_draw_line(canvas_t* c, xy_t x1, xy_t y1, xy_t x2, xy_t y2);
ret_t canvas_draw_char(canvas_t* c, wchar_t chr, xy_t x, xy_t y);
ret_t canvas_draw_image_matrix(canvas_t* c, bitmap_t* img, matrix_t* matrix);
/**
* @method canvas_set_fps
* FPS
*
* @param {canvas_t*} c canvas对象
* @param {bool_t} show_fps fps
* @param {uint32_t} fps FPS
*
* @return {ret_t} RET_OK表示成功
*/
ret_t canvas_set_fps(canvas_t* c, bool_t show_fps, uint32_t fps);
/**
* @method canvas_set_font_manager
* canvas的font_manager对象

View File

@ -670,8 +670,6 @@ static void ffr_draw_rounded_rect_draw_info_init(frr_draw_info_t draw_infos[FRR_
float_t w2 = 0.0f;
float_t h1 = 0.0f;
float_t h2 = 0.0f;
int32_t mid_lenght_v = 0;
int32_t mid_lenght_h = 0;
uint32_t radius_list[FRR_VERTEXT_TYPE_COUNT] = {radius_tr, radius_tl, radius_bl, radius_br};
memset(draw_infos, 0x0, sizeof(frr_draw_info_t) * FRR_VERTEXT_TYPE_COUNT);
@ -694,8 +692,8 @@ static void ffr_draw_rounded_rect_draw_info_init(frr_draw_info_t draw_infos[FRR_
continue;
}
draw_infos[i].radius = radius;
mid_lenght_v = ffr_get_rounded_rect_mid_length(radius, r->h, &w1, &h1, &(draw_infos[i].angle_v), TRUE);
mid_lenght_h = ffr_get_rounded_rect_mid_length(radius, r->w, &h2, &w2, &(draw_infos[i].angle_h), TRUE);
ffr_get_rounded_rect_mid_length(radius, r->h, &w1, &h1, &(draw_infos[i].angle_v), TRUE);
ffr_get_rounded_rect_mid_length(radius, r->w, &h2, &w2, &(draw_infos[i].angle_h), TRUE);
for(j = i; j < FRR_VERTEXT_TYPE_COUNT; j++) {
if (i != j && radius_list[j] == radius) {

View File

@ -1,4 +1,4 @@
/**
/**
* File: image_loader.h
* Author: AWTK Develop Team
* Brief: image_loader interface

View File

@ -328,10 +328,10 @@ ret_t lcd_resize(lcd_t* lcd, wh_t w, wh_t h, uint32_t line_length) {
lcd->h = h;
if (lcd->resize != NULL) {
lcd->resize(lcd, w, h, line_length);
return lcd->resize(lcd, w, h, line_length);
}
return RET_OK;
return RET_FAIL;
}
wh_t lcd_get_width(lcd_t* lcd) {

View File

@ -1,4 +1,4 @@
/**
/**
* File: native_window.h
* Author: AWTK Develop Team
* Brief: native window
@ -77,18 +77,6 @@ ret_t native_window_invalidate(native_window_t* win, const rect_t* r) {
return dirty_rects_add(&(win->dirty_rects), r);
}
ret_t native_window_on_resized(native_window_t* win, wh_t w, wh_t h) {
lcd_t* lcd = NULL;
return_value_if_fail(win != NULL, RET_BAD_PARAMS);
lcd = native_window_get_canvas(win)->lcd;
return_value_if_fail(lcd != NULL, RET_BAD_PARAMS);
lcd_resize(lcd, w, h, 0);
return RET_OK;
}
ret_t native_window_gl_make_current(native_window_t* win) {
return_value_if_fail(win != NULL && win->vt != NULL, RET_BAD_PARAMS);
return_value_if_fail(win->vt->gl_make_current != NULL, RET_BAD_PARAMS);

View File

@ -249,7 +249,6 @@ ret_t native_window_end_frame(native_window_t* win);
rect_t native_window_calc_dirty_rect(native_window_t* win);
ret_t native_window_clear_dirty_rect(native_window_t* win);
ret_t native_window_update_last_dirty_rect(native_window_t* win);
ret_t native_window_on_resized(native_window_t* win, wh_t w, wh_t h);
#define NATIVE_WINDOW(win) ((native_window_t*)(win))

View File

@ -50,4 +50,3 @@ widget_t* ui_loader_load_widget_with_parent(const char* name, widget_t* parent)
return root;
}

View File

@ -1,4 +1,4 @@

/**
* File: vg_gradient.h
* Author: AWTK Develop Team
@ -199,7 +199,8 @@ struct _vg_gradient_t {
*
* @return {vg_gradient_t*} gradient对象
*/
vg_gradient_t* vg_gradient_create_radial(float x0, float y0, float r0, float x1, float y1, float r1);
vg_gradient_t* vg_gradient_create_radial(float x0, float y0, float r0, float x1, float y1,
float r1);
/**
* @method vg_gradient_init_radial
@ -214,8 +215,8 @@ vg_gradient_t* vg_gradient_create_radial(float x0, float y0, float r0, float x1,
*
* @return {vg_gradient_t*} gradient对象
*/
vg_gradient_t* vg_gradient_init_radial(vg_gradient_t* gradient, float x0, float y0, float r0, float x1, float y1, float r1);
vg_gradient_t* vg_gradient_init_radial(vg_gradient_t* gradient, float x0, float y0, float r0,
float x1, float y1, float r1);
/**
* @method vg_gradient_create_linear
@ -241,7 +242,8 @@ vg_gradient_t* vg_gradient_create_linear(float sx, float sy, float ex, float ey)
*
* @return {vg_gradient_t*} gradient对象
*/
vg_gradient_t* vg_gradient_init_linear(vg_gradient_t* gradient, float sx, float sy, float ex, float ey);
vg_gradient_t* vg_gradient_init_linear(vg_gradient_t* gradient, float sx, float sy, float ex,
float ey);
/**
* @method vg_gradient_add_stop

View File

@ -153,7 +153,9 @@ ret_t widget_animator_start(widget_animator_t* animator) {
animator->state = ANIMATOR_RUNNING;
emitter_dispatch(&(animator->emitter), &e);
widget_animator_update(animator, 0);
if (animator->delay == 0) {
widget_animator_update(animator, 0);
}
return RET_OK;
}

View File

@ -608,6 +608,12 @@ TK_DECL_VTABLE(window_base) = {
};
widget_t* window_base_cast(widget_t* widget) {
#ifdef WIN32
if (widget != NULL && widget->vt != NULL && widget->vt->is_window) {
return widget;
}
#endif /*WIN32*/
return_value_if_fail(WIDGET_IS_INSTANCE_OF(widget, window_base), NULL);
return widget;

View File

@ -89,10 +89,16 @@ static ret_t csv_file_object_remove_prop(object_t* obj, const char* name) {
static ret_t csv_file_object_set_prop(object_t* obj, const char* name, const value_t* v) {
csv_path_t p;
uint32_t rows = 0;
csv_file_object_t* o = CSV_FILE_OBJECT(obj);
return_value_if_fail(o != NULL, RET_BAD_PARAMS);
return_value_if_fail(csv_path_parse(&p, o->csv, name) == RET_OK, RET_FAIL);
rows = csv_file_get_rows(o->csv);
if (rows <= 0) {
return RET_NOT_FOUND;
}
return_value_if_fail(csv_path_parse(&p, o->csv, name) == RET_OK, RET_FAIL);
if (p.col_name != NULL && tk_str_ieq(p.col_name, OBJECT_PROP_CHECKED)) {
return csv_file_set_row_checked(o->csv, p.row, value_bool(v));
}
@ -103,19 +109,24 @@ static ret_t csv_file_object_set_prop(object_t* obj, const char* name, const val
static ret_t csv_file_object_get_prop(object_t* obj, const char* name, value_t* v) {
csv_path_t p;
uint32_t rows = 0;
const char* str = NULL;
csv_file_object_t* o = CSV_FILE_OBJECT(obj);
return_value_if_fail(o != NULL, RET_BAD_PARAMS);
rows = csv_file_get_rows(o->csv);
if (tk_str_ieq(name, OBJECT_PROP_SIZE)) {
value_set_int(v, csv_file_get_rows(o->csv));
value_set_int(v, rows);
return RET_OK;
}
return_value_if_fail(csv_path_parse(&p, o->csv, name) == RET_OK, RET_FAIL);
if (rows <= 0) {
return RET_NOT_FOUND;
}
return_value_if_fail(csv_path_parse(&p, o->csv, name) == RET_OK, RET_FAIL);
if (p.col_name != NULL && tk_str_ieq(p.col_name, OBJECT_PROP_CHECKED)) {
return_value_if_fail(p.row < csv_file_get_rows(o->csv), RET_FAIL);
return_value_if_fail(p.row < rows, RET_FAIL);
value_set_bool(v, csv_file_is_row_checked(o->csv, p.row));
return RET_OK;

View File

@ -1,4 +1,4 @@
/**
/**
* File: color_component.
* Author: AWTK Develop Team
* Brief: color_component

View File

@ -1,4 +1,4 @@
/**
/**
* File: image_value.h
* Author: AWTK Develop Team
* Brief: image_value

View File

@ -1,4 +1,4 @@
/**
/**
* File: progress_circle.c
* Author: AWTK Develop Team
* Brief: progress_circle

View File

@ -105,7 +105,7 @@ static ret_t switch_on_pointer_up(switch_t* aswitch, pointer_event_t* e) {
max_xoffset = aswitch->max_xoffset_ratio * widget->w;
velocity_update(v, e->e.time, e->x, e->y);
xoffset_end = aswitch->xoffset - v->yv;
xoffset_end = aswitch->xoffset - v->xv;
if (e->x == aswitch->xdown) {
/*click*/
@ -150,8 +150,9 @@ static ret_t switch_on_event(widget_t* widget, event_t* e) {
case EVT_POINTER_UP: {
aswitch->pressed = FALSE;
if (!aswitch->point_down_aborted) {
switch_on_pointer_move(aswitch, (pointer_event_t*)e);
switch_on_pointer_up(aswitch, (pointer_event_t*)e);
pointer_event_t* evt = (pointer_event_t*)e;
switch_on_pointer_move(aswitch, evt);
switch_on_pointer_up(aswitch, evt);
widget_ungrab(widget->parent, widget);
} else {
aswitch->xoffset = aswitch->xoffset_save;

View File

@ -1,4 +1,4 @@
/**
/**
* File: text_selector.h
* Author: AWTK Develop Team
* Brief: text_selector

View File

@ -1,4 +1,4 @@
/**
/**
* File: vpage.c
* Author: AWTK Develop Team
* Brief: (/)

View File

@ -31,6 +31,7 @@
#include "base/widget.h"
#include "lcd/lcd_nanovg.h"
#include "base/widget_consts.h"
#include "base/window_manager.h"
#include "native_window/native_window_fb_gl.h"
typedef struct _native_window_fb_gl_t {
@ -71,13 +72,43 @@ ret_t native_window_fb_gl_set_destroy_func(native_window_t* win, native_window_d
return RET_OK;
}
lcd_t* native_window_get_lcd(native_window_t* win) {
native_window_fb_gl_t* fb_gl = NATIVE_WINDOW_FB_GL(win);
return_value_if_fail(fb_gl != NULL, NULL);
return fb_gl->canvas.lcd;
}
static ret_t native_window_fb_gl_move(native_window_t* win, xy_t x, xy_t y) {
return RET_OK;
}
static ret_t native_window_fg_gl_on_resized_timer(const timer_info_t* info) {
widget_t* wm = window_manager();
native_window_t* win = NATIVE_WINDOW(info->ctx);
event_t e = event_init(EVT_NATIVE_WINDOW_RESIZED, NULL);
window_manager_dispatch_native_window_event(window_manager(), &e, win);
widget_set_need_relayout_children(wm);
widget_invalidate_force(wm, NULL);
log_debug("on_resized_idle\n");
return RET_REMOVE;
}
static ret_t native_window_fb_gl_resize(native_window_t* win, wh_t w, wh_t h) {
win->rect.w = w;
win->rect.h = h;
ret_t ret = RET_OK;
native_window_info_t info;
native_window_fb_gl_t* fb_gl = NATIVE_WINDOW_FB_GL(win);
native_window_get_info(win, &info);
fb_gl->w = win->rect.w = w;
fb_gl->h = win->rect.h = h;
if (system_info()->lcd_orientation == LCD_ORIENTATION_0 && (w != info.w || h != info.h)) {
ret = lcd_resize(fb_gl->canvas.lcd, w, h, 0);
return_value_if_fail(ret == RET_OK, ret);
system_info_set_lcd_w(system_info(), w);
system_info_set_lcd_h(system_info(), h);
timer_add(native_window_fg_gl_on_resized_timer, win, 100);
}
return RET_OK;
}

View File

@ -40,6 +40,8 @@ ret_t native_window_fb_gl_set_make_current_func(native_window_t* win,
ret_t native_window_fb_gl_set_destroy_func(native_window_t* win, native_window_destroy_t destroy);
lcd_t* native_window_get_lcd(native_window_t* win);
END_C_DECLS
#endif /*TK_NATIVE_WINDOW_FB_GL_H*/

View File

@ -20,6 +20,7 @@
*/
#include "base/widget.h"
#include "base/window_manager.h"
#include "native_window/native_window_raw.h"
typedef struct _native_window_raw_t {
@ -36,13 +37,31 @@ static ret_t native_window_raw_move(native_window_t* win, xy_t x, xy_t y) {
return RET_OK;
}
static ret_t native_window_raw_resize(native_window_t* win, wh_t w, wh_t h) {
native_window_raw_t* raw = NATIVE_WINDOW_RAW(win);
lcd_t* lcd = raw->canvas.lcd;
static ret_t native_window_raw_on_resized_timer(const timer_info_t* info) {
widget_t* wm = window_manager();
native_window_t* win = NATIVE_WINDOW(info->ctx);
event_t e = event_init(EVT_NATIVE_WINDOW_RESIZED, NULL);
window_manager_dispatch_native_window_event(window_manager(), &e, win);
widget_set_need_relayout_children(wm);
widget_invalidate_force(wm, NULL);
if (lcd != NULL && lcd->resize != NULL) {
ret_t ret = lcd_resize(lcd, w, h, 0);
return_value_if_fail(ret != RET_OK, ret);
log_debug("on_resized_idle\n");
return RET_REMOVE;
}
static ret_t native_window_raw_resize(native_window_t* win, wh_t w, wh_t h) {
ret_t ret = RET_OK;
native_window_info_t info;
native_window_get_info(win, &info);
if (system_info()->lcd_orientation == LCD_ORIENTATION_0 && (w != info.w || h != info.h)) {
native_window_raw_t* raw = NATIVE_WINDOW_RAW(win);
ret = lcd_resize(raw->canvas.lcd, w, h, 0);
return_value_if_fail(ret == RET_OK, ret);
system_info_set_lcd_w(system_info(), w);
system_info_set_lcd_h(system_info(), h);
timer_add(native_window_raw_on_resized_timer, win, 100);
}
win->rect.w = w;
@ -58,13 +77,13 @@ static canvas_t* native_window_raw_get_canvas(native_window_t* win) {
}
static ret_t native_window_raw_get_info(native_window_t* win, native_window_info_t* info) {
native_window_raw_t* raw = NATIVE_WINDOW_RAW(win);
system_info_t* s_info = system_info();
info->x = 0;
info->y = 0;
info->ratio = raw->canvas.lcd->ratio;
info->w = lcd_get_width(raw->canvas.lcd);
info->h = lcd_get_height(raw->canvas.lcd);
info->w = s_info->lcd_w;
info->h = s_info->lcd_h;
win->ratio = info->ratio = s_info->device_pixel_ratio;
log_debug("ratio=%f %d %d\n", info->ratio, info->w, info->h);

View File

@ -78,6 +78,7 @@ static ret_t native_window_sdl_move(native_window_t* win, xy_t x, xy_t y) {
}
static ret_t native_window_sdl_resize(native_window_t* win, wh_t w, wh_t h) {
ret_t ret = RET_OK;
native_window_info_t info;
native_window_sdl_t* sdl = NATIVE_WINDOW_SDL(win);
@ -88,16 +89,19 @@ static ret_t native_window_sdl_resize(native_window_t* win, wh_t w, wh_t h) {
#if !defined(ANDROID) && !defined(IOS)
if (system_info()->lcd_orientation == LCD_ORIENTATION_0 && (w != info.w || h != info.h)) {
lcd_t* lcd = sdl->canvas.lcd;
#ifdef WIN32
w = w * win->ratio;
h = h * win->ratio;
#endif /*WIN32*/
SDL_SetWindowSize(sdl->window, w, h);
ret = lcd_resize(lcd, w, h, 0);
}
#endif /*ANDROID*/
return RET_OK;
return ret;
}
static ret_t native_window_sdl_minimize(native_window_t* win) {

View File

@ -1,4 +1,4 @@
/**
/**
* File: mutex.c
* Author: AWTK Develop Team
* Brief: mutex base on freertos

View File

@ -1,4 +1,4 @@
/**
/**
* File: rtos.c
* Author: AWTK Develop Team
* Brief: rtos for freertos

View File

@ -1,4 +1,4 @@
/**
/**
* File: semaphore.c
* Author: AWTK Develop Team
* Brief: semaphore base on freertos

View File

@ -1,4 +1,4 @@
/**
/**
* File: thread.c
* Author: AWTK Develop Team
* Brief: thread on freertos

View File

@ -1,4 +1,4 @@
/**
/**
* File: fps.h
* Author: AWTK Develop Team
* Brief: calculate fps

View File

@ -68,13 +68,13 @@ bool_t rect_has_intersect(const rect_t* r1, const rect_t* r2) {
return TRUE;
}
rect_t rect_init(xy_t x, xy_t y, wh_t w, wh_t h) {
rect_t r;
r.x = x;
r.y = y;
r.w = w;
r.h = h;
rectf_t rectf_init(float x, float y, float w, float h) {
rectf_t r = {x, y, w, h};
return r;
}
rect_t rect_init(xy_t x, xy_t y, wh_t w, wh_t h) {
rect_t r = {x, y, w, h};
return r;
}

View File

@ -68,6 +68,52 @@ typedef struct _pointf_t {
float_t y;
} pointf_t;
/**
* @class rectf_t
* @order -10
* @annotation ["scriptable"]
* x坐标y坐标
*/
typedef struct _rectf_t {
/**
* @property {float} x
* @annotation ["readable", "scriptable"]
* x坐标
*/
float x;
/**
* @property {float} y
* @annotation ["readable", "scriptable"]
* y坐标
*/
float y;
/**
* @property {float} w
* @annotation ["readable", "scriptable"]
*
*/
float w;
/**
* @property {float} h
* @annotation ["readable", "scriptable"]
*
*/
float h;
} rectf_t;
/**
* @method rectf_init
* rectf对象
*
* @param {float} x x坐标
* @param {float} y y坐标
* @param {float} w
* @param {float} h
*
* @return {rectf_t} rect对象
*/
rectf_t rectf_init(float x, float y, float w, float h);
/**
* @class rect_t
* @order -10

View File

@ -416,11 +416,10 @@ typedef struct _event_source_manager_t event_source_manager_t;
#endif /*TK_DEFAULT_WAIT_TIME*/
/*from cairo/cairo/cairoint.h*/
#if _XOPEN_SOURCE >= 600 || defined (_ISOC99_SOURCE)
#define TK_ISFINITE(x) isfinite (x)
#if _XOPEN_SOURCE >= 600 || defined(_ISOC99_SOURCE)
#define TK_ISFINITE(x) isfinite(x)
#else
#define TK_ISFINITE(x) ((x) * (x) >= 0.) /* check for NaNs */
#endif
#endif /*TYPES_DEF_H*/

View File

@ -672,17 +672,17 @@ static cairo_pattern_t* vgcanvas_cairo_create_pattern_from_gradient(const vg_gra
cairo_pattern_t* pattern = NULL;
if (gradient->type == VG_GRADIENT_LINEAR) {
vg_gradient_linear_info_t* info = &(gradient->info.linear);
const vg_gradient_linear_info_t* info = &(gradient->info.linear);
pattern = cairo_pattern_create_linear(info->sx, info->sy, info->ex, info->ey);
} else if (gradient->type == VG_GRADIENT_RADIAL) {
vg_gradient_radial_info_t* info = &(gradient->info.radial);
const vg_gradient_radial_info_t* info = &(gradient->info.radial);
pattern =
cairo_pattern_create_radial(info->x0, info->y0, info->r0, info->x1, info->y1, info->r1);
}
return_value_if_fail(pattern != NULL, NULL);
for (i = 0; i < gradient->nr; i++) {
vg_gradient_stop_t* iter = vg_gradient_get_stop(gradient, i);
const vg_gradient_stop_t* iter = vg_gradient_get_stop((vg_gradient_t*)gradient, i);
cairo_pattern_add_color_stop_color(pattern, iter->offset, iter->color);
}

View File

@ -236,7 +236,7 @@ static bool_t edit_is_valid_char_default(widget_t* widget, wchar_t c) {
break;
}
}
switch (edit->input_type) {
case INPUT_ASCII:
case INPUT_PHONE:

View File

@ -1,4 +1,4 @@
/**
/**
* File: window_manager_default.c
* Author: AWTK Develop Team
* Brief: default window manager
@ -1226,13 +1226,15 @@ static ret_t window_manager_default_layout_child(widget_t* widget, widget_t* win
}
static ret_t window_manager_default_resize(widget_t* widget, wh_t w, wh_t h) {
ret_t ret = RET_OK;
rect_t r = rect_init(0, 0, w, h);
window_manager_default_t* wm = WINDOW_MANAGER_DEFAULT(widget);
return_value_if_fail(wm != NULL, RET_BAD_PARAMS);
widget_move_resize(widget, 0, 0, w, h);
ret = native_window_resize(wm->native_window, w, h, TRUE);
return_value_if_fail(ret == RET_OK, ret);
native_window_resize(wm->native_window, w, h, TRUE);
widget_move_resize(widget, 0, 0, w, h);
native_window_invalidate(wm->native_window, &r);
native_window_update_last_dirty_rect(wm->native_window);
@ -1366,7 +1368,6 @@ static ret_t window_manager_default_native_window_resized(widget_t* widget, void
h = w;
}
native_window_on_resized(nw, w, h);
if (widget->w == w && widget->h == h) {
return RET_OK;
}

View File

@ -500,7 +500,6 @@ static ret_t window_manager_native_native_window_resized(widget_t* widget, void*
}
window_manager_simple_resize(widget, w, h);
native_window_on_resized(nw, w, h);
return RET_OK;
}

View File

@ -21,10 +21,10 @@ TEST(VGGradient, radial) {
ASSERT_EQ(vg_gradient_get_stop(g, 0)->offset, 0);
ASSERT_EQ(vg_gradient_get_stop(g, 0)->color.rgba.r, 0);
ASSERT_EQ(vg_gradient_get_stop(g, 1)->offset, 0.5);
ASSERT_EQ(vg_gradient_get_stop(g, 1)->color.rgba.r, 1);
ASSERT_EQ(vg_gradient_get_stop(g, 2)->offset, 1);
ASSERT_EQ(vg_gradient_get_stop(g, 2)->color.rgba.r, 2);
@ -40,12 +40,12 @@ TEST(VGGradient, linear) {
ASSERT_EQ(g->info.linear.ex, 30);
ASSERT_EQ(g->info.linear.ey, 40);
for(i = 0; i < TK_GRADIENT_MAX_STOP_NR; i++) {
for (i = 0; i < TK_GRADIENT_MAX_STOP_NR; i++) {
ASSERT_EQ(vg_gradient_add_stop(g, color_init(0, 0, 0, 0), 0.1 * i), RET_OK);
ASSERT_EQ(g->nr, i+1);
ASSERT_EQ((int)(vg_gradient_get_stop(g, i)->offset * 10), i );
ASSERT_EQ(g->nr, i + 1);
ASSERT_EQ((int)(vg_gradient_get_stop(g, i)->offset * 10), i);
}
ASSERT_NE(vg_gradient_add_stop(g, color_init(0, 0, 0, 0), 0.1 * i), RET_OK);
vg_gradient_destroy(g);