Quellcode durchsuchen

rgb888 像素格式相关代码更新;以及 blit.c 代码整理更新;

Signed-off-by: yangfasheng <yangfasheng@rt-thread.com>
yangfasheng vor 7 Jahren
Ursprung
Commit
315c8d0426
8 geänderte Dateien mit 782 neuen und 708 gelöschten Zeilen
  1. 23 0
      include/rtgui/blit.h
  2. 92 20
      include/rtgui/dc_draw.h
  3. 555 680
      src/blit.c
  4. 95 3
      src/dc_blend.c
  5. 14 2
      src/dc_buffer.c
  6. 1 1
      src/font_freetype.c
  7. 1 1
      src/image_jpg.c
  8. 1 1
      src/image_png.c

+ 23 - 0
include/rtgui/blit.h

@@ -62,10 +62,22 @@
 {                                                                       \
     Pixel = ((r>>3)<<10)|((g>>3)<<5)|(b>>3);                            \
 }
+
+#ifdef PKG_USING_RGB888_PIXEL_BITS_32
 #define RGB888_FROM_RGB(Pixel, r, g, b)                                 \
 {                                                                       \
     Pixel = (r<<16)|(g<<8)|b;                                           \
 }
+#else
+#define RGB888_FROM_RGB(Pixel, r, g, b)                                 \
+{                                                                       \
+    rt_uint8_t *p = &Pixel;                                             \
+    *p++ = r;                                                           \
+    *p++ = g;                                                           \
+    *p = b;                                                             \
+}
+#endif
+
 #define ARGB8888_FROM_RGBA(Pixel, r, g, b, a)                           \
 {                                                                       \
     Pixel = (a<<24)|(r<<16)|(g<<8)|b;                                   \
@@ -110,12 +122,23 @@
     g = rtgui_blit_expand_byte[3][((Pixel&0x03E0)>>5)];                 \
     b = rtgui_blit_expand_byte[3][(Pixel&0x001F)];                      \
 }
+
+#ifdef PKG_USING_RGB888_PIXEL_BITS_32
 #define RGB_FROM_RGB888(Pixel, r, g, b)                                 \
 {                                                                       \
     r = ((Pixel&0xFF0000)>>16);                                         \
     g = ((Pixel&0xFF00)>>8);                                            \
     b = (Pixel&0xFF);                                                   \
 }
