summaryrefslogtreecommitdiff
path: root/components/rtgui/common/dc_buffer.c
diff options
context:
space:
mode:
author[email protected] <[email protected]>2011-06-06 09:10:13 +0000
committer[email protected] <[email protected]>2011-06-06 09:10:13 +0000
commit80da4b977588119a2e66566fb9a2e7a0c3588a62 (patch)
tree6d0f4b18be36779a0f6fdd9bfe83913026064f10 /components/rtgui/common/dc_buffer.c
parent5284d6d52e39faefcf96dedad6695bb46d2d5579 (diff)
change to graphic device.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1459 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui/common/dc_buffer.c')
-rw-r--r--components/rtgui/common/dc_buffer.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/components/rtgui/common/dc_buffer.c b/components/rtgui/common/dc_buffer.c
index 730156e89c..7677fa9dd5 100644
--- a/components/rtgui/common/dc_buffer.c
+++ b/components/rtgui/common/dc_buffer.c
@@ -20,6 +20,11 @@
#define hw_driver (rtgui_graphic_driver_get_default())
+#define RTGUI_BLENDMODE_NONE 0x00
+#define RTGUI_BLENDMODE_BLEND 0x01
+#define RTGUI_BLENDMODE_ADD 0x02
+#define RTGUI_BLENDMODE_MOD 0x03
+
struct rtgui_dc_buffer
{
struct rtgui_dc parent;
@@ -27,6 +32,10 @@ struct rtgui_dc_buffer
/* graphic context */
rtgui_gc_t gc;
+ /* pixel format */
+ rt_uint8_t pixel_format;
+ rt_uint8_t blend_mode;
+
/* width and height */
rt_uint16_t width, height;
rt_uint16_t pitch;
@@ -240,7 +249,7 @@ static void rtgui_dc_buffer_blit(struct rtgui_dc* self, struct rtgui_point* dc_p
/* prepare pixel line */
pixels = dc->pixel + dc_point->y * dc->pitch + dc_point->x * sizeof(rtgui_color_t);
- if (hw_driver->byte_per_pixel == sizeof(rtgui_color_t))
+ if (hw_driver->bits_per_pixel == sizeof(rtgui_color_t) * 8)
{
/* it's the same byte per pixel, draw it directly */
for (index = rect->y1; index < rect->y1 + rect_height; index++)
@@ -252,11 +261,11 @@ static void rtgui_dc_buffer_blit(struct rtgui_dc* self, struct rtgui_point* dc_p
else
{
/* get blit line function */
- blit_line = rtgui_blit_line_get(hw_driver->byte_per_pixel, 4);
+ blit_line = rtgui_blit_line_get(hw_driver->bits_per_pixel/8, 4);
/* calculate pitch */
pitch = rect_width * sizeof(rtgui_color_t);
/* create line buffer */
- line_ptr = (rt_uint8_t*) rtgui_malloc(rect_width * hw_driver->byte_per_pixel);
+ line_ptr = (rt_uint8_t*) rtgui_malloc(rect_width * hw_driver->bits_per_pixel/8);
/* draw each line */
for (index = rect->y1; index < rect->y1 + rect_height; index ++)