fixed a compiling error and change tabs to spaces
demo_view_benchmark.c:125:18: error: static declaration of '_benchmark_onshow' follows non-static declaration demo_view_benchmark.c:87:9: note: previous implicit declaration of '_benchmark_onshow' was here git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2277 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
9707b6ce0b
commit
fcfdd06bab
|
@ -12,6 +12,13 @@ static int running = 0;
|
||||||
static rt_tick_t ticks;
|
static rt_tick_t ticks;
|
||||||
static long long area;
|
static long long area;
|
||||||
|
|
||||||
|
static rt_bool_t _benchmark_onshow(struct rtgui_object *obj, struct rtgui_event *ev)
|
||||||
|
{
|
||||||
|
rtgui_widget_focus(RTGUI_WIDGET(obj));
|
||||||
|
|
||||||
|
return RT_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
void _onidle(struct rtgui_object *object, rtgui_event_t *event)
|
void _onidle(struct rtgui_object *object, rtgui_event_t *event)
|
||||||
{
|
{
|
||||||
rtgui_color_t color;
|
rtgui_color_t color;
|
||||||
|
@ -29,7 +36,7 @@ void _onidle(struct rtgui_object *object, rtgui_event_t *event)
|
||||||
draw_rect.y1 = RAND(rect.y1, rect.y2);
|
draw_rect.y1 = RAND(rect.y1, rect.y2);
|
||||||
draw_rect.x2 = RAND(draw_rect.x1, rect.x2);
|
draw_rect.x2 = RAND(draw_rect.x1, rect.x2);
|
||||||
draw_rect.y2 = RAND(draw_rect.y1, rect.y2);
|
draw_rect.y2 = RAND(draw_rect.y1, rect.y2);
|
||||||
area += rtgui_rect_width(draw_rect) * rtgui_rect_height(draw_rect);
|
area += rtgui_rect_width(draw_rect) * rtgui_rect_height(draw_rect);
|
||||||
color = RTGUI_RGB(rand() % 255, rand() % 255, rand() % 255);
|
color = RTGUI_RGB(rand() % 255, rand() % 255, rand() % 255);
|
||||||
RTGUI_WIDGET_BACKGROUND(container) = color;
|
RTGUI_WIDGET_BACKGROUND(container) = color;
|
||||||
|
|
||||||
|
@ -37,14 +44,14 @@ void _onidle(struct rtgui_object *object, rtgui_event_t *event)
|
||||||
|
|
||||||
/* »æͼÍê³É */
|
/* »æͼÍê³É */
|
||||||
rtgui_dc_end_drawing(dc);
|
rtgui_dc_end_drawing(dc);
|
||||||
if(rt_tick_get()-ticks >= RT_TICK_PER_SECOND)
|
if(rt_tick_get()-ticks >= RT_TICK_PER_SECOND)
|
||||||
{
|
{
|
||||||
char buf[16];
|
char buf[16];
|
||||||
sprintf(buf, "%.2f", (double)area/(800*480));
|
sprintf(buf, "%.2f", (double)area/(800*480));
|
||||||
rt_kprintf("frames per second: %s fps\n", buf);
|
rt_kprintf("frames per second: %s fps\n", buf);
|
||||||
area = 0;
|
area = 0;
|
||||||
ticks = rt_tick_get();
|
ticks = rt_tick_get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _draw_default(struct rtgui_object *object, rtgui_event_t *event)
|
void _draw_default(struct rtgui_object *object, rtgui_event_t *event)
|
||||||
|
@ -104,13 +111,14 @@ rt_bool_t benchmark_event_handler(struct rtgui_object *object, rtgui_event_t *ev
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* run */
|
/* run */
|
||||||
ticks = rt_tick_get();
|
ticks = rt_tick_get();
|
||||||
area = 0;
|
area = 0;
|
||||||
rtgui_app_set_onidle(_onidle);
|
rtgui_app_set_onidle(_onidle);
|
||||||
}
|
}
|
||||||
|
|
||||||
running = !running;
|
running = !running;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RT_TRUE;
|
return RT_TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -122,12 +130,6 @@ rt_bool_t benchmark_event_handler(struct rtgui_object *object, rtgui_event_t *ev
|
||||||
return RT_FALSE;
|
return RT_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static rt_bool_t _benchmark_onshow(struct rtgui_object *obj, struct rtgui_event *ev)
|
|
||||||
{
|
|
||||||
rtgui_widget_focus(RTGUI_WIDGET(obj));
|
|
||||||
return RT_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
rtgui_container_t *demo_view_benchmark(void)
|
rtgui_container_t *demo_view_benchmark(void)
|
||||||
{
|
{
|
||||||
srand(100);
|
srand(100);
|
||||||
|
|
Loading…
Reference in New Issue