format code

This commit is contained in:
xianjimli 2020-02-11 17:46:48 +08:00
parent 64a840b953
commit ea72de2e53
8 changed files with 29 additions and 25 deletions

View File

@ -125,7 +125,8 @@ typedef ret_t (*vgcanvas_create_fbo_t)(vgcanvas_t* vg, framebuffer_object_t* fbo
typedef ret_t (*vgcanvas_destroy_fbo_t)(vgcanvas_t* vg, framebuffer_object_t* fbo); typedef ret_t (*vgcanvas_destroy_fbo_t)(vgcanvas_t* vg, framebuffer_object_t* fbo);
typedef ret_t (*vgcanvas_bind_fbo_t)(vgcanvas_t* vg, framebuffer_object_t* fbo); typedef ret_t (*vgcanvas_bind_fbo_t)(vgcanvas_t* vg, framebuffer_object_t* fbo);
typedef ret_t (*vgcanvas_unbind_fbo_t)(vgcanvas_t* vg, framebuffer_object_t* fbo); typedef ret_t (*vgcanvas_unbind_fbo_t)(vgcanvas_t* vg, framebuffer_object_t* fbo);
typedef ret_t (*vgcanvas_nanovg_fbo_to_bitmap_t)(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo, bitmap_t* img, rect_t* r); typedef ret_t (*vgcanvas_nanovg_fbo_to_bitmap_t)(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo,
bitmap_t* img, rect_t* r);
typedef ret_t (*vgcanvas_destroy_t)(vgcanvas_t* vg); typedef ret_t (*vgcanvas_destroy_t)(vgcanvas_t* vg);

View File

@ -3912,7 +3912,6 @@ bitmap_t* widget_take_snapshot_rect(widget_t* widget, rect_t* r) {
#elif defined(WITH_NANOVG_GPU) #elif defined(WITH_NANOVG_GPU)
bitmap_t* widget_take_snapshot_rect(widget_t* widget, rect_t* r) { bitmap_t* widget_take_snapshot_rect(widget_t* widget, rect_t* r) {
bitmap_t* img; bitmap_t* img;
uint32_t w = 0; uint32_t w = 0;
uint32_t h = 0; uint32_t h = 0;
@ -3920,9 +3919,10 @@ bitmap_t* widget_take_snapshot_rect(widget_t* widget, rect_t* r) {
vgcanvas_t* vg = NULL; vgcanvas_t* vg = NULL;
framebuffer_object_t fbo; framebuffer_object_t fbo;
native_window_t* native_window = (native_window_t*)widget_get_prop_pointer(window_manager(), WIDGET_PROP_NATIVE_WINDOW); native_window_t* native_window =
(native_window_t*)widget_get_prop_pointer(window_manager(), WIDGET_PROP_NATIVE_WINDOW);
return_value_if_fail(native_window != NULL, NULL); return_value_if_fail(native_window != NULL, NULL);
c = native_window_get_canvas(native_window); c = native_window_get_canvas(native_window);
vg = lcd_get_vgcanvas(c->lcd); vg = lcd_get_vgcanvas(c->lcd);
return_value_if_fail(c != NULL && vg != NULL, NULL); return_value_if_fail(c != NULL && vg != NULL, NULL);
@ -3933,7 +3933,7 @@ bitmap_t* widget_take_snapshot_rect(widget_t* widget, rect_t* r) {
widget_paint(widget, c); widget_paint(widget, c);
vgcanvas_unbind_fbo(vg, &fbo); vgcanvas_unbind_fbo(vg, &fbo);
if(r != NULL) { if (r != NULL) {
w = r->w; w = r->w;
h = r->h; h = r->h;
} else { } else {
@ -3945,7 +3945,7 @@ bitmap_t* widget_take_snapshot_rect(widget_t* widget, rect_t* r) {
vgcanvas_fbo_to_bitmap(vg, &fbo, img, r); vgcanvas_fbo_to_bitmap(vg, &fbo, img, r);
vgcanvas_destroy_fbo(vg, &fbo); vgcanvas_destroy_fbo(vg, &fbo);
return img; return img;
} }
@ -3962,7 +3962,7 @@ bitmap_t* widget_take_snapshot_rect(widget_t* widget, rect_t* r) {
bitmap_t* bitmap = NULL; bitmap_t* bitmap = NULL;
bitmap_t* bitmap_clip = NULL; bitmap_t* bitmap_clip = NULL;
return_value_if_fail(widget != NULL && widget->vt != NULL, NULL); return_value_if_fail(widget != NULL && widget->vt != NULL, NULL);
w = widget->w; w = widget->w;
h = widget->h; h = widget->h;
@ -3981,11 +3981,11 @@ bitmap_t* widget_take_snapshot_rect(widget_t* widget, rect_t* r) {
} }
bitmap_unlock_buffer(bitmap); bitmap_unlock_buffer(bitmap);
if(r != NULL) { if (r != NULL) {
bitmap_clip = bitmap_create_ex(r->w, r->h, r->w * 4, BITMAP_FMT_RGBA8888); bitmap_clip = bitmap_create_ex(r->w, r->h, r->w * 4, BITMAP_FMT_RGBA8888);
if(image_copy(bitmap_clip, bitmap, r, 0, 0) == RET_OK) { if (image_copy(bitmap_clip, bitmap, r, 0, 0) == RET_OK) {
bitmap_destroy(bitmap); bitmap_destroy(bitmap);
return bitmap_clip; return bitmap_clip;
} else { } else {

View File

@ -89,7 +89,8 @@ static ret_t vgcanvas_nanovg_unbind_fbo(vgcanvas_t* vgcanvas, framebuffer_object
return RET_OK; return RET_OK;
} }
static ret_t vgcanvas_nanovg_fbo_to_imageData(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo, bitmap_t* img, rect_t* r) { static ret_t vgcanvas_nanovg_fbo_to_imageData(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo,
bitmap_t* img, rect_t* r) {
return RET_NOT_IMPL; return RET_NOT_IMPL;
} }

View File

@ -204,7 +204,8 @@ static ret_t vgcanvas_nanovg_unbind_fbo(vgcanvas_t* vgcanvas, framebuffer_object
return RET_OK; return RET_OK;
} }
static ret_t vgcanvas_nanovg_fbo_to_bitmap(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo, bitmap_t* img, rect_t* r) { static ret_t vgcanvas_nanovg_fbo_to_bitmap(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo,
bitmap_t* img, rect_t* r) {
uint32_t x = 0; uint32_t x = 0;
uint32_t y = 0; uint32_t y = 0;
uint32_t height = 0; uint32_t height = 0;
@ -219,20 +220,21 @@ static ret_t vgcanvas_nanovg_fbo_to_bitmap(vgcanvas_t* vgcanvas, framebuffer_obj
data = TKMEM_ZALLOCN(uint8_t, img->h * img->line_length); data = TKMEM_ZALLOCN(uint8_t, img->h * img->line_length);
img_data = (uint8_t*)bitmap_lock_buffer_for_write(img); img_data = (uint8_t*)bitmap_lock_buffer_for_write(img);
height = fbo->h * fbo->ratio; height = fbo->h * fbo->ratio;
if(r != NULL) { if (r != NULL) {
x = r->x; x = r->x;
y = r->y; y = r->y;
} }
/* 因为 opengles 的原点坐标为左下角,所以需要把 AWTK 的坐标AWTK 是右上角为原点的坐标系)转换为左下角为原点的坐标系*/ /* 因为 opengles 的原点坐标为左下角,所以需要把 AWTK 的坐标AWTK 是右上角为原点的坐标系)转换为左下角为原点的坐标系*/
nvgluReadCurrentFramebufferData(x, height - img->h - y, img->w, img->h, fbo->w * fbo->ratio, height, data); nvgluReadCurrentFramebufferData(x, height - img->h - y, img->w, img->h, fbo->w * fbo->ratio,
height, data);
p = data + ((img->h - 1) * img->line_length); p = data + ((img->h - 1) * img->line_length);
/* 图像数据垂直翻转 */ /* 图像数据垂直翻转 */
while(TRUE) { while (TRUE) {
tk_memcpy32((uint32_t*)img_data, (uint32_t*)p, img->w); tk_memcpy32((uint32_t*)img_data, (uint32_t*)p, img->w);
if(p == data) { if (p == data) {
break; break;
} }
p -= img->line_length; p -= img->line_length;

View File

@ -49,7 +49,8 @@ static ret_t vgcanvas_nanovg_bind_fbo(vgcanvas_t* vgcanvas, framebuffer_object_t
return RET_NOT_IMPL; return RET_NOT_IMPL;
} }
static ret_t vgcanvas_nanovg_fbo_to_imageData(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo, bitmap_t* img, rect_t* r) { static ret_t vgcanvas_nanovg_fbo_to_imageData(vgcanvas_t* vgcanvas, framebuffer_object_t* fbo,
bitmap_t* img, rect_t* r) {
return RET_NOT_IMPL; return RET_NOT_IMPL;
} }

View File

@ -217,7 +217,7 @@ ret_t window_manager_default_snap_prev_window(widget_t* widget, widget_t* prev_w
widget_t* iter = children[start]; widget_t* iter = children[start];
if (widget_is_system_bar(iter) || !iter->visible) continue; if (widget_is_system_bar(iter) || !iter->visible) continue;
/* 过滤 curr_win 的对象 */ /* 过滤 curr_win 的对象 */
if(iter != wm->curr_win) { if (iter != wm->curr_win) {
ENSURE(widget_paint(iter, c) == RET_OK); ENSURE(widget_paint(iter, c) == RET_OK);
} }
} }
@ -240,7 +240,7 @@ ret_t window_manager_default_snap_prev_window(widget_t* widget, widget_t* prev_w
widget_t* iter = children[start]; widget_t* iter = children[start];
if (widget_is_system_bar(iter) || !iter->visible) continue; if (widget_is_system_bar(iter) || !iter->visible) continue;
/* 过滤 curr_win 的对象 */ /* 过滤 curr_win 的对象 */
if(iter != wm->curr_win) { if (iter != wm->curr_win) {
ENSURE(widget_paint(iter, c) == RET_OK); ENSURE(widget_paint(iter, c) == RET_OK);
} }
} }

View File

@ -57,9 +57,9 @@ typedef struct _window_manager_default_t {
uint32_t screen_saver_time; uint32_t screen_saver_time;
widget_t* prev_win; widget_t* prev_win;
/* for window_manager_default_snap_prev_window */ /* for window_manager_default_snap_prev_window */
widget_t* curr_win; widget_t* curr_win;
native_window_t* native_window; native_window_t* native_window;
dialog_highlighter_t* dialog_highlighter; dialog_highlighter_t* dialog_highlighter;

View File

@ -10,7 +10,6 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"crawler": "^1.2.1", "crawler": "^1.2.1",
"segment": "^0.1.3",
"url": "^0.11.0" "url": "^0.11.0"
} }
} }