summaryrefslogtreecommitdiff
path: root/components/rtgui
diff options
context:
space:
mode:
author[email protected] <[email protected]>2010-09-26 22:59:05 +0000
committer[email protected] <[email protected]>2010-09-26 22:59:05 +0000
commit9238dbb7bf4b82f30faca95217fb11c88261f205 (patch)
treeb1e0401c55b26b9b188af830a911598887b03206 /components/rtgui
parent74a97349d20d5565d08441a86ee3feb01ca467a0 (diff)
fix draw_mono_bmp issue
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@963 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui')
-rw-r--r--components/rtgui/common/dc.c37
1 files changed, 6 insertions, 31 deletions
diff --git a/components/rtgui/common/dc.c b/components/rtgui/common/dc.c
index be42956a1c..2644694307 100644
--- a/components/rtgui/common/dc.c
+++ b/components/rtgui/common/dc.c
@@ -11,6 +11,7 @@
* Date Author Notes
* 2009-10-16 Bernard first version
* 2010-09-20 richard modified rtgui_dc_draw_round_rect
+ * 2010-09-27 Bernard fix draw_mono_bmp issue
*/
#include <rtgui/dc.h>
#include <rtgui/rtgui_system.h>
@@ -324,53 +325,27 @@ void rtgui_dc_draw_text (struct rtgui_dc* dc, const char* text, struct rtgui_rec
*/
void rtgui_dc_draw_mono_bmp(struct rtgui_dc* dc, int x, int y, int w, int h, const rt_uint8_t* data)
{
- int word_bytes;
int i, j, k;
/* get word bytes */
- word_bytes = (w + 7)/8;
+ w = (w + 7)/8;
/* draw mono bitmap data */
for (i = 0; i < h; i ++)
- for (j = 0; j < word_bytes; j++)
+ for (j = 0; j < w; j++)
for (k = 0; k < 8; k++)
- if ( ((data[i*2 + j] >> (7-k)) & 0x01) != 0)
+ if ( ((data[i*w + j] >> (7-k)) & 0x01) != 0)
rtgui_dc_draw_point(dc, x + 8*j + k, y + i);
}
void rtgui_dc_draw_byte(struct rtgui_dc*dc, int x, int y, int h, const rt_uint8_t* data)
{
- int i, k;
-
- /* draw byte */
- for (i=0; i < h; i ++)
- {
- for (k=0; k < 8; k++)
- {
- if (((data[i] >> (7-k)) & 0x01) != 0)
- {
- rtgui_dc_draw_point(dc, x + k, y + i);
- }
- }
- }
+ rtgui_dc_draw_mono_bmp(dc, x, y, 8, h, data);
}
void rtgui_dc_draw_word(struct rtgui_dc*dc, int x, int y, int h, const rt_uint8_t* data)
{
- int i, j, k;
-
- /* draw word */
- for (i=0; i < h; i ++)
- {
- for (j=0; j < 2; j++)
- for (k=0; k < 8; k++)
- {
- if (((data[i * 2 + j] >> (7-k)) & 0x01) != 0)
- {
- rtgui_dc_draw_point(dc, x + 8*j + k, y + i);
- }
- }
- }
+ rtgui_dc_draw_mono_bmp(dc, x, y, 16, h, data);
}
void rtgui_dc_draw_border(struct rtgui_dc* dc, rtgui_rect_t* rect, int flag)