From: Ilyes Gouta <ilyes.go...@st.com> Signed-off-by: Ilyes Gouta <ilyes.go...@st.com> --- src/core/surface_buffer.c | 1 + src/gfx/convert.c | 70 +++++++++++++++++++++++++++++++++++++++++++++ src/misc/gfx_util.c | 14 +++++++++ 3 files changed, 85 insertions(+)
diff --git a/src/core/surface_buffer.c b/src/core/surface_buffer.c index b118e79..a5086a3 100644 --- a/src/core/surface_buffer.c +++ b/src/core/surface_buffer.c @@ -738,6 +738,7 @@ dfb_surface_buffer_dump( CoreSurfaceBuffer *buffer, case DSPF_RGB332: case DSPF_RGB16: case DSPF_RGB24: + case DSPF_BGR24: case DSPF_RGB32: case DSPF_YUY2: case DSPF_UYVY: diff --git a/src/gfx/convert.c b/src/gfx/convert.c index bc37156..f8e2cad 100644 --- a/src/gfx/convert.c +++ b/src/gfx/convert.c @@ -119,6 +119,12 @@ dfb_pixel_to_color( DFBSurfacePixelFormat format, ret_color->g = (pixel & 0x00ff00) >> 8; ret_color->r = (pixel & 0x0000ff); + case DSPF_BGR24: + ret_color->b = (pixel & 0xff0000) >> 16; + ret_color->g = (pixel & 0x00ff00) >> 8; + ret_color->r = (pixel & 0x0000ff); + break; + case DSPF_AiRGB: ret_color->a = (pixel >> 24) ^ 0xff; ret_color->r = (pixel & 0xff0000) >> 16; @@ -203,6 +209,9 @@ dfb_pixel_from_color( DFBSurfacePixelFormat format, case DSPF_RGB24: return PIXEL_RGB32( color->r, color->g, color->b ) & 0xffffff; + case DSPF_BGR24: + return PIXEL_RGB32( color->b, color->g, color->r ) & 0xffffff; + case DSPF_RGB32: return PIXEL_RGB32( color->r, color->g, color->b ) & 0xffffff; @@ -1027,6 +1036,26 @@ dfb_convert_to_rgb32( DFBSurfacePixelFormat format, } break; + case DSPF_BGR24: + while (height--) { + const u8 *src8 = src; + + for (x=0; x<width; x++) +#ifdef WORDS_BIGENDIAN + dst[x] = ( src8[x*3+2] << 16 ) | + ( src8[x*3+1] << 8 ) | + ( src8[x*3+0] ); +#else + dst[x] = ( src8[x*3+0] << 16 ) | + ( src8[x*3+1] << 8 ) | + ( src8[x*3+2] ); +#endif + + src += spitch; + dst += dp4; + } + break; + case DSPF_AYUV: while (height--) { const u32 *src32 = src; @@ -1342,6 +1371,26 @@ dfb_convert_to_argb( DFBSurfacePixelFormat format, } break; + case DSPF_BGR24: + while (height--) { + const u8 *src8 = src; + + for (x=0; x<width; x++) +#ifdef WORDS_BIGENDIAN + dst[x] = ( src8[x*3+2] << 16 ) | + ( src8[x*3+1] << 8 ) | + ( src8[x*3+0] ) | 0xff000000; +#else + dst[x] = ( src8[x*3+0] << 16 ) | + ( src8[x*3+1] << 8 ) | + ( src8[x*3+2] ) | 0xff000000; +#endif + + src += spitch; + dst += dp4; + } + break; + case DSPF_AYUV: while (height--) { const u32 *src32 = src; @@ -1839,6 +1888,26 @@ dfb_convert_to_rgb24( DFBSurfacePixelFormat format, dst += dpitch; } break; + case DSPF_BGR24: + while (height--) { + const u8 *src8 = src; + + for (n=0, n3=0; n<width; n++, n3+=3) { +#ifdef WORDS_BIGENDIAN + dst[n3+0] = src8[n3+2]; + dst[n3+1] = src8[n3+1]; + dst[n3+2] = src8[n3+0]; +#else + dst[n3+0] = src8[n3+0]; + dst[n3+1] = src8[n3+1]; + dst[n3+2] = src8[n3+2]; +#endif + } + + src += spitch; + dst += dpitch; + } + break; case DSPF_RGB32: while (height--) { const u32 *src32 = src; @@ -2254,6 +2323,7 @@ dfb_convert_to_a8( DFBSurfacePixelFormat format, case DSPF_BGR555: case DSPF_RGB16: case DSPF_RGB24: + case DSPF_BGR24: case DSPF_RGB32: case DSPF_VYU: case DSPF_YUY2: diff --git a/src/misc/gfx_util.c b/src/misc/gfx_util.c index 916247d..6188d48 100644 --- a/src/misc/gfx_util.c +++ b/src/misc/gfx_util.c @@ -262,6 +262,20 @@ static void write_argb_span (u32 *src, u8 *dst[], int len, } break; + case DSPF_BGR24: + for (i = 0; i < len; i++) { +#ifdef WORDS_BIGENDIAN + *d++ = src[i]; + *d++ = src[i] >> 8; + *d++ = src[i] >> 16; +#else + *d++ = src[i] >> 16; + *d++ = src[i] >> 8; + *d++ = src[i]; +#endif + } + break; + case DSPF_RGB32: case DSPF_ARGB: direct_memcpy( d, src, len*4 ); -- 1.7.9.5 _______________________________________________ directfb-dev mailing list directfb-dev@directfb.org http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev