From eeb77c51e76584958a23f52dec8252f4b66d611b Mon Sep 17 00:00:00 2001 From: raster Date: Fri, 3 Apr 2009 01:00:54 +0000 Subject: [PATCH] add - in theory rgb24+32 666 support (ezx). git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@39836 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- configure.ac | 46 ++++++++++++++++++++++++++-- src/lib/engines/common/evas_convert_main.c | 28 +++++++++++++++++ src/lib/engines/common/evas_convert_rgb_24.c | 32 +++++++++++++++++++ src/lib/engines/common/evas_convert_rgb_24.h | 3 +- src/lib/engines/common/evas_convert_rgb_32.c | 24 +++++++++++++++ src/lib/engines/common/evas_convert_rgb_32.h | 1 + 6 files changed, 131 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 77a663f..d5a614f 100644 --- a/configure.ac +++ b/configure.ac @@ -922,6 +922,48 @@ EVAS_CONVERT_COLOR(32, BGR, 8888) EVAS_CONVERT_COLOR(32, BGRX, 8888) ####################################### +## Convert to 24bpp RGB 666 (666 ezx) +conv_24_rgb_ezx="yes" +AC_MSG_CHECKING(whether to build 24bpp 666 (666 ezx) converter code) +AC_ARG_ENABLE(convert-24-rgb-ezx, + AC_HELP_STRING([--disable-convert-24-rgb-ezx], [disable 24bpp 666 (666 ezx) converter code]), + [ + if test "x$enableval" = "xyes" ; then + AC_DEFINE(BUILD_CONVERT_24_RGB_666, 1, [24bpp 666 (666 ezx) Converter Support]) + conv_24_rgb_ezx="yes" + else + conv_24_rgb_ezx="no" + fi + ], [ + if test "x$conv_24_rgb_ezx" = "xyes" ; then + AC_DEFINE(BUILD_CONVERT_24_RGB_666, 1, [24bpp 666 (666 ezx) Converter Support]) + fi + ] +) +AC_MSG_RESULT($conv_24_rgb_ezx) + +####################################### +## Convert to 32bpp RGB 666 (666 ezx) +conv_32_rgb_ezx="yes" +AC_MSG_CHECKING(whether to build 32bpp 666 (666 ezx) converter code) +AC_ARG_ENABLE(convert-32-rgb-ezx, + AC_HELP_STRING([--disable-convert-32-rgb-ezx], [disable 32bpp 666 (666 ezx) converter code]), + [ + if test "x$enableval" = "xyes" ; then + AC_DEFINE(BUILD_CONVERT_32_RGB_666, 1, [32bpp 666 (666 ezx) Converter Support]) + conv_32_rgb_ezx="yes" + else + conv_32_rgb_ezx="no" + fi + ], [ + if test "x$conv_32_rgb_ezx" = "xyes" ; then + AC_DEFINE(BUILD_CONVERT_32_RGB_666, 1, [32bpp 666 (666 ezx) Converter Support]) + fi + ] +) +AC_MSG_RESULT($conv_32_rgb_ezx) + +####################################### ## Convert to 32bpp RGB with rotation of 0 EVAS_CONVERT_ROT(32, RGB, 0) ## Convert to 32bpp RGB with rotation of 180 @@ -1147,8 +1189,6 @@ echo " 16bpp RGB 555...........: $conv_16_rgb_555" echo " 16bpp RGB 444...........: $conv_16_rgb_444" echo " 16bpp RGB 565 (444 ipaq): $conv_16_rgb_ipq" # FIXME: add 555 (444 ipaq) support -# FIXME: add 24bpp 666 support -# FIXME: add 32bpp 666 support # FIXME: add 30bpp support # FIXME: add palletted support # FIXME: add 8bpp and below rotation @@ -1158,11 +1198,13 @@ echo " 16bpp Rotation 180......: $conv_16_rgb_rot_180" echo " 16bpp Rotation 270......: $conv_16_rgb_rot_270" echo " 24bpp RGB 888...........: $conv_24_rgb_888" echo " 24bpp BGR 888...........: $conv_24_bgr_888" +echo " 24bpp RGB 666 (666 ezx).: $conv_24_rgb_ezx" # FIXME: add 24bpp rotation echo " 32bpp RGB 8888..........: $conv_32_rgb_8888" echo " 32bpp RGBX 8888.........: $conv_32_rgbx_8888" echo " 32bpp BGR 8888..........: $conv_32_bgr_8888" echo " 32bpp BGRX 8888.........: $conv_32_bgrx_8888" +echo " 32bpp RGB 666 (666 ezx).: $conv_32_rgb_ezx" echo " 32bpp Rotation 0........: $conv_32_rgb_rot_0" echo " 32bpp Rotation 90.......: $conv_32_rgb_rot_90" echo " 32bpp Rotation 180......: $conv_32_rgb_rot_180" diff --git a/src/lib/engines/common/evas_convert_main.c b/src/lib/engines/common/evas_convert_main.c index 2a98b4c..6271464 100644 --- a/src/lib/engines/common/evas_convert_main.c +++ b/src/lib/engines/common/evas_convert_main.c @@ -540,6 +540,27 @@ evas_common_convert_func_get(DATA8 *dest, int w, int h, int depth, DATA32 rmask, #endif } #endif +#ifdef BUILD_CONVERT_32_RGB_666 + if ((rmask == 0x0003f000) && (gmask == 0x00000fc0) && (bmask == 0x0000003f)) + { +#ifdef BUILD_CONVERT_32_RGB_ROT0 + if (rotation == 0) + return evas_common_convert_rgba_to_32bpp_rgb_666; +#endif +#ifdef BUILD_CONVERT_32_RGB_ROT180 +// if (rotation == 180) +// return evas_common_convert_rgba_to_32bpp_rgb_8888_rot_180; +#endif +#ifdef BUILD_CONVERT_32_RGB_ROT270 +// if (rotation == 270) +// return evas_common_convert_rgba_to_32bpp_rgb_8888_rot_270; +#endif +#ifdef BUILD_CONVERT_32_RGB_ROT90 +// if (rotation == 90) +// return evas_common_convert_rgba_to_32bpp_rgb_8888_rot_90; +#endif + } +#endif } if (depth == 24) { @@ -550,6 +571,13 @@ evas_common_convert_func_get(DATA8 *dest, int w, int h, int depth, DATA32 rmask, return evas_common_convert_rgba_to_24bpp_rgb_888; } #endif +#ifdef BUILD_CONVERT_24_RGB_666 + if ((rmask == 0x0003f000) && (gmask == 0x00000fc0) && (bmask == 0x0000003f)) + { + if (rotation == 0) + return evas_common_convert_rgba_to_24bpp_rgb_666; + } +#endif #ifdef BUILD_CONVERT_24_BGR_888 if ((rmask == 0x000000ff) && (gmask == 0x0000ff00) && (bmask == 0x00ff0000)) { diff --git a/src/lib/engines/common/evas_convert_rgb_24.c b/src/lib/engines/common/evas_convert_rgb_24.c index 4952f9f..d5d4f4e 100644 --- a/src/lib/engines/common/evas_convert_rgb_24.c +++ b/src/lib/engines/common/evas_convert_rgb_24.c @@ -32,6 +32,38 @@ evas_common_convert_rgba_to_24bpp_rgb_888(DATA32 *src, DATA8 *dst, int src_jump, return; } #endif +#ifdef BUILD_CONVERT_24_RGB_666 +void +evas_common_convert_rgba_to_24bpp_rgb_666(DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__) +{ + DATA32 *src_ptr; + DATA8 *dst_ptr, *scratch_ptr; + DATA32 scratch; + int x, y; + + dst_ptr = (DATA8 *)dst; + src_ptr = (DATA32 *)src; + + scratch_ptr = (DATA8 *)(&scratch); + for (y = 0; y < h; y++) + { + for (x = 0; x < w; x++) + { + scratch = + (((R_VAL(src_ptr) << 12) | (B_VAL(src_ptr) >> 2)) & 0x03f03f) | + ((G_VAL(src_ptr) << 4) & 0x000fc0); + dst_ptr[0] = scratch_ptr[1]; + dst_ptr[1] = scratch_ptr[2]; + dst_ptr[2] = scratch_ptr[3]; + src_ptr++; + dst_ptr+=3; + } + src_ptr += src_jump; + dst_ptr += (dst_jump * 3); + } + return; +} +#endif #ifdef BUILD_CONVERT_24_BGR_888 void evas_common_convert_rgba_to_24bpp_bgr_888(DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__) diff --git a/src/lib/engines/common/evas_convert_rgb_24.h b/src/lib/engines/common/evas_convert_rgb_24.h index 53fe088..5a67cbc 100644 --- a/src/lib/engines/common/evas_convert_rgb_24.h +++ b/src/lib/engines/common/evas_convert_rgb_24.h @@ -9,5 +9,6 @@ void evas_common_convert_rgba_to_24bpp_rgb_888 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal); void evas_common_convert_rgba_to_24bpp_bgr_888 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal); - +void evas_common_convert_rgba_to_24bpp_rgb_666 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal); + #endif /* _EVAS_CONVERT_RGB_24_H */ diff --git a/src/lib/engines/common/evas_convert_rgb_32.c b/src/lib/engines/common/evas_convert_rgb_32.c index 67dad74..05ad414 100644 --- a/src/lib/engines/common/evas_convert_rgb_32.c +++ b/src/lib/engines/common/evas_convert_rgb_32.c @@ -349,3 +349,27 @@ evas_common_convert_rgba_to_32bpp_bgrx_8888_rot_90 (DATA32 *src, DATA8 *dst, int } #endif #endif + +#ifdef BUILD_CONVERT_32_RGB_666 +#ifdef BUILD_CONVERT_32_RGB_ROT0 +void +evas_common_convert_rgba_to_32bpp_rgb_666(DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__) +{ + DATA32 *src_ptr; + DATA32 *dst_ptr; + int x, y; + + dst_ptr = (DATA32 *)dst; + + CONVERT_LOOP_START_ROT_0(); + + *dst_ptr = + (((R_VAL(src_ptr) << 12) | (B_VAL(src_ptr) >> 2)) & 0x03f03f) | + ((G_VAL(src_ptr) << 4) & 0x000fc0); + + CONVERT_LOOP_END_ROT_0(); + return; +} +#endif +#endif + diff --git a/src/lib/engines/common/evas_convert_rgb_32.h b/src/lib/engines/common/evas_convert_rgb_32.h index 7adb9b2..8f4150f 100644 --- a/src/lib/engines/common/evas_convert_rgb_32.h +++ b/src/lib/engines/common/evas_convert_rgb_32.h @@ -23,5 +23,6 @@ void evas_common_convert_rgba_to_32bpp_bgrx_8888_rot_180 (DATA32 *src, DAT void evas_common_convert_rgba_to_32bpp_bgrx_8888_rot_270 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal); void evas_common_convert_rgba_to_32bpp_bgrx_8888_rot_90 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal); +void evas_common_convert_rgba_to_32bpp_rgb_666 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 *pal); #endif /* _EVAS_CONVERT_RGB_32_H */ -- 2.7.4