This is needed for E-Ink devices outta there. Names of new files,
configure.ac variables and macros are awful, suggestions are welcome.

Signed-off-by: Mikhail Gusarov <[email protected]>
---
 configure.ac                                   |   22 ++++++++++++++++++++
 src/lib/engines/common/Makefile.am             |    2 +
 src/lib/engines/common/evas_convert_grypal_6.c |   26 ++++++++++++++++++++++++
 src/lib/engines/common/evas_convert_grypal_6.h |   10 +++++++++
 src/lib/engines/common/evas_convert_main.c     |    5 ++++
 5 files changed, 65 insertions(+), 0 deletions(-)
 create mode 100644 src/lib/engines/common/evas_convert_grypal_6.c
 create mode 100644 src/lib/engines/common/evas_convert_grypal_6.h

diff --git a/configure.ac b/configure.ac
index 287ec98..4be17e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1072,6 +1072,27 @@ EVAS_CONVERT_ROT(32, RGB, 270)
 ## Convert to 32bpp RGB with rotation of 90
 EVAS_CONVERT_ROT(32, RGB, 90)
 
+#######################################
+## Convert to 8bpp grayscale, 64-palette
+conv_8_grayscale_64="yes"
+AC_MSG_CHECKING(whether to build 8bpp grayscale 64-palette converter code)
+AC_ARG_ENABLE(convert-8-grayscale-64,
+  AC_HELP_STRING([--disable-convert-8-grayscale-64], [disable 8bpp grayscale 
64-palette converter code]),
+  [
+     if test "$enableval" = "xyes"; then
+       AC_DEFINE(BUILD_CONVERT_8_GRAYSCALE_64, 1, [8bpp Grayscale 64-palette 
Converter Support])
+       conv_8_grayscale_64="yes"
+     else
+       conv_8_grayscale_64="no"
+     fi
+  ], [
+     if test "x$conv_8_grayscale_64" = "xyes"; then
+       AC_DEFINE(BUILD_CONVERT_8_GRAYSCALE_64, 1, [32bpp Grayscale 64-palette 
Converter Support])
+     fi
+  ]
+)
+AC_MSG_RESULT($conv_8_grayscale_64)
+
 ## valgrind
 want_valgrind="no"
 have_valgrind="no"
@@ -1286,6 +1307,7 @@ echo "  8bpp RGB 222............: $conv_8_rgb_222"
 echo "  8bpp RGB 221............: $conv_8_rgb_221"
 echo "  8bpp RGB 121............: $conv_8_rgb_121"
 echo "  8bpp RGB 111............: $conv_8_rgb_111"
+echo "  8bpp Grayscale 64-pal...: $conv_8_grayscale_64"
 # FIXME: add grayscale and B&W support
 echo "  16bpp RGB 565...........: $conv_16_rgb_565"
 echo "  16bpp BGR 565...........: $conv_16_bgr_565"
diff --git a/src/lib/engines/common/Makefile.am 
b/src/lib/engines/common/Makefile.am
index 4b998bc..75a358c 100644
--- a/src/lib/engines/common/Makefile.am
+++ b/src/lib/engines/common/Makefile.am
@@ -35,6 +35,7 @@ evas_convert_rgb_16.c \
 evas_convert_rgb_24.c \
 evas_convert_rgb_32.c \
 evas_convert_rgb_8.c \
+evas_convert_grypal_6.c \
 evas_convert_yuv.c \
 evas_cpu.c \
 evas_draw_main.c \
@@ -78,6 +79,7 @@ evas_convert_colorspace.h \
 evas_convert_gry_1.h \
 evas_convert_gry_4.h \
 evas_convert_gry_8.h \
+evas_convert_grypal_6.h \
 evas_convert_main.h \
 evas_convert_rgb_16.h \
 evas_convert_rgb_24.h \
diff --git a/src/lib/engines/common/evas_convert_grypal_6.c 
b/src/lib/engines/common/evas_convert_grypal_6.c
new file mode 100644
index 0000000..786abe2
--- /dev/null
+++ b/src/lib/engines/common/evas_convert_grypal_6.c
@@ -0,0 +1,26 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+
+#include "evas_common.h"
+#include "evas_convert_grypal_6.h"
+
+#ifdef BUILD_CONVERT_8_GRAYSCALE_64
+void evas_common_convert_rgba_to_8bpp_pal_gray64       (DATA32 *src, DATA8 
*dst, int src_jump, int dst_jump, int w, int h, int dith_x, int dith_y, DATA8 
*pal)
+{
+    DATA32 *src_ptr;
+    DATA8 *dst_ptr;
+    int x, y;
+    DATA8 Y;
+
+    dst_ptr = dst;
+    CONVERT_LOOP_START_ROT_0();
+
+    /* RGB -> YUV conversion */
+    Y = (R_VAL(src_ptr) * 76 + G_VAL(src_ptr) * 151 + B_VAL(src_ptr) * 29) / 
1024;
+
+    *dst_ptr = pal[Y];
+
+    CONVERT_LOOP_END_ROT_0();
+}
+#endif
diff --git a/src/lib/engines/common/evas_convert_grypal_6.h 
b/src/lib/engines/common/evas_convert_grypal_6.h
new file mode 100644
index 0000000..38ccda8
--- /dev/null
+++ b/src/lib/engines/common/evas_convert_grypal_6.h
@@ -0,0 +1,10 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+
+#ifndef _EVAS_CONVERT_GRY_4_H
+#define _EVAS_CONVERT_GRY_4_H
+
+void evas_common_convert_rgba_to_8bpp_pal_gray64               (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_GRY_4_H */
diff --git a/src/lib/engines/common/evas_convert_main.c 
b/src/lib/engines/common/evas_convert_main.c
index 6271464..6182667 100644
--- a/src/lib/engines/common/evas_convert_main.c
+++ b/src/lib/engines/common/evas_convert_main.c
@@ -7,6 +7,7 @@
 #include "evas_convert_rgb_16.h"
 #include "evas_convert_rgb_24.h"
 #include "evas_convert_rgb_32.h"
+#include "evas_convert_grypal_6.h"
 #include "evas_convert_yuv.h"
 
 #ifdef USE_DITHER_44
@@ -193,6 +194,10 @@ evas_common_convert_func_get(DATA8 *dest, int w, int h, 
int depth, DATA32 rmask,
             if (pal_mode == PAL_MODE_RGB111)
               return evas_common_convert_rgba_to_8bpp_rgb_111_dith;
 #endif
+#ifdef BUILD_CONVERT_8_GRAYSCALE_64
+         if (pal_mode == PAL_MODE_GRAY64)
+            return evas_common_convert_rgba_to_8bpp_pal_gray64;
+#endif
          }
        if (depth == 1)
          {
-- 
1.6.3.3


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to