summaryrefslogtreecommitdiff
path: root/components/rtgui
diff options
context:
space:
mode:
author[email protected] <[email protected]>2010-08-22 13:12:22 +0000
committer[email protected] <[email protected]>2010-08-22 13:12:22 +0000
commit54089722c3cb29539e2706f01db5162316eb6542 (patch)
tree593b6542e7ff51e2496098a0d29adaa17a872044 /components/rtgui
parentffc3f02fca1443375eb64a2a7e398aa0929bb8ea (diff)
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
Diffstat (limited to 'components/rtgui')
-rw-r--r--components/rtgui/common/dc_client.c3
-rw-r--r--components/rtgui/common/font_freetype.c2
-rw-r--r--components/rtgui/common/region.c11
-rw-r--r--components/rtgui/include/rtgui/region.h1
4 files changed, 16 insertions, 1 deletions
diff --git a/components/rtgui/common/dc_client.c b/components/rtgui/common/dc_client.c
index 2fa527069e..6dcf3181c0 100644
--- a/components/rtgui/common/dc_client.c
+++ b/components/rtgui/common/dc_client.c
@@ -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);
diff --git a/components/rtgui/common/font_freetype.c b/components/rtgui/common/font_freetype.c
index 906e986227..48db47d7c6 100644
--- a/components/rtgui/common/font_freetype.c
+++ b/components/rtgui/common/font_freetype.c
@@ -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
diff --git a/components/rtgui/common/region.c b/components/rtgui/common/region.c
index 9fee345e1f..bcb8bacb2e 100644
--- a/components/rtgui/common/region.c
+++ b/components/rtgui/common/region.c
@@ -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;
+}
diff --git a/components/rtgui/include/rtgui/region.h b/components/rtgui/include/rtgui/region.h
index 38d50a1f85..5a2362892c 100644
--- a/components/rtgui/include/rtgui/region.h
+++ b/components/rtgui/include/rtgui/region.h
@@ -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)
}