fix hardware DC object creation issue in rtgui_dc_begin_drawing function.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@874 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong@gmail.com 2010-08-22 13:12:22 +00:00
parent ffc3f02fca
commit 54089722c3
4 changed files with 16 additions and 1 deletions

View File

@ -42,7 +42,8 @@ static void rtgui_dc_client_get_rect(struct rtgui_dc* dc, rtgui_rect_t* rect);
struct rtgui_dc* rtgui_dc_begin_drawing(rtgui_widget_t* owner)
{
if (rtgui_region_is_flat(&owner->clip) == RT_EOK)
if ((rtgui_region_is_flat(&owner->clip) == RT_EOK) &&
rtgui_rect_is_equal(&(owner->extent), &(owner->clip.extents)) == RT_EOK)
{
/* use hardware DC */
return rtgui_dc_hw_create(owner);

View File

@ -1,3 +1,4 @@
#ifdef RTGUI_USING_TTF
#include <rtgui/dc.h>
#include <rtgui/font.h>
#include <rtgui/tree.h>
@ -199,3 +200,4 @@ void rtgui_freetype_font_destroy(rtgui_font_t* font)
rtgui_free(freetype);
rtgui_free(font);
}
#endif

View File

@ -2239,3 +2239,14 @@ int rtgui_rect_is_intersect(const rtgui_rect_t *rect1, const rtgui_rect_t *rect2
return -RT_ERROR;
}
int rtgui_rect_is_equal(const rtgui_rect_t *rect1, const rtgui_rect_t *rect2)
{
if (*((rt_uint32_t*)(rect1)) == *((rt_uint32_t*)(rect2)) &&
*(((rt_uint32_t*)(rect1)) + 1) == *(((rt_uint32_t*)(rect2)) + 1))
{
return RT_EOK;
}
return -RT_ERROR;
}

View File

@ -93,6 +93,7 @@ void rtgui_rect_inflate(rtgui_rect_t *rect, int d);
void rtgui_rect_intersect(rtgui_rect_t *src, rtgui_rect_t *dest);
int rtgui_rect_contains_point(const rtgui_rect_t *rect, int x, int y);
int rtgui_rect_is_intersect(const rtgui_rect_t *rect1, const rtgui_rect_t *rect2);
int rtgui_rect_is_equal(const rtgui_rect_t *rect1, const rtgui_rect_t *rect2);
#if defined(__cplusplus) || defined(c_plusplus)
}