+#else
+#define RGB_FROM_RGB888(Pixel, r, g, b)                                 \
+{                                                                       \
+    rt_uint8_t *p = &Pixel;                                             \
+    r = *p++;                                                           \
+    g = *p++;                                                           \
+    b = *p;                                                             \
+}
+#endif
 
 #define RGBA_FROM_RGBA8888(Pixel, r, g, b, a)                           \
 {                                                                       \

+ 92 - 20
include/rtgui/dc_draw.h

@@ -59,6 +59,14 @@
 
 #define DRAW_FASTSETPIXEL1 DRAW_FASTSETPIXEL(rt_uint8_t)
 #define DRAW_FASTSETPIXEL2 DRAW_FASTSETPIXEL(rt_uint16_t)
+#define DRAW_FASTSETPIXEL3 \
+    do { \
+        rt_uint8_t *p = (rt_uint8_t *)pixel; \
+        *p++ = ((color & 0xFF0000) >> 16); \
+        *p++ = ((color & 0xFF00) >> 8); \
+        *p = (color & 0xFF); \
+    } while (0)
+
 #define DRAW_FASTSETPIXEL4 DRAW_FASTSETPIXEL(rt_uint32_t)
 
 #define DRAW_FASTSETPIXELXY(x, y, type, bpp, color) \
@@ -66,6 +74,14 @@
 
 #define DRAW_FASTSETPIXELXY1(x, y) DRAW_FASTSETPIXELXY(x, y, rt_uint8_t, 1, color)
 #define DRAW_FASTSETPIXELXY2(x, y) DRAW_FASTSETPIXELXY(x, y, rt_uint16_t, 2, color)
+#define DRAW_FASTSETPIXELXY3(x, y) \
+	do{ \
+	    rt_uint8_t *p = (rt_uint8_t *)(_dc_get_pixel(dst, x, y)); \
+	    *p++ = ((color & 0xFF0000) >> 16); \
+	    *p++ = ((color & 0xFF00) >> 8); \
+	    *p = (color & 0xFF); \
+	} while (0)
+	
 #define DRAW_FASTSETPIXELXY4(x, y) DRAW_FASTSETPIXELXY(x, y, rt_uint32_t, 4, color)
 
 #define DRAW_SETPIXEL(setpixel) \
@@ -149,8 +165,14 @@ do { \
     DRAW_SETPIXEL(RGB565_FROM_RGB(*pixel, sr, sg, sb))
 
 #define DRAW_SETPIXEL_BLEND_RGB565 \
-    DRAW_SETPIXEL_BLEND(RGB_FROM_RGB565(*pixel, sr, sg, sb), \
-                        RGB565_FROM_RGB(*pixel, sr, sg, sb))
+    do { \
+        unsigned sr, sg, sb; \
+        RGB_FROM_RGB565(*pixel, sr, sg, sb); \
+        sr = ((r * a) + (inva * sr)) * 257 >> 16; \
+        sg = ((g * a) + (inva * sg)) * 257 >> 16; \
+        sb = ((b * a) + (inva * sb)) * 257 >> 16; \
+        RGB565_FROM_RGB(*pixel, sr, sg, sb); \
+    } while (0)
 
 #define DRAW_SETPIXEL_ADD_RGB565 \
     DRAW_SETPIXEL_ADD(RGB_FROM_RGB565(*pixel, sr, sg, sb), \
@@ -211,8 +233,14 @@ do { \
     DRAW_SETPIXEL(RGB888_FROM_RGB(*pixel, sr, sg, sb))
 
 #define DRAW_SETPIXEL_BLEND_RGB888 \
-    DRAW_SETPIXEL_BLEND(RGB_FROM_RGB888(*pixel, sr, sg, sb), \
-                        RGB888_FROM_RGB(*pixel, sr, sg, sb))
+    do { \
+        unsigned sr, sg, sb; \
+        RGB_FROM_RGB888(*pixel, sr, sg, sb); \
+        sr = ((r * a) + (inva * sr)) >> 8; \
+        sg = ((g * a) + (inva * sg)) >> 8; \
+        sb = ((b * a) + (inva * sb)) >> 8; \
+        RGB888_FROM_RGB(*pixel, sr, sg, sb); \
+    } while (0)
 
 #define DRAW_SETPIXEL_ADD_RGB888 \
     DRAW_SETPIXEL_ADD(RGB_FROM_RGB888(*pixel, sr, sg, sb), \
@@ -222,17 +250,37 @@ do { \
     DRAW_SETPIXEL_MOD(RGB_FROM_RGB888(*pixel, sr, sg, sb), \
                       RGB888_FROM_RGB(*pixel, sr, sg, sb))
 
+#ifdef PKG_USING_RGB888_PIXEL_BITS_32
 #define DRAW_SETPIXELXY_RGB888(x, y) \
     DRAW_SETPIXELXY(x, y, rt_uint32_t, 4, DRAW_SETPIXEL_RGB888)
+#else
+#define DRAW_SETPIXELXY_RGB888(x, y) \
+    DRAW_SETPIXELXY(x, y, rt_uint8_t, 3, DRAW_SETPIXEL_RGB888)
+#endif
 
+#ifdef PKG_USING_RGB888_PIXEL_BITS_32
 #define DRAW_SETPIXELXY_BLEND_RGB888(x, y) \
     DRAW_SETPIXELXY(x, y, rt_uint32_t, 4, DRAW_SETPIXEL_BLEND_RGB888)
+#else
+#define DRAW_SETPIXELXY_BLEND_RGB888(x, y) \
+    DRAW_SETPIXELXY(x, y, rt_uint8_t, 3, DRAW_SETPIXEL_BLEND_RGB888)
+#endif
 
+#ifdef PKG_USING_RGB888_PIXEL_BITS_32
 #define DRAW_SETPIXELXY_ADD_RGB888(x, y) \
     DRAW_SETPIXELXY(x, y, rt_uint32_t, 4, DRAW_SETPIXEL_ADD_RGB888)
+#else
+#define DRAW_SETPIXELXY_ADD_RGB888(x, y) \
+    DRAW_SETPIXELXY(x, y, rt_uint8_t, 3, DRAW_SETPIXEL_ADD_RGB888)
+#endif
 
+#ifdef PKG_USING_RGB888_PIXEL_BITS_32
 #define DRAW_SETPIXELXY_MOD_RGB888(x, y) \
     DRAW_SETPIXELXY(x, y, rt_uint32_t, 4, DRAW_SETPIXEL_MOD_RGB888)
+#else
+#define DRAW_SETPIXELXY_MOD_RGB888(x, y) \
+    DRAW_SETPIXELXY(x, y, rt_uint8_t, 3, DRAW_SETPIXEL_MOD_RGB888)
+#endif
 
 /*
  * Define draw operators for ARGB8888
@@ -242,8 +290,25 @@ do { \
     DRAW_SETPIXEL(ARGB8888_FROM_RGBA(*pixel, sr, sg, sb, sa))
 
 #define DRAW_SETPIXEL_BLEND_ARGB8888 \
-    DRAW_SETPIXEL_BLEND(RGBA_FROM_ARGB8888(*pixel, sr, sg, sb, sa), \
-                        ARGB8888_FROM_RGBA(*pixel, sr, sg, sb, sa))
+    do { \
+        unsigned sr, sg, sb, sa; \
+        RGBA_FROM_ARGB8888(*pixel, sr, sg, sb, sa); \
+        if (sa) \
+        {   \
+            sa = a + (inva * sa + 128) / 255; \
+            sr = ((r * a) + (inva * sr)) >> 8; \
+            sg = ((g * a) + (inva * sg)) >> 8; \
+            sb = ((b * a) + (inva * sb)) >> 8; \
+        }   \
+        else \
+        { \
+            sa = a; \
+            sr = r; \
+            sg = g; \
+            sb = g; \
+        } \
+        ARGB8888_FROM_RGBA(*pixel, sr, sg, sb, sa); \
+    } while (0)
 
 #define DRAW_SETPIXEL_ADD_ARGB8888 \
     DRAW_SETPIXEL_ADD(RGBA_FROM_ARGB8888(*pixel, sr, sg, sb, sa), \
@@ -275,6 +340,7 @@ do { \
 #define HLINE(type, op, draw_end) \
 { \
     int length; \
+    int inc_size = _UI_BITBYTES(_dc_get_bits_per_pixel(dst)) / sizeof(type); \
     type *pixel; \
     if (x1 <= x2) { \
         pixel = (type *)_dc_get_pixel(dst, x1, y1); \
@@ -282,13 +348,13 @@ do { \
     } else { \
         pixel = (type *)_dc_get_pixel(dst, x2, y1); \
         if (!draw_end) { \
-            ++pixel; \
+            pixel += inc_size; \
         } \
         length = draw_end ? (x1-x2+1) : (x1-x2); \
     } \
     while (length--) { \
         op; \
-        ++pixel; \
+        pixel += inc_size; \
     } \
 }
 
@@ -296,21 +362,23 @@ do { \
 #define VLINE(type, op, draw_end) \
 { \
     int length; \
-    int pitch = _dc_get_pitch(dst)/(_UI_BITBYTES(_dc_get_bits_per_pixel(dst))); \
+    int inc_size = _UI_BITBYTES(_dc_get_bits_per_pixel(dst)); \
+    int pitch = _dc_get_pitch(dst) / inc_size; \
     type *pixel; \
+    inc_size = inc_size / sizeof(type); \
     if (y1 <= y2) { \
         pixel = (type *)_dc_get_pixel(dst, x1, y1); \
         length = draw_end ? (y2-y1+1) : (y2-y1); \
     } else { \
         pixel = (type *)_dc_get_pixel(dst, x1, y2); \
         if (!draw_end) { \
-            pixel += pitch; \
+            pixel += pitch * inc_size; \
         } \
         length = draw_end ? (y1-y2+1) : (y1-y2); \
     } \
     while (length--) { \
         op; \
-        pixel += pitch; \
+        pixel += pitch * inc_size; \
     } \
 }
 
@@ -318,8 +386,10 @@ do { \
 #define DLINE(type, op, draw_end) \
 { \
     int length; \
-    int pitch = _dc_get_pitch(dst)/(_UI_BITBYTES(_dc_get_bits_per_pixel(dst))); \
+    int inc_size = _UI_BITBYTES(_dc_get_bits_per_pixel(dst)); \
+    int pitch = _dc_get_pitch(dst) / inc_size; \
     type *pixel; \
+    inc_size = inc_size / sizeof(type); \
     if (y1 <= y2) { \
         pixel = (type *)_dc_get_pixel(dst, x1, y1); \
         if (x1 <= x2) { \
@@ -336,7 +406,7 @@ do { \
             --pitch; \
         } \
         if (!draw_end) { \
-            pixel += pitch; \
+            pixel += pitch * inc_size; \
         } \
         length = (y1-y2); \
     } \
@@ -345,7 +415,7 @@ do { \
     } \
     while (length--) { \
         op; \
-        pixel += pitch; \
+        pixel += pitch * inc_size; \
     } \
 }
 
@@ -531,20 +601,22 @@ do { \
 do { \
     int width = rect->x2 - rect->x1; \
     int height = rect->y2 - rect->y1; \
-    int pitch = _dc_get_pitch(dst)/(_UI_BITBYTES(_dc_get_bits_per_pixel(dst))); \
+    int inc_size = _UI_BITBYTES(_dc_get_bits_per_pixel(dst)); \
+    int pitch = _dc_get_pitch(dst) / inc_size; \
     int skip = pitch - width; \
     type *pixel = (type *)_dc_get_pixel(dst, rect->x1, rect->y1); \
+    inc_size = inc_size / sizeof(type); \
     while (height--) { \
         { int n = (width+3)/4; \
             switch (width & 3) { \
-            case 0: do {   op; pixel++; \
-            case 3:        op; pixel++; \
-            case 2:        op; pixel++; \
-            case 1:        op; pixel++; \
+            case 0: do {   op; pixel += inc_size; \
+            case 3:        op; pixel += inc_size; \
+            case 2:        op; pixel += inc_size; \
+            case 1:        op; pixel += inc_size; \
                     } while ( --n > 0 ); \
             } \
         } \
-        pixel += skip; \
+        pixel += skip * inc_size; \
     } \
 } while (0)
 

Datei-Diff unterdrückt, da er zu groß ist
+ 555 - 680
src/blit.c


+ 95 - 3
src/dc_blend.c

@@ -407,6 +407,36 @@ _dc_draw_line2(struct rtgui_dc * dst, int x1, int y1, int x2, int y2, rtgui_colo
     }
 }
 
+static void
+_dc_draw_line3(struct rtgui_dc * dst, int x1, int y1, int x2, int y2, rtgui_color_t color,
+               rt_bool_t draw_end)
+{
+    if (y1 == y2)
+    {
+        HLINE(rt_uint8_t, DRAW_FASTSETPIXEL3, draw_end);
+    }
+    else if (x1 == x2)
+    {
+        VLINE(rt_uint8_t, DRAW_FASTSETPIXEL3, draw_end);
+    }
+    else if (ABS(x1 - x2) == ABS(y1 - y2))
+    {
+        DLINE(rt_uint8_t, DRAW_FASTSETPIXEL3, draw_end);
+    }
+    else
+    {
+        rt_uint8_t _r, _g, _b, _a;
+        _r = RTGUI_RGB_R(color);
+        _g = RTGUI_RGB_G(color);
+        _b = RTGUI_RGB_B(color);
+        _a = RTGUI_RGB_A(color);
+
+        AALINE(x1, y1, x2, y2,
+               DRAW_FASTSETPIXELXY3, DRAW_SETPIXELXY_BLEND_RGB888,
+               draw_end);
+    }
+}
+
 static void
 _dc_draw_line4(struct rtgui_dc * dst, int x1, int y1, int x2, int y2, rtgui_color_t color,
                rt_bool_t draw_end)
@@ -459,6 +489,8 @@ _dc_calc_draw_line_func(int bpp)
         return _dc_draw_line1;
     case 2:
         return _dc_draw_line2;
+    case 3:
+        return _dc_draw_line3;
     case 4:
         return _dc_draw_line4;
     }
@@ -1126,6 +1158,7 @@ _dc_blend_line_rgb888(struct rtgui_dc * dst, int x1, int y1, int x2, int y2,
     {
         switch (blendMode)
         {
+#ifdef PKG_USING_RGB888_PIXEL_BITS_32
         case RTGUI_BLENDMODE_BLEND:
             HLINE(rt_uint32_t, DRAW_SETPIXEL_BLEND_RGB888, draw_end);
             break;
@@ -1138,12 +1171,27 @@ _dc_blend_line_rgb888(struct rtgui_dc * dst, int x1, int y1, int x2, int y2,
         default:
             HLINE(rt_uint32_t, DRAW_SETPIXEL_RGB888, draw_end);
             break;
+#else
+        case RTGUI_BLENDMODE_BLEND:
+            HLINE(rt_uint8_t, DRAW_SETPIXEL_BLEND_RGB888, draw_end);
+            break;
+        case RTGUI_BLENDMODE_ADD:
+            HLINE(rt_uint8_t, DRAW_SETPIXEL_ADD_RGB888, draw_end);
+            break;
+        case RTGUI_BLENDMODE_MOD:
+            HLINE(rt_uint8_t, DRAW_SETPIXEL_MOD_RGB888, draw_end);
+            break;
+        default:
+            HLINE(rt_uint8_t, DRAW_SETPIXEL_RGB888, draw_end);
+            break;
+#endif
         }
     }
     else if (x1 == x2)
     {
         switch (blendMode)
         {
+#ifdef PKG_USING_RGB888_PIXEL_BITS_32
         case RTGUI_BLENDMODE_BLEND:
             VLINE(rt_uint32_t, DRAW_SETPIXEL_BLEND_RGB888, draw_end);
             break;
@@ -1156,12 +1204,27 @@ _dc_blend_line_rgb888(struct rtgui_dc * dst, int x1, int y1, int x2, int y2,
         default:
             VLINE(rt_uint32_t, DRAW_SETPIXEL_RGB888, draw_end);
             break;
+#else
+        case RTGUI_BLENDMODE_BLEND:
+            VLINE(rt_uint8_t, DRAW_SETPIXEL_BLEND_RGB888, draw_end);
+            break;
+        case RTGUI_BLENDMODE_ADD:
+            VLINE(rt_uint8_t, DRAW_SETPIXEL_ADD_RGB888, draw_end);
+            break;
+        case RTGUI_BLENDMODE_MOD:
+            VLINE(rt_uint8_t, DRAW_SETPIXEL_MOD_RGB888, draw_end);
+            break;
+        default:
+            VLINE(rt_uint8_t, DRAW_SETPIXEL_RGB888, draw_end);
+            break;
+#endif
         }
     }
     else if (ABS(x1 - x2) == ABS(y1 - y2))
     {
         switch (blendMode)
         {
+#ifdef PKG_USING_RGB888_PIXEL_BITS_32
         case RTGUI_BLENDMODE_BLEND:
             DLINE(rt_uint32_t, DRAW_SETPIXEL_BLEND_RGB888, draw_end);
             break;
@@ -1174,6 +1237,20 @@ _dc_blend_line_rgb888(struct rtgui_dc * dst, int x1, int y1, int x2, int y2,
         default:
             DLINE(rt_uint32_t, DRAW_SETPIXEL_RGB888, draw_end);
             break;
+#else
+        case RTGUI_BLENDMODE_BLEND:
+            DLINE(rt_uint8_t, DRAW_SETPIXEL_BLEND_RGB888, draw_end);
+            break;
+        case RTGUI_BLENDMODE_ADD:
+            DLINE(rt_uint8_t, DRAW_SETPIXEL_ADD_RGB888, draw_end);
+            break;
+        case RTGUI_BLENDMODE_MOD:
+            DLINE(rt_uint8_t, DRAW_SETPIXEL_MOD_RGB888, draw_end);
+            break;
+        default:
+            DLINE(rt_uint8_t, DRAW_SETPIXEL_RGB888, draw_end);
+            break;
+#endif
         }
     }
     else
@@ -1542,6 +1619,7 @@ _dc_blend_fill_rect_rgb888(struct rtgui_dc * dst, const rtgui_rect_t * rect,
 
     switch (blendMode)
     {
+#ifdef PKG_USING_RGB888_PIXEL_BITS_32
     case RTGUI_BLENDMODE_BLEND:
         FILLRECT(rt_uint32_t, DRAW_SETPIXEL_BLEND_RGB888);
         break;
@@ -1554,6 +1632,20 @@ _dc_blend_fill_rect_rgb888(struct rtgui_dc * dst, const rtgui_rect_t * rect,
     default:
         FILLRECT(rt_uint32_t, DRAW_SETPIXEL_RGB888);
         break;
+#else
+    case RTGUI_BLENDMODE_BLEND:
+        FILLRECT(rt_uint8_t, DRAW_SETPIXEL_BLEND_RGB888);
+        break;
+    case RTGUI_BLENDMODE_ADD:
+        FILLRECT(rt_uint8_t, DRAW_SETPIXEL_ADD_RGB888);
+        break;
+    case RTGUI_BLENDMODE_MOD:
+        FILLRECT(rt_uint8_t, DRAW_SETPIXEL_MOD_RGB888);
+        break;
+    default:
+        FILLRECT(rt_uint8_t, DRAW_SETPIXEL_RGB888);
+        break;
+#endif
     }
 }
 
@@ -1605,7 +1697,7 @@ rtgui_dc_blend_fill_rect(struct rtgui_dc* dst, const rtgui_rect_t *rect,
     b = RTGUI_RGB_B(color);
     a = RTGUI_RGB_A(color);
 
-    if (blendMode == RTGUI_BLENDMODE_BLEND || blendMode == RTGUI_BLENDMODE_ADD)
+    if (blendMode == RTGUI_BLENDMODE_ADD || blendMode == RTGUI_BLENDMODE_MOD)
     {
         r = DRAW_MUL(r, a);
         g = DRAW_MUL(g, a);
@@ -1690,8 +1782,8 @@ rtgui_dc_blend_fill_rect(struct rtgui_dc* dst, const rtgui_rect_t *rect,
 
         draw_rect.x1 = dc->owner->extent.x1 > 0 ? dc->owner->extent.x1 : 0;
         draw_rect.y1 = dc->owner->extent.y1 > 0 ? dc->owner->extent.y1 : 0;
-		draw_rect.x2 = draw_rect.x2 > hw_driver->width ? hw_driver->width : draw_rect.x2;
-		draw_rect.y2 = draw_rect.y2 > hw_driver->height ? hw_driver->height : draw_rect.y2;
+        draw_rect.x2 = draw_rect.x2 > hw_driver->width ? hw_driver->width : draw_rect.x2;
+        draw_rect.y2 = draw_rect.y2 > hw_driver->height ? hw_driver->height : draw_rect.y2;
 
         func(dst, &draw_rect, blendMode, r, g, b, a);
     }

+ 14 - 2
src/dc_buffer.c

@@ -305,7 +305,11 @@ static void rtgui_dc_buffer_draw_vline(struct rtgui_dc *self, int x1, int y1, in
         VLINE(rt_uint16_t, DRAW_SETPIXEL_BGR565, 0);
         break;
     case RTGRAPHIC_PIXEL_FORMAT_RGB888:
-        VLINE(rt_uint16_t, DRAW_SETPIXEL_RGB888, 0);
+#ifdef PKG_USING_RGB888_PIXEL_BITS_32
+        VLINE(rt_uint32_t, DRAW_SETPIXEL_RGB888, 0);
+#else
+        VLINE(rt_uint8_t, DRAW_SETPIXEL_RGB888, 0);
+#endif
         break;
     case RTGRAPHIC_PIXEL_FORMAT_ARGB888:
         VLINE(rt_uint32_t, DRAW_SETPIXEL_ARGB8888, 0);
@@ -341,7 +345,11 @@ static void rtgui_dc_buffer_draw_hline(struct rtgui_dc *self, int x1, int x2, in
         HLINE(rt_uint16_t, DRAW_SETPIXEL_BGR565, 0);
         break;
     case RTGRAPHIC_PIXEL_FORMAT_RGB888:
-        HLINE(rt_uint16_t, DRAW_SETPIXEL_RGB888, 0);
+#ifdef PKG_USING_RGB888_PIXEL_BITS_32
+        HLINE(rt_uint32_t, DRAW_SETPIXEL_RGB888, 0);
+#else
+        HLINE(rt_uint8_t, DRAW_SETPIXEL_RGB888, 0);
+#endif
         break;
     case RTGRAPHIC_PIXEL_FORMAT_ARGB888:
         HLINE(rt_uint32_t, DRAW_SETPIXEL_ARGB8888, 0);
@@ -393,7 +401,11 @@ static void rtgui_dc_buffer_fill_rect(struct rtgui_dc *self, struct rtgui_rect *
         FILLRECT(rt_uint16_t, DRAW_SETPIXEL_BGR565);
         break;
     case RTGRAPHIC_PIXEL_FORMAT_RGB888:
+#ifdef PKG_USING_RGB888_PIXEL_BITS_32
         FILLRECT(rt_uint32_t, DRAW_SETPIXEL_RGB888);
+#else
+        FILLRECT(rt_uint8_t, DRAW_SETPIXEL_RGB888);
+#endif
         break;
     case RTGRAPHIC_PIXEL_FORMAT_ARGB888:
         FILLRECT(rt_uint32_t, DRAW_SETPIXEL_ARGB8888);

+ 1 - 1
src/font_freetype.c

@@ -493,7 +493,7 @@ static void _draw_bitmap(struct rtgui_dc *dc,
             dest_buf = (struct rtgui_dc_buffer*)text_dc;
 
             /* blit source */
-            info.a = 0;
+            info.a = 255;
             info.src = (rt_uint8_t *)bitmap->buffer;
             info.src_fmt = RTGRAPHIC_PIXEL_FORMAT_ALPHA;
             info.src_w = bitmap->width;

+ 1 - 1
src/image_jpg.c

@@ -433,7 +433,7 @@ static void rtgui_image_jpeg_blit(struct rtgui_image *image, struct rtgui_dc *dc
             w = _UI_MIN(image->w, rtgui_rect_width(*rect));
             h = _UI_MIN(image->h, rtgui_rect_height(*rect));
 
-            info.a = 0;
+            info.a = 255;
 
             /* initialize source blit information */
             info.src_fmt = RTGRAPHIC_PIXEL_FORMAT_ARGB888;;

+ 1 - 1
src/image_png.c

@@ -678,7 +678,7 @@ static void rtgui_image_png_blit(struct rtgui_image *image, struct rtgui_dc *dc,
             buffer = (struct rtgui_dc_buffer*)dc;
 
             if (buffer->pixel_alpha == 0)
-                info.a = 0;
+                info.a = 255;
 
             info.dst = rtgui_dc_buffer_get_pixel(RTGUI_DC(buffer)) + dst_y * buffer->pitch +
                        dst_x * rtgui_color_get_bpp(buffer->pixel_format);

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.