diff options
| author | bernard.xiong <[email protected]> | 2010-04-28 10:08:14 +0000 |
|---|---|---|
| committer | bernard.xiong <[email protected]> | 2010-04-28 10:08:14 +0000 |
| commit | e2e93e7251cd63e668f32ab62e0974a50c69ff7c (patch) | |
| tree | 3a8236a5ceaaff12cf7b85402ea1503d2e4ea3ad /components/rtgui | |
| parent | c2b29a3e31facfaeb5e343e28114e268d489de0b (diff) | |
fix dc_buffer issue
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@676 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui')
| -rw-r--r-- | components/rtgui/common/dc_buffer.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/components/rtgui/common/dc_buffer.c b/components/rtgui/common/dc_buffer.c index 2a82ad2b39..15282c38bd 100644 --- a/components/rtgui/common/dc_buffer.c +++ b/components/rtgui/common/dc_buffer.c @@ -24,12 +24,6 @@ struct rtgui_dc_buffer /* graphic context */ rtgui_gc_t gc; - /* color and font */ - rtgui_color_t color; - struct rtgui_font* font; - /* text align */ - rt_int32_t align; - /* width and height */ rt_uint16_t width, height; rt_uint16_t pitch; @@ -84,9 +78,10 @@ struct rtgui_dc* rtgui_dc_buffer_create(int w, int h) dc = (struct rtgui_dc_buffer*)rtgui_malloc(sizeof(struct rtgui_dc_buffer)); rtgui_dc_buffer_init(dc); - dc->color = 0; - dc->font = RT_NULL; - dc->align = 0; + dc->gc.foreground = default_foreground; + dc->gc.background = default_background; + dc->gc.font = rtgui_font_default(); + dc->gc.textalign = RTGUI_ALIGN_LEFT | RTGUI_ALIGN_TOP; dc->width = w; dc->height = h; @@ -132,7 +127,7 @@ static void rtgui_dc_buffer_draw_point(struct rtgui_dc* self, int x, int y) /* note: there is no parameter check in this function */ ptr = (rtgui_color_t*)(dc->pixel + y * dc->pitch + x * sizeof(rtgui_color_t)); - *ptr = dc->color; + *ptr = dc->gc.foreground; } static void rtgui_dc_buffer_draw_color_point(struct rtgui_dc* self, int x, int y, rtgui_color_t color) @@ -164,7 +159,7 @@ static void rtgui_dc_buffer_draw_vline(struct rtgui_dc* self, int x, int y1, int for (index = y1; index < y2; index ++) { /* draw this point */ - *ptr = dc->color; + *ptr = dc->gc.foreground; ptr += dc->width; } } @@ -184,7 +179,7 @@ static void rtgui_dc_buffer_draw_hline(struct rtgui_dc* self, int x1, int x2, in for (index = x1; index < x2; index ++) { /* draw this point */ - *ptr++ = dc->color; + *ptr++ = dc->gc.foreground; } } |
