2009-10-16 08:03:50 +08:00
|
|
|
/*
|
|
|
|
* File : dc_hw.c
|
|
|
|
* This file is part of RT-Thread RTOS
|
|
|
|
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
|
|
|
|
*
|
|
|
|
* The license and distribution terms for this file may be
|
|
|
|
* found in the file LICENSE in this distribution or at
|
|
|
|
* http://www.rt-thread.org/license/LICENSE
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2009-10-16 Bernard first version
|
|
|
|
*/
|
|
|
|
#include <rtgui/dc.h>
|
2010-04-10 18:06:35 +08:00
|
|
|
#include <rtgui/dc_hw.h>
|
2009-10-16 08:03:50 +08:00
|
|
|
#include <rtgui/driver.h>
|
2009-11-24 07:34:58 +08:00
|
|
|
#include <rtgui/rtgui_system.h>
|
2009-10-16 08:03:50 +08:00
|
|
|
#include <rtgui/widgets/view.h>
|
|
|
|
#include <rtgui/widgets/window.h>
|
|
|
|
#include <rtgui/widgets/workbench.h>
|
|
|
|
#include <rtgui/widgets/title.h>
|
|
|
|
|
|
|
|
static void rtgui_dc_hw_draw_point(struct rtgui_dc* dc, int x, int y);
|
2010-04-12 07:57:21 +08:00
|
|
|
static void rtgui_dc_hw_draw_color_point(struct rtgui_dc* dc, int x, int y, rtgui_color_t color);
|
2009-10-16 08:03:50 +08:00
|
|
|
static void rtgui_dc_hw_draw_hline(struct rtgui_dc* dc, int x1, int x2, int y);
|
|
|
|
static void rtgui_dc_hw_draw_vline(struct rtgui_dc* dc, int x, int y1, int y2);
|
|
|
|
static void rtgui_dc_hw_fill_rect (struct rtgui_dc* dc, rtgui_rect_t* rect);
|
2010-08-17 19:33:18 +08:00
|
|
|
static void rtgui_dc_hw_blit_line (struct rtgui_dc* self, int x1, int x2, int y, rt_uint8_t* line_data);
|
2009-10-16 08:03:50 +08:00
|
|
|
static void rtgui_dc_hw_blit (struct rtgui_dc* dc, struct rtgui_point* dc_point, struct rtgui_dc* dest, rtgui_rect_t* rect);
|
2010-04-12 07:57:21 +08:00
|
|
|
static void rtgui_dc_hw_set_gc (struct rtgui_dc* dc, rtgui_gc_t *gc);
|
|
|
|
static rtgui_gc_t *rtgui_dc_hw_get_gc (struct rtgui_dc* dc);
|
2009-10-16 08:03:50 +08:00
|
|
|
static rt_bool_t rtgui_dc_hw_fini(struct rtgui_dc* dc);
|
|
|
|
static rt_bool_t rtgui_dc_hw_get_visible(struct rtgui_dc* dc);
|
|
|
|
static void rtgui_dc_hw_get_rect(struct rtgui_dc* dc, rtgui_rect_t* rect);
|
|
|
|
|
2010-08-16 08:02:31 +08:00
|
|
|
struct rtgui_dc_hw
|
|
|
|
{
|
|
|
|
struct rtgui_dc parent;
|
|
|
|
rtgui_widget_t *owner;
|
|
|
|
const struct rtgui_graphic_driver* hw_driver;
|
|
|
|
};
|
2010-07-05 07:58:35 +08:00
|
|
|
|
|
|
|
const struct rtgui_dc_engine dc_hw_engine =
|
2009-10-16 08:03:50 +08:00
|
|
|
{
|
2010-06-01 08:07:59 +08:00
|
|
|
rtgui_dc_hw_draw_point,
|
|
|
|
rtgui_dc_hw_draw_color_point,
|
|
|
|
rtgui_dc_hw_draw_vline,
|
|
|
|
rtgui_dc_hw_draw_hline,
|
|
|
|
rtgui_dc_hw_fill_rect,
|
2010-08-17 19:33:18 +08:00
|
|
|
rtgui_dc_hw_blit_line,
|
2010-06-01 08:07:59 +08:00
|
|
|
rtgui_dc_hw_blit,
|
2009-10-16 08:03:50 +08:00
|
|
|
|
2010-06-01 08:07:59 +08:00
|
|
|
rtgui_dc_hw_set_gc,
|
|
|
|
rtgui_dc_hw_get_gc,
|
2009-10-16 08:03:50 +08:00
|
|
|
|
2010-06-01 08:07:59 +08:00
|
|
|
rtgui_dc_hw_get_visible,
|
|
|
|
rtgui_dc_hw_get_rect,
|
2009-10-16 08:03:50 +08:00
|
|
|
|
2010-06-01 08:07:59 +08:00
|
|
|
rtgui_dc_hw_fini,
|
|
|
|
};
|
2009-10-16 08:03:50 +08:00
|
|
|
|
|
|
|
extern struct rt_mutex cursor_mutex;
|
|
|
|
extern void rtgui_mouse_show_cursor(void);
|
|
|
|
extern void rtgui_mouse_hide_cursor(void);
|
|
|
|
struct rtgui_dc* rtgui_dc_hw_create(rtgui_widget_t* owner)
|
|
|
|
{
|
2010-08-16 08:02:31 +08:00
|
|
|
struct rtgui_dc_hw* dc;
|
2009-10-16 08:03:50 +08:00
|
|
|
rtgui_widget_t* widget;
|
|
|
|
|
|
|
|
/* adjudge owner */
|
|
|
|
if (owner == RT_NULL || owner->toplevel == RT_NULL) return RT_NULL;
|
|
|
|
if (!RTGUI_IS_TOPLEVEL(owner->toplevel)) return RT_NULL;
|
|
|
|
|
2010-07-05 07:58:35 +08:00
|
|
|
/* set init visible as true */
|
|
|
|
RTGUI_WIDGET_DC_SET_VISIBLE(owner);
|
2009-10-16 08:03:50 +08:00
|
|
|
|
2010-07-05 07:58:35 +08:00
|
|
|
/* check widget visible */
|
2009-10-16 08:03:50 +08:00
|
|
|
widget = owner;
|
|
|
|
while (widget != RT_NULL)
|
|
|
|
{
|
|
|
|
if (RTGUI_WIDGET_IS_HIDE(widget))
|
|
|
|
{
|
2010-07-05 07:58:35 +08:00
|
|
|
RTGUI_WIDGET_DC_SET_UNVISIBLE(owner);
|
2009-10-16 08:03:50 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
widget = widget->parent;
|
|
|
|
}
|
|
|
|
|
2010-08-16 08:02:31 +08:00
|
|
|
if (!RTGUI_WIDGET_IS_DC_VISIBLE(owner)) return RT_NULL;
|
|
|
|
|
|
|
|
/* create DC */
|
|
|
|
dc = (struct rtgui_dc_hw*) rtgui_malloc(sizeof(struct rtgui_dc_hw));
|
|
|
|
dc->parent.type = RTGUI_DC_HW;
|
|
|
|
dc->parent.engine = &dc_hw_engine;
|
|
|
|
dc->owner = owner;
|
|
|
|
dc->hw_driver = rtgui_graphic_driver_get_default();
|
|
|
|
|
2010-07-05 07:58:35 +08:00
|
|
|
if (RTGUI_IS_WINTITLE(owner->toplevel))
|
2009-10-16 08:03:50 +08:00
|
|
|
{
|
2010-07-05 07:58:35 +08:00
|
|
|
rtgui_toplevel_t* top = RTGUI_TOPLEVEL(owner->toplevel);
|
2009-10-16 08:03:50 +08:00
|
|
|
top->drawing ++;
|
|
|
|
|
|
|
|
if (top->drawing == 1)
|
|
|
|
{
|
|
|
|
#ifdef RTGUI_USING_MOUSE_CURSOR
|
|
|
|
#ifdef __WIN32__
|
|
|
|
rt_mutex_take(&cursor_mutex, RT_WAITING_FOREVER);
|
|
|
|
rt_kprintf("hide cursor\n");
|
|
|
|
rtgui_mouse_hide_cursor();
|
|
|
|
#else
|
|
|
|
/* hide cursor */
|
|
|
|
rtgui_mouse_hide_cursor();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
2010-07-05 07:58:35 +08:00
|
|
|
else if (RTGUI_IS_WORKBENCH(owner->toplevel) ||
|
|
|
|
RTGUI_IS_WIN(owner->toplevel))
|
2009-10-16 08:03:50 +08:00
|
|
|
{
|
2010-07-05 07:58:35 +08:00
|
|
|
rtgui_toplevel_t* top = RTGUI_TOPLEVEL(owner->toplevel);
|
2009-10-16 08:03:50 +08:00
|
|
|
top->drawing ++;
|
|
|
|
|
|
|
|
if (top->drawing == 1)
|
|
|
|
{
|
|
|
|
#ifdef __WIN32__
|
|
|
|
#ifdef RTGUI_USING_MOUSE_CURSOR
|
|
|
|
rt_mutex_take(&cursor_mutex, RT_WAITING_FOREVER);
|
|
|
|
rt_kprintf("hide cursor\n");
|
|
|
|
rtgui_mouse_hide_cursor();
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
/* send draw begin to server */
|
|
|
|
struct rtgui_event_update_begin eupdate;
|
|
|
|
RTGUI_EVENT_UPDATE_BEGIN_INIT(&(eupdate));
|
|
|
|
eupdate.rect = RTGUI_WIDGET(top)->extent;
|
|
|
|
|
|
|
|
rtgui_thread_send(top->server, (struct rtgui_event*)&eupdate, sizeof(eupdate));
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-16 08:02:31 +08:00
|
|
|
return &(dc->parent);
|
2009-10-16 08:03:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static rt_bool_t rtgui_dc_hw_fini(struct rtgui_dc* dc)
|
|
|
|
{
|
2010-07-05 07:58:35 +08:00
|
|
|
rtgui_widget_t* owner;
|
2010-08-16 08:02:31 +08:00
|
|
|
struct rtgui_dc_hw* self;
|
|
|
|
|
2010-07-05 07:58:35 +08:00
|
|
|
if (dc == RT_NULL || dc->type != RTGUI_DC_HW) return RT_FALSE;
|
|
|
|
|
2010-08-16 08:02:31 +08:00
|
|
|
self = (struct rtgui_dc_hw*)dc;
|
2010-07-05 07:58:35 +08:00
|
|
|
/* get owner */
|
2010-08-16 08:02:31 +08:00
|
|
|
owner = self->owner;
|
2009-10-16 08:03:50 +08:00
|
|
|
|
2010-07-05 07:58:35 +08:00
|
|
|
if (RTGUI_IS_WINTITLE(owner->toplevel))
|
2009-10-16 08:03:50 +08:00
|
|
|
{
|
|
|
|
/* update title extent */
|
2010-07-05 07:58:35 +08:00
|
|
|
rtgui_toplevel_t* top = RTGUI_TOPLEVEL(owner->toplevel);
|
2009-10-16 08:03:50 +08:00
|
|
|
|
|
|
|
top->drawing --;
|
2010-07-05 07:58:35 +08:00
|
|
|
if ((top->drawing == 0) && RTGUI_WIDGET_IS_DC_VISIBLE(owner))
|
2009-10-16 08:03:50 +08:00
|
|
|
{
|
|
|
|
#ifdef __WIN32__
|
|
|
|
#ifdef RTGUI_USING_MOUSE_CURSOR
|
|
|
|
rt_mutex_release(&cursor_mutex);
|
|
|
|
/* show cursor */
|
|
|
|
rtgui_mouse_show_cursor();
|
|
|
|
rt_kprintf("show cursor\n");
|
|
|
|
#endif
|
|
|
|
/* update screen */
|
2011-06-05 23:16:41 +08:00
|
|
|
rtgui_graphic_driver_screen_update(self->hw_driver, &(owner->extent));
|
2009-10-16 08:03:50 +08:00
|
|
|
#else
|
|
|
|
#ifdef RTGUI_USING_MOUSE_CURSOR
|
|
|
|
/* show cursor */
|
|
|
|
rtgui_mouse_show_cursor();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* update screen */
|
2011-06-05 23:16:41 +08:00
|
|
|
rtgui_graphic_driver_screen_update(self->hw_driver, &(owner->extent));
|
2009-10-16 08:03:50 +08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
2010-07-05 07:58:35 +08:00
|
|
|
else if (RTGUI_IS_WORKBENCH(owner->toplevel) ||
|
|
|
|
RTGUI_IS_WIN(owner->toplevel))
|
2009-10-16 08:03:50 +08:00
|
|
|
{
|
2010-07-05 07:58:35 +08:00
|
|
|
rtgui_toplevel_t* top = RTGUI_TOPLEVEL(owner->toplevel);
|
2009-10-16 08:03:50 +08:00
|
|
|
top->drawing --;
|
|
|
|
|
2010-07-05 07:58:35 +08:00
|
|
|
if ((top->drawing == 0) && RTGUI_WIDGET_IS_DC_VISIBLE(owner))
|
2009-10-16 08:03:50 +08:00
|
|
|
{
|
|
|
|
#ifdef __WIN32__
|
|
|
|
#ifdef RTGUI_USING_MOUSE_CURSOR
|
|
|
|
rt_mutex_release(&cursor_mutex);
|
|
|
|
/* show cursor */
|
|
|
|
rtgui_mouse_show_cursor();
|
|
|
|
rt_kprintf("show cursor\n");
|
|
|
|
#endif
|
|
|
|
/* update screen */
|
2011-06-05 23:16:41 +08:00
|
|
|
rtgui_graphic_driver_screen_update(self->hw_driver, &(owner->extent));
|
2009-10-16 08:03:50 +08:00
|
|
|
#else
|
|
|
|
/* send to server to end drawing */
|
|
|
|
struct rtgui_event_update_end eupdate;
|
|
|
|
RTGUI_EVENT_UPDATE_END_INIT(&(eupdate));
|
2010-07-05 07:58:35 +08:00
|
|
|
eupdate.rect = owner->extent;
|
2009-10-16 08:03:50 +08:00
|
|
|
|
|
|
|
rtgui_thread_send(top->server, (struct rtgui_event*)&eupdate, sizeof(eupdate));
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-16 08:02:31 +08:00
|
|
|
/* release hardware dc */
|
|
|
|
rtgui_free(self);
|
|
|
|
|
2009-10-16 08:03:50 +08:00
|
|
|
return RT_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* draw a logic point on device
|
|
|
|
*/
|
|
|
|
static void rtgui_dc_hw_draw_point(struct rtgui_dc* self, int x, int y)
|
|
|
|
{
|
2010-08-16 08:02:31 +08:00
|
|
|
struct rtgui_dc_hw* dc;
|
2009-10-16 08:03:50 +08:00
|
|
|
|
2010-08-16 08:02:31 +08:00
|
|
|
RT_ASSERT(self != RT_NULL);
|
|
|
|
dc = (struct rtgui_dc_hw*) self;
|
2009-10-16 08:03:50 +08:00
|
|
|
|
2010-08-16 08:02:31 +08:00
|
|
|
x = x + dc->owner->extent.x1;
|
2011-08-22 11:31:29 +08:00
|
|
|
if(x < dc->owner->extent.x1 || x >= dc->owner->extent.x2) return;
|
2010-08-16 08:02:31 +08:00
|
|
|
y = y + dc->owner->extent.y1;
|
2011-08-22 11:31:29 +08:00
|
|
|
if(y < dc->owner->extent.y1 || y >= dc->owner->extent.y2) return;
|
2010-07-05 07:58:35 +08:00
|
|
|
|
2010-08-13 18:36:36 +08:00
|
|
|
/* draw this point */
|
2011-06-05 23:16:41 +08:00
|
|
|
dc->hw_driver->ops->set_pixel(&(dc->owner->gc.foreground), x, y);
|
2009-10-16 08:03:50 +08:00
|
|
|
}
|
|
|
|
|
2010-04-12 07:57:21 +08:00
|
|
|
static void rtgui_dc_hw_draw_color_point(struct rtgui_dc* self, int x, int y, rtgui_color_t color)
|
|
|
|
{
|
2010-08-16 08:02:31 +08:00
|
|
|
struct rtgui_dc_hw* dc;
|
2010-04-12 07:57:21 +08:00
|
|
|
|
2010-08-16 08:02:31 +08:00
|
|
|
RT_ASSERT(self != RT_NULL);
|
|
|
|
dc = (struct rtgui_dc_hw*) self;
|
2010-04-12 07:57:21 +08:00
|
|
|
|
2010-08-16 08:02:31 +08:00
|
|
|
x = x + dc->owner->extent.x1;
|
|
|
|
y = y + dc->owner->extent.y1;
|
2010-04-12 07:57:21 +08:00
|
|
|
|
2010-08-13 18:36:36 +08:00
|
|
|
/* draw this point */
|
2011-06-05 23:16:41 +08:00
|
|
|
dc->hw_driver->ops->set_pixel(&color, x, y);
|
2010-04-12 07:57:21 +08:00
|
|
|
}
|
|
|
|
|
2009-10-16 08:03:50 +08:00
|
|
|
/*
|
|
|
|
* draw a logic vertical line on device
|
|
|
|
*/
|
|
|
|
static void rtgui_dc_hw_draw_vline(struct rtgui_dc* self, int x, int y1, int y2)
|
|
|
|
{
|
2010-08-16 08:02:31 +08:00
|
|
|
struct rtgui_dc_hw* dc;
|
2009-10-16 08:03:50 +08:00
|
|
|
|
2010-08-16 08:02:31 +08:00
|
|
|
RT_ASSERT(self != RT_NULL);
|
|
|
|
dc = (struct rtgui_dc_hw*) self;
|
2009-10-16 08:03:50 +08:00
|
|
|
|
2010-08-16 08:02:31 +08:00
|
|
|
x = x + dc->owner->extent.x1;
|
|
|
|
y1 = y1 + dc->owner->extent.y1;
|
|
|
|
y2 = y2 + dc->owner->extent.y1;
|
2009-10-16 08:03:50 +08:00
|
|
|
|
2010-08-13 18:36:36 +08:00
|
|
|
/* draw vline */
|
2011-06-05 23:16:41 +08:00
|
|
|
dc->hw_driver->ops->draw_vline(&(dc->owner->gc.foreground), x, y1, y2);
|
2009-10-16 08:03:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* draw a logic horizontal line on device
|
|
|
|
*/
|
|
|
|
static void rtgui_dc_hw_draw_hline(struct rtgui_dc* self, int x1, int x2, int y)
|
|
|
|
{
|
2010-08-16 08:02:31 +08:00
|
|
|
struct rtgui_dc_hw* dc;
|
2009-10-16 08:03:50 +08:00
|
|
|
|
2010-08-16 08:02:31 +08:00
|
|
|
RT_ASSERT(self != RT_NULL);
|
|
|
|
dc = (struct rtgui_dc_hw*) self;
|
2009-10-16 08:03:50 +08:00
|
|
|
|
|
|
|
/* convert logic to device */
|
2010-08-16 08:02:31 +08:00
|
|
|
x1 = x1 + dc->owner->extent.x1;
|
|
|
|
x2 = x2 + dc->owner->extent.x1;
|
|
|
|
y = y + dc->owner->extent.y1;
|
2009-10-16 08:03:50 +08:00
|
|
|
|
2010-08-13 18:36:36 +08:00
|
|
|
/* draw hline */
|
2011-06-05 23:16:41 +08:00
|
|
|
dc->hw_driver->ops->draw_hline(&(dc->owner->gc.foreground), x1, x2, y);
|
2009-10-16 08:03:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rtgui_dc_hw_fill_rect (struct rtgui_dc* self, struct rtgui_rect* rect)
|
|
|
|
{
|
2010-08-13 18:36:36 +08:00
|
|
|
rtgui_color_t color;
|
|
|
|
register rt_base_t index, x1, x2;
|
2010-08-16 08:02:31 +08:00
|
|
|
struct rtgui_dc_hw* dc;
|
2009-10-16 08:03:50 +08:00
|
|
|
|
2010-08-16 08:02:31 +08:00
|
|
|
RT_ASSERT(self != RT_NULL);
|
|
|
|
dc = (struct rtgui_dc_hw*) self;
|
2009-10-16 08:03:50 +08:00
|
|
|
|
2010-08-13 18:36:36 +08:00
|
|
|
/* get background color */
|
2010-08-16 08:02:31 +08:00
|
|
|
color = dc->owner->gc.background;
|
2010-08-13 18:36:36 +08:00
|
|
|
/* convert logic to device */
|
2010-08-16 08:02:31 +08:00
|
|
|
x1 = rect->x1 + dc->owner->extent.x1;
|
|
|
|
x2 = rect->x2 + dc->owner->extent.x1;
|
2009-10-16 08:03:50 +08:00
|
|
|
|
|
|
|
/* fill rect */
|
2010-08-16 08:02:31 +08:00
|
|
|
for (index = dc->owner->extent.y1 + rect->y1; index < dc->owner->extent.y1 + rect->y2; index ++)
|
2009-10-16 08:03:50 +08:00
|
|
|
{
|
2011-06-05 23:16:41 +08:00
|
|
|
dc->hw_driver->ops->draw_hline(&color, x1, x2, index);
|
2009-10-16 08:03:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-17 19:33:18 +08:00
|
|
|
static void rtgui_dc_hw_blit_line (struct rtgui_dc* self, int x1, int x2, int y, rt_uint8_t* line_data)
|
|
|
|
{
|
|
|
|
struct rtgui_dc_hw* dc;
|
|
|
|
|
|
|
|
RT_ASSERT(self != RT_NULL);
|
|
|
|
dc = (struct rtgui_dc_hw*) self;
|
|
|
|
|
|
|
|
/* convert logic to device */
|
|
|
|
x1 = x1 + dc->owner->extent.x1;
|
|
|
|
x2 = x2 + dc->owner->extent.x1;
|
|
|
|
y = y + dc->owner->extent.y1;
|
|
|
|
|
2011-06-05 23:16:41 +08:00
|
|
|
dc->hw_driver->ops->draw_raw_hline(line_data, x1, x2, y);
|
2010-08-17 19:33:18 +08:00
|
|
|
}
|
|
|
|
|
2009-10-16 08:03:50 +08:00
|
|
|
static void rtgui_dc_hw_blit(struct rtgui_dc* dc, struct rtgui_point* dc_point, struct rtgui_dc* dest, rtgui_rect_t* rect)
|
|
|
|
{
|
|
|
|
/* not blit in hardware dc */
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
2010-04-12 07:57:21 +08:00
|
|
|
static void rtgui_dc_hw_set_gc(struct rtgui_dc* self, rtgui_gc_t *gc)
|
2009-10-16 08:03:50 +08:00
|
|
|
{
|
2010-08-16 08:02:31 +08:00
|
|
|
struct rtgui_dc_hw* dc;
|
2009-10-16 08:03:50 +08:00
|
|
|
|
2010-08-16 08:02:31 +08:00
|
|
|
RT_ASSERT(self != RT_NULL);
|
|
|
|
dc = (struct rtgui_dc_hw*) self;
|
|
|
|
|
|
|
|
/* set gc */
|
|
|
|
dc->owner->gc = *gc;
|
2009-10-16 08:03:50 +08:00
|
|
|
}
|
|
|
|
|
2010-04-12 07:57:21 +08:00
|
|
|
static rtgui_gc_t* rtgui_dc_hw_get_gc(struct rtgui_dc* self)
|
2009-10-16 08:03:50 +08:00
|
|
|
{
|
2010-08-16 08:02:31 +08:00
|
|
|
struct rtgui_dc_hw* dc;
|
2009-10-16 08:03:50 +08:00
|
|
|
|
2010-08-16 08:02:31 +08:00
|
|
|
RT_ASSERT(self != RT_NULL);
|
|
|
|
dc = (struct rtgui_dc_hw*) self;
|
2010-07-05 07:58:35 +08:00
|
|
|
|
2010-08-16 08:02:31 +08:00
|
|
|
return &(dc->owner->gc);
|
2009-10-16 08:03:50 +08:00
|
|
|
}
|
|
|
|
|
2010-02-17 18:45:16 +08:00
|
|
|
static rt_bool_t rtgui_dc_hw_get_visible(struct rtgui_dc* self)
|
2009-10-16 08:03:50 +08:00
|
|
|
{
|
2010-08-16 08:02:31 +08:00
|
|
|
struct rtgui_dc_hw* dc;
|
2010-07-05 07:58:35 +08:00
|
|
|
|
2010-08-16 08:02:31 +08:00
|
|
|
RT_ASSERT(self != RT_NULL);
|
|
|
|
dc = (struct rtgui_dc_hw*) self;
|
|
|
|
|
|
|
|
if (!RTGUI_WIDGET_IS_DC_VISIBLE(dc->owner)) return RT_FALSE;
|
2010-02-17 18:45:16 +08:00
|
|
|
|
2010-07-05 07:58:35 +08:00
|
|
|
return RT_TRUE;
|
2009-10-16 08:03:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void rtgui_dc_hw_get_rect(struct rtgui_dc* self, rtgui_rect_t* rect)
|
|
|
|
{
|
2010-08-16 08:02:31 +08:00
|
|
|
struct rtgui_dc_hw* dc;
|
|
|
|
|
|
|
|
RT_ASSERT(self != RT_NULL);
|
|
|
|
dc = (struct rtgui_dc_hw*) self;
|
2009-10-16 08:03:50 +08:00
|
|
|
|
2010-07-05 07:58:35 +08:00
|
|
|
/* get owner */
|
2010-08-16 08:02:31 +08:00
|
|
|
rtgui_widget_get_rect(dc->owner, rect);
|
2009-10-16 08:03:50 +08:00
|
|
|
}
